diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bca027f..fa0f9e2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ on: - 'v*.*.*' env: - PULL_REQUEST: ${{ github.event_name == 'pull_request' && 'false' || 'true' }} + PUSH_LATEST: ${{ github.event_name == 'pull_request' && 'false' || 'true' }} concurrency: group: ${{ github.workflow }} @@ -75,7 +75,7 @@ jobs: with: digest_artifact_prefix: digests-rust-base images: mobilecoin/rust-base - flavor: latest=true + flavor: latest=${{ env.PUSH_LATEST }} tags: | type=semver,pattern=v{{version}} type=sha @@ -95,11 +95,10 @@ jobs: uses: mobilecoinofficial/gh-actions/short-sha@fe9ca9700d7a88e7b6d32165512fb170a0528dc9 - name: Docker rust-sgx - id: build uses: mobilecoinofficial/gh-actions/docker@fe9ca9700d7a88e7b6d32165512fb170a0528dc9 with: dockerfile: Dockerfile.rust-sgx - flavor: latest=true + flavor: latest=${{ env.PUSH_LATEST }} images: mobilecoin/rust-sgx tags: | type=semver,pattern=v{{version}} @@ -109,69 +108,100 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + docker-fat-sgx-builder: + needs: + - docker-rust-sgx + runs-on: mco-dev-small-x64 + steps: + - name: Checkout + uses: mobilecoinofficial/gh-actions/checkout@v0 + + - name: Short Sha + id: short_sha + uses: mobilecoinofficial/gh-actions/short-sha@fe9ca9700d7a88e7b6d32165512fb170a0528dc9 + + - name: Docker fat-sgx-builder + uses: mobilecoinofficial/gh-actions/docker@v0 + with: + dockerfile: Dockerfile.fat-builder + flavor: latest=${{ env.PUSH_LATEST }} + images: mobilecoin/fat-sgx-builder + build_args: | + BASE_IMAGE=rust-sgx + BASE_IMAGE_TAG=${{ steps.short_sha.outputs.short_sha }} + tags: | + type=semver,pattern=v{{version}} + type=sha + push: true + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + docker-fat-builder: + needs: + - docker-rust-base-merge + strategy: + matrix: + runner: + - mco-dev-small-x64 + - mco-dev-small-arm64 + runs-on: ${{ matrix.runner }} + steps: + - name: Checkout + uses: mobilecoinofficial/gh-actions/checkout@v0 + + - name: Short Sha + id: short_sha + uses: mobilecoinofficial/gh-actions/short-sha@fe9ca9700d7a88e7b6d32165512fb170a0528dc9 - # docker-fat-builder: - # needs: - # - docker-rust-base - # strategy: - # matrix: - # runner: - # - mco-dev-small-x64 - # - mco-dev-small-arm64 - # runs-on: ${{ matrix.runner }} - # steps: - # - name: Checkout - # uses: mobilecoinofficial/gh-actions/checkout@v0 - # - name: Docker fat-builder - # uses: mobilecoinofficial/gh-actions/docker@v0 - # with: - # flavor: latest=true - # dockerfile: Dockerfile.fat-builder - # images: mobilecoin/fat-builder - # build_args: | - # BASE_IMAGE=rust-base - # tags: | - # type=ref,event=branch - # type=semver,pattern=v{{version}} - # type=semver,pattern=v{{major}}.{{minor}} - # type=semver,pattern=v{{major}} - # type=sha - # push: true - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - - # docker-fat-sgx-builder: - # needs: - # - docker-rust-sgx - # runs-on: mco-dev-small-x64 - # steps: - # - name: Docker fat-sgx-builder - # uses: mobilecoinofficial/gh-actions/docker@v0 - # with: - # flavor: latest=true - # dockerfile: Dockerfile.fat-builder - # images: mobilecoin/fat-sgx-builder - # build_args: | - # BASE_IMAGE=rust-sgx - # tags: | - # type=ref,event=branch - # type=semver,pattern=v{{version}} - # type=semver,pattern=v{{major}}.{{minor}} - # type=semver,pattern=v{{major}} - # type=sha - # push: true - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - - # success: - # needs: - # - lint-actions - # - lint-docker - # - docker-rust-base - # - docker-rust-sgx - # - docker-fat-builder - # - docker-fat-sgx-builder - # runs-on: mco-dev-small-x64 - # steps: - # - name: Success - # run: echo "All Builds Success" + - name: Docker fat-builder + id: build + uses: mobilecoinofficial/gh-actions/docker@fe9ca9700d7a88e7b6d32165512fb170a0528dc9 + with: + dockerfile: Dockerfile.fat-builder + images: mobilecoin/fat-builder + build_args: | + BASE_IMAGE=rust-base + BASE_IMAGE_TAG=${{ steps.short_sha.outputs.short_sha }} + outputs: type=image,name=mobilecoin/fat-builder,push-by-digest=true,name-canonical=true,push=true + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: mobilecoinofficial/gh-actions/upload-artifact@v0 + with: + name: digests-fat-builder-${{ runner.arch }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + docker-fat-builder-merge: + runs-on: mco-dev-small-x64 + needs: + - docker-fat-builder + steps: + - name: Merge and Tag Digests + uses: mobilecoinofficial/gh-actions/docker-merge-digests@fe9ca9700d7a88e7b6d32165512fb170a0528dc9 + with: + digest_artifact_prefix: digests-fat-builder + images: mobilecoin/fat-builder + flavor: latest=${{ env.PUSH_LATEST }} + tags: | + type=semver,pattern=v{{version}} + type=sha + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + success: + needs: + - docker-fat-builder-merge + - docker-fat-sgx-builder + runs-on: mco-dev-small-x64 + steps: + - name: Success + run: echo "All Builds Success"