Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker C extraction: retag tested container as latest and use latest hosted image in workflows #806

Merged
merged 3 commits into from
Feb 11, 2025
Merged
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
15 changes: 12 additions & 3 deletions .github/workflows/c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
workflow_dispatch:
merge_group:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-c
VERSION_TAG: latest

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -28,6 +33,7 @@ jobs:
outputs:
# only run if files in `.docker/c/` unchanged
should-run: ${{ steps.changes.outputs.docker-c == 'false' }}
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION_TAG }}

report-status-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -56,7 +62,8 @@ jobs:
needs: [setup]
if: ${{ needs.setup.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
container: franziskus/libcrux-c:latest
container:
image: ${{ needs.setup.outputs.image }}
defaults:
run:
working-directory: libcrux-ml-kem
Expand All @@ -80,7 +87,8 @@ jobs:
needs: [setup]
if: ${{ needs.setup.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
container: franziskus/libcrux-c:latest
container:
image: ${{ needs.setup.outputs.image }}
defaults:
run:
working-directory: libcrux-ml-kem
Expand All @@ -105,7 +113,8 @@ jobs:
needs: [setup]
if: ${{ needs.setup.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
container: franziskus/libcrux-c:latest
container:
image: ${{ needs.setup.outputs.image }}
defaults:
run:
working-directory: libcrux-ml-dsa
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/docker-c-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish latest Docker C extraction container

on:
workflow_dispatch:
pull_request:
branches: ['main']
paths: ['.docker/c/**']
types:
- closed

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-c
SOURCE_TAG: unstable
TARGET_TAG: latest

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
setup:
# Only run if PR merged
if: ${{ github.event.pull_request.merged == true }}
runs-on: ubuntu-latest
steps:
- name: Setup tag names
run: echo "Setting up tag names..."
outputs:
source_image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.SOURCE_TAG }}
target_image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TARGET_TAG }}


publish:
needs: [setup]
runs-on: ubuntu-latest

# We need write access to packages
permissions:
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Retag and push Docker image
id: push
run: |
docker pull ${{ needs.setup.outputs.source_image }}
docker tag ${{ needs.setup.outputs.source_image }} ${{ needs.setup.outputs.target_image }}
docker push ${{ needs.setup.outputs.target_image }}
Loading