Skip to content

Commit

Permalink
aoc_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrk-its committed Feb 20, 2024
1 parent 2f11e17 commit 8095ae4
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 38 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/aoc_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: aoc_tests
on:
workflow_dispatch:
inputs:
llvm_mos_ref:
description: 'llvm-mos ref'
default: 'main'
type: string
llvm_mos_sdk_ref:
description: 'llvm-mos-sdk ref'
default: 'main'
type: string

workflow_call:
inputs:
llvm_mos_ref:
description: 'llvm-mos ref'
default: 'main'
type: string
llvm_mos_sdk_ref:
description: 'llvm-mos-sdk ref'
default: 'main'
type: string
rust_mos_sha:
type: string

jobs:
run_aoc_tests:
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]

runs-on: ubuntu-latest

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platform: ${{ matrix.arch }}

- name: Checkout aoc2022
uses: actions/checkout@v4
with:
repository: mrk-its/aoc2022
path: aoc2022
ref: new_rust

- name: Checkout aoc2022 inputs
uses: actions/checkout@v4
with:
repository: mrk-its/aoc2022_inputs
path: aoc2022/input
token: ${{ secrets.AOC2022_PAT }}

- name: Set short sha
id: short_sha
run: |
echo "rust_mos=$(echo ${{ inputs.rust_mos_sha || github.sha }} | cut -b 1-8)" >> $GITHUB_OUTPUT
echo "llvm_mos=$(echo ${{ inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
- name: chown
run: |
pwd
find .
sudo chown -R 1000.1000 aoc2022
- name: run_all
run: |
docker run --rm -v $(pwd):/workspace -w /workspace --platform linux/${{ matrix.arch }} \
mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.short_sha.outputs.rust_mos }} \
/bin/bash --login -c /workspace/aoc2022/run_all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: llvm_cross_build
name: build_rust_mos_docker_image
on:
workflow_dispatch:
inputs:
Expand All @@ -12,39 +12,42 @@ on:
type: string
llvm_mos_ref:
description: 'llvm-mos ref'
default: '1d7989f2995b83178ef26a28b4edf70bf556096b'
default: '8935d0b23f66086a0638dd7ade680398477cd782'
type: string
llvm_mos_sdk_ref:
description: 'llvm-mos-sdk ref'
default: '777e89e95d389a6a67f7f3c572f7dd2b1730d209'
default: '6d4994fbcb21c7e02053b360cff7eb60bf7be1ab'
type: string
rust_mos_sha:
description: 'rust_mos_sha (last part of image name)'
default: '21ee0734'
type: string

jobs:
amd64_image:
if: ${{ false }}
if: ${{ true }}
uses: ./.github/workflows/cross-build-llvm-mos.yml
with:
arch: amd64
llvm_mos_repo: ${{ github.event.inputs.llvm_mos_repo }}
llvm_mos_sdk_repo: ${{ github.event.inputs.llvm_mos_sdk_repo }}
llvm_mos_ref: ${{ github.event.inputs.llvm_mos_ref }}
llvm_mos_sdk_ref: ${{ github.event.inputs.llvm_mos_sdk_ref }}
llvm_mos_repo: ${{ inputs.llvm_mos_repo }}
llvm_mos_sdk_repo: ${{ inputs.llvm_mos_sdk_repo }}
llvm_mos_ref: ${{ inputs.llvm_mos_ref }}
llvm_mos_sdk_ref: ${{ inputs.llvm_mos_sdk_ref }}
secrets: inherit

arm64_image_tmp:
if: ${{ false }}
if: ${{ true }}
uses: ./.github/workflows/cross-build-llvm-mos.yml
with:
arch: arm64
arch_suffix: -tmp
llvm_mos_repo: ${{ github.event.inputs.llvm_mos_repo }}
llvm_mos_sdk_repo: ${{ github.event.inputs.llvm_mos_sdk_repo }}
llvm_mos_ref: ${{ github.event.inputs.llvm_mos_ref }}
llvm_mos_sdk_ref: ${{ github.event.inputs.llvm_mos_sdk_ref }}
llvm_mos_repo: ${{ inputs.llvm_mos_repo }}
llvm_mos_sdk_repo: ${{ inputs.llvm_mos_sdk_repo }}
llvm_mos_ref: ${{ inputs.llvm_mos_ref }}
llvm_mos_sdk_ref: ${{ inputs.llvm_mos_sdk_ref }}
secrets: inherit

