|
| 1 | +name: llvm_cross_build |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + llvm_mos_repo: |
| 6 | + description: 'llvm-mos repo' |
| 7 | + default: 'llvm-mos/llvm-mos' |
| 8 | + type: string |
| 9 | + llvm_mos_sdk_repo: |
| 10 | + description: 'llvm-mos-sdk repo' |
| 11 | + default: 'llvm-mos/llvm-mos-sdk' |
| 12 | + type: string |
| 13 | + llvm_mos_ref: |
| 14 | + description: 'llvm-mos ref' |
| 15 | + default: 'adbc7b3dd18b8a8a0bbd69c50f33b3b07ec0abf5' |
| 16 | + type: string |
| 17 | + llvm_mos_sdk_ref: |
| 18 | + description: 'llvm-mos-sdk ref' |
| 19 | + default: '3e94be457ceece85739853e118c67a1d82450f4f' |
| 20 | + type: string |
| 21 | + |
| 22 | +jobs: |
| 23 | + amd64_image: |
| 24 | + if: ${{ false }} |
| 25 | + uses: ./.github/workflows/cross-build-llvm-mos.yml |
| 26 | + with: |
| 27 | + arch: amd64 |
| 28 | + llvm_mos_repo: ${{ github.event.inputs.llvm_mos_repo }} |
| 29 | + llvm_mos_sdk_repo: ${{ github.event.inputs.llvm_mos_sdk_repo }} |
| 30 | + llvm_mos_ref: ${{ github.event.inputs.llvm_mos_ref }} |
| 31 | + llvm_mos_sdk_ref: ${{ github.event.inputs.llvm_mos_sdk_ref }} |
| 32 | + secrets: inherit |
| 33 | + |
| 34 | + arm64_image: |
| 35 | + if: ${{ false }} |
| 36 | + uses: ./.github/workflows/cross-build-llvm-mos.yml |
| 37 | + with: |
| 38 | + arch: arm64 |
| 39 | + llvm_mos_repo: ${{ github.event.inputs.llvm_mos_repo }} |
| 40 | + llvm_mos_sdk_repo: ${{ github.event.inputs.llvm_mos_sdk_repo }} |
| 41 | + llvm_mos_ref: ${{ github.event.inputs.llvm_mos_ref }} |
| 42 | + llvm_mos_sdk_ref: ${{ github.event.inputs.llvm_mos_sdk_ref }} |
| 43 | + secrets: inherit |
| 44 | + |
| 45 | + final: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + # needs: |
| 48 | + # - amd64_image |
| 49 | + # - arm64_image |
| 50 | + steps: |
| 51 | + - name: Set up QEMU |
| 52 | + uses: docker/setup-qemu-action@v2 |
| 53 | + |
| 54 | + - name: Checkout |
| 55 | + uses: actions/checkout@v3 |
| 56 | + |
| 57 | + - name: Checkout llvm-mos |
| 58 | + uses: actions/checkout@v3 |
| 59 | + with: |
| 60 | + repository: ${{ github.event.inputs.llvm_mos_repo }} |
| 61 | + path: docker/llvm-mos/llvm-mos |
| 62 | + ref: ${{ github.event.inputs.llvm_mos_ref }} |
| 63 | + |
| 64 | + - name: Checkout llvm-mos-sdk |
| 65 | + uses: actions/checkout@v3 |
| 66 | + with: |
| 67 | + repository: ${{ github.event.inputs.llvm_mos_sdk_repo }} |
| 68 | + path: docker/llvm-mos/llvm-mos-sdk |
| 69 | + ref: ${{github.event.inputs.llvm_mos_sdk_ref }} |
| 70 | + |
| 71 | + - name: Set short sha |
| 72 | + id: short_sha |
| 73 | + run: echo -e "::set-output name=llvm_mos::$(cd docker/llvm-mos/llvm-mos; git rev-parse --short HEAD)\n::set-output name=llvm_mos_sdk::$(cd docker/llvm-mos/llvm-mos-sdk; git rev-parse --short HEAD)" |
| 74 | + |
| 75 | + - name: Set rust-mos short sha |
| 76 | + id: rust_mos |
| 77 | + run: echo -e "::set-output name=short_sha::$(git rev-parse --short HEAD)" |
| 78 | + # run: echo -e "::set-output name=short_sha::ad5d187a" |
| 79 | + |
| 80 | + - name: show revisions |
| 81 | + run: "echo llvm_mos: ${{ steps.short_sha.outputs.llvm_mos }} llvm_mos_sdk: ${{ steps.short_sha.outputs.llvm_mos_sdk }} rust_mos: ${{ steps.rust_mos.outputs.short_sha }}" |
| 82 | + |
| 83 | + - name: Set up Docker Buildx |
| 84 | + uses: docker/setup-buildx-action@v1 |
| 85 | + |
| 86 | + - name: Login to DockerHub |
| 87 | + uses: docker/login-action@v1 |
| 88 | + with: |
| 89 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 90 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 91 | + |
| 92 | + - name: Build and push rust-mos |
| 93 | + id: build_rust_dist_image |
| 94 | + uses: docker/build-push-action@v2 |
| 95 | + with: |
| 96 | + push: true |
| 97 | + tags: mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.rust_mos.outputs.short_sha }}-dist |
| 98 | + file: docker/rust-mos/Dockerfile |
| 99 | + context: . |
| 100 | + build-args: | |
| 101 | + LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }} |
| 102 | + cache-from: type=registry,ref=mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.rust_mos.outputs.short_sha }}-dist |
| 103 | + |
| 104 | + - name: Build and push multi-platform rust-mos image |
| 105 | + id: build_rust_multiarch_image |
| 106 | + uses: docker/build-push-action@v2 |
| 107 | + with: |
| 108 | + push: true |
| 109 | + tags: mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.rust_mos.outputs.short_sha }} |
| 110 | + file: docker/rust-mos/Dockerfile.multiarch |
| 111 | + platforms: linux/amd64 |
| 112 | + #,linux/arm64 |
| 113 | + context: docker/rust-mos/ |
| 114 | + build-args: | |
| 115 | + LLVM_MOS_IMAGE=mrkits/llvm-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }} |
| 116 | + RUST_MOS_DIST_IMAGE=mrkits/rust-mos:${{ steps.short_sha.outputs.llvm_mos }}-${{ steps.short_sha.outputs.llvm_mos_sdk }}-${{ steps.rust_mos.outputs.short_sha }}-dist |
| 117 | +
|
0 commit comments