Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 32 additions & 45 deletions .github/workflows/crux-mir-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,14 @@ jobs:
path: crux-mir-*.tar.gz*
name: crux-mir-${{ matrix.os }}-${{ runner.arch }}-${{ matrix.ghc }}

build-push-image:
runs-on: ubuntu-24.04
build-image:
runs-on: ${{ matrix.os }}
needs: [config]
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || needs.config.outputs.release == 'true') && github.repository_owner == 'GaloisInc'
# if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || needs.config.outputs.release == 'true') && github.repository_owner == 'GaloisInc'
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
include:
- file: .github/Dockerfile-crux-mir
image: ghcr.io/galoisinc/crux-mir
Expand All @@ -251,67 +252,53 @@ jobs:
run: |
# The crux-mir Docker image is rather large (~1GB compressed), and
# the mere act of building the image requires just over 14 GB of disk
# space, which the maximum provided by a GitHub Action CI runner. To
# space, which is the maximum provided by a GitHub Action CI runner. To
# clear up some extra space, we delete ~10GB worth of pre-installed
# GitHub Actions tools, none of which we make use of.
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY" # Python installations

- uses: rlespinasse/github-slug-action@v3.x

- id: common-tag
run: |
echo "::set-output name=common-tag::$GITHUB_REF_SLUG"
echo "COMMON_TAG=$GITHUB_REF_SLUG" >> $GITHUB_ENV

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

- uses: crazy-max/ghaction-docker-meta@v1
name: Labels
id: labels
- name: Docker metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ matrix.image }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,manifest-descriptor

- uses: docker/login-action@v1
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v2
- name: Build and push by digest
uses: docker/build-push-action@v6
id: build
with:
context: .
tags: ${{ matrix.image }}:${{ steps.common-tag.outputs.common-tag }}
labels: ${{ steps.labels.outputs.labels }}
load: true
push: false
file: ${{ matrix.file }}
build-args: ${{ matrix.build-args }}
cache-from: |
type=registry,ref=${{ matrix.cache }}:${{ steps.prefix.outputs.prefix }}master
type=registry,ref=${{ matrix.cache }}:${{ steps.common-tag.outputs.common-tag }}

- name: Cache image build
uses: docker/build-push-action@v2
continue-on-error: true # Tolerate cache upload failures - this should be handled better
with:
context: .
file: ${{ matrix.file }}
build-args: ${{ matrix.build-args }}
cache-to: type=registry,ref=${{ matrix.cache }}:${{ steps.common-tag.outputs.common-tag }},mode=max
tags: ${{ matrix.image }}
annotations: ${{ steps.meta.outputs.annotations }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true

- if: needs.config.outputs.event-schedule == 'true'
name: ${{ matrix.image }}:nightly
- name: Export digest
run: |
docker tag ${{ matrix.image }}:$COMMON_TAG ${{ matrix.image }}:nightly
docker push ${{ matrix.image }}:nightly
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"

- if: needs.config.outputs.release == 'true'
name: ${{ matrix.image }}:${{ needs.config.outputs.crux-mir-version }}
run: |
docker tag ${{ matrix.image }}:$COMMON_TAG ${{ matrix.image }}:${{ needs.config.outputs.crux-mir-version }}
docker push ${{ matrix.image }}:${{ needs.config.outputs.crux-mir-version }}
docker tag ${{ matrix.image }}:$COMMON_TAG ${{ matrix.image }}:latest
docker push ${{ matrix.image }}:latest
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ runner.arch }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
File renamed without changes.
Loading