build_rust_mos_docker_image #48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build_rust_mos_docker_image | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| llvm_mos_repo: | |
| description: 'llvm-mos repo' | |
| default: 'llvm-mos/llvm-mos' | |
| type: string | |
| llvm_mos_sdk_repo: | |
| description: 'llvm-mos-sdk repo' | |
| default: 'llvm-mos/llvm-mos-sdk' | |
| type: string | |
| llvm_mos_ref: | |
| description: 'llvm-mos ref' | |
| default: '7c0751c5b1e2fd62e1e0e358e9e853903f876920' | |
| type: string | |
| llvm_mos_sdk_ref: | |
| description: 'llvm-mos-sdk ref' | |
| default: '334fc9823745284938bfba543112f95bfb489b50' | |
| type: string | |
| rust_mos_sha: | |
| description: 'rust_mos_sha (last part of image name)' | |
| # default: '14b5f533' | |
| type: string | |
| jobs: | |
| amd64_image: | |
| if: ${{ false }} | |
| uses: ./.github/workflows/cross-build-llvm-mos.yml | |
| with: | |
| arch: amd64 | |
| 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 }} | |
| uses: ./.github/workflows/cross-build-llvm-mos.yml | |
| with: | |
| arch: arm64 | |
| arch_suffix: -tmp | |
| 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 }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - amd64_image | |
| - arm64_image_tmp | |
| steps: | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set short sha | |
| id: short_sha | |
| run: | | |
| 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 | |
| uses: docker/build-push-action@v2 | |
| with: | |
| push: true | |
| tags: mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-arm64 | |
| file: docker/llvm-mos/Dockerfile.fix.arm64 | |
| context: . | |
| platforms: arm64 | |
| build-args: | | |
| LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }} | |
| TARGETARCH=arm64 | |
| build_image: | |
| if: ${{ true }} | |
| runs-on: ubuntu-latest | |
| 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: "disk usage, before" | |
| run: df -h | |
| - name: Maximize build space | |
| uses: AdityaGarg8/remove-unwanted-software@v5 | |
| with: | |
| remove-android: 'true' | |
| remove-dotnet: 'true' | |
| remove-haskell: 'true' | |
| remove-codeql: 'true' | |
| remove-docker-images: 'true' | |
| remove-large-packages: 'true' | |
| remove-cached-tools: 'true' | |
| remove-swapfile: 'true' | |
| - name: "disk usage, after" | |
| run: df -h | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push rust-mos | |
| id: build_rust_dist_image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.short_sha.outputs.rust_mos}}-dist | |
| file: docker/rust-mos/Dockerfile | |
| context: . | |
| build-args: | | |
| LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }} | |
| - name: Build and push multi-platform rust-mos image | |
| id: build_rust_multiarch_image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.short_sha.outputs.rust_mos }} | |
| file: docker/rust-mos/Dockerfile.multiarch | |
| platforms: linux/amd64,linux/arm64 | |
| context: docker/rust-mos/ | |
| 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 |