arm64_image:
if: ${{ false }}
if: ${{ true }}
runs-on: ubuntu-latest
needs:
- amd64_image
Expand All @@ -68,8 +71,8 @@ jobs:
- name: Set short sha
id: short_sha
run: |
echo "llvm_mos=$(echo ${{ github.event.inputs.llvm_mos_ref }} | cut -b 1-9) >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ github.event.inputs.llvm_mos_sdk_ref }} | cut -b 1-7) >> $GITHUB_OUTPUT
echo "llvm_mos=$(echo ${{ inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
- name: Build and push fixed arm image
id: build_fixed_arm_image
Expand All @@ -85,12 +88,23 @@ jobs:
TARGETARCH=arm64
final:
build_image:
if: ${{ true }}
runs-on: ubuntu-latest
# needs:
# - amd64_image
# - arm64_image
needs:
- amd64_image
- arm64_image
steps:
- name: Set short sha
id: short_sha
run: |
echo "rust_mos=$(echo ${{ inputs.rust_mos_sha || github.sha }} | cut -b 1-8)" >> $GITHUB_OUTPUT
echo "llvm_mos=$(echo ${{ inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
- name: show revisions
run: "echo llvm-mos: ${{ steps.short_sha.outputs.llvm_mos}} llvm-mos-sdk: ${{ steps.short_sha.outputs.llvm_mos_sdk}} rust_mos: ${{ steps.short_sha.outputs.rust_mos}}"

- name: cleanup
run: |
echo "=============================================================================="
Expand Down Expand Up @@ -120,20 +134,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set short sha
id: short_sha
run: |
echo "rust_mos=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "llvm_mos=$(echo ${{ github.event.inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ github.event.inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
- name: clean2
id: clean2
run: rm -fr docker/llvm-mos/llvm-mos docker/llvm-mos/llvm-mos-sdk; df -h

- name: show revisions
run: "echo llvm-mos: ${{ steps.short_sha.outputs.llvm_mos}} llvm-mos-sdk: ${{ steps.short_sha.outputs.llvm_mos_sdk}} rust_mos: ${{ steps.short_sha.outputs.rust_mos}}"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand Down Expand Up @@ -166,3 +166,13 @@ jobs:
build-args: |
LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}
RUST_MOS_DIST_IMAGE=mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.short_sha.outputs.rust_mos }}-dist
test_image:
needs:
- build_image
uses: ./.github/workflows/aoc_tests.yml
with:
llvm_mos_ref: ${{inputs.llvm_mos_ref}}
llvm_mos_sdk_ref: ${{inputs.llvm_mos_sdk_ref}}
rust_mos_sha: ${{inputs.rust_mos_sha}}
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/cross-build-llvm-mos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
- name: Set short sha
id: short_sha
run: |
echo "llvm_mos=$(echo ${{ github.event.inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ github.event.inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
echo "llvm_mos=$(echo ${{ inputs.llvm_mos_ref }} | cut -b 1-9)" >> $GITHUB_OUTPUT
echo "llvm_mos_sdk=$(echo ${{ inputs.llvm_mos_sdk_ref }} | cut -b 1-7)" >> $GITHUB_OUTPUT
- name: Check outputs
run: echo ${{ steps.short_sha.outputs.llvm_mos }} ${{ steps.short_sha.outputs.llvm_mos_sdk }}
Expand Down
2 changes: 1 addition & 1 deletion docker/rust-mos/Dockerfile.multiarch
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ USER mos

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
ENV PATH=$HOME/.cargo/bin:$PATH
RUN bash -c "echo RUST_TARGET_PATH=$RUST_TARGET_PATH >> $HOME/.bashrc"
RUN bash -c "source $HOME/.cargo/env; rustup toolchain link mos /usr/local/rust-mos; rustup default mos"

WORKDIR /home/mos

0 comments on commit 8095ae4

Please sign in to comment.