Skip to content

Bump the github-actions group across 2 directories with 7 updates #293

Bump the github-actions group across 2 directories with 7 updates

Bump the github-actions group across 2 directories with 7 updates #293

name: Build & Publish docker testbed
# cspell:words buildx
on:
# This job must be manually triggered to publish a new version usable from
# other CI runs.
# (see https://github.com/Scille/parsec-cloud/pkgs/container/parsec-cloud%2Fparsec-testbed-server)
workflow_dispatch:
pull_request:
paths:
# Testbed code also depends on `libparsec/**`, but this code change very often
# and we consider the server tests are good enough on this part.
- server/packaging/testbed-server/**
- .github/workflows/docker-testbed.yml
push:
branches:
- master
paths:
# Testbed code also depends on `libparsec/**`, but this code change very often
# and we consider the server tests are good enough on this part.
- server/packaging/testbed-server/**
- .github/workflows/docker-testbed.yml
permissions:
contents: write
packages: write
# We set `concurrency` to prevent having this workflow being run on code that is not up-to-date on a PR (a user make multiple push in a quick manner).
# But on the main branch, we don't want that behavior.
# Having the workflow run on each merge commit is something we would like, that could help us where a regression was made and missed by previous checks.
concurrency:
group: docker-testbed-${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
docker-testbed:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin v4.2.1
timeout-minutes: 5
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Log in to the Github Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install python
uses: actions/setup-python@19dfb7b659fa9e60c2f89c33335ab5f6f1792b6e # pin v5.2.0
id: setup-python
with:
python-version: 3.12
- name: Get current version
id: version
shell: bash
run: python misc/releaser.py version --uniq-dev | tee -a $GITHUB_OUTPUT
timeout-minutes: 1
- name: Generate build metadata
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
id: metadata
with:
images:
ghcr.io/scille/parsec-cloud/parsec-testbed-server
tags: |
type=raw,value=${{ steps.version.outputs.docker }}
flavor: |
latest=${{ github.event_name == 'workflow_dispatch' }}
- name: Build and export to Docker
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
id: build
with:
context: .
file: server/packaging/testbed-server/testbed-server.dockerfile
load: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
push: false
timeout-minutes: 20
- name: Start docker test container
id: test-container
shell: bash
run: |
(
echo -n "id=";
docker run --detach --publish 6777:6777 --rm --name=parsec-testbed-server ${{ steps.build.outputs.imageid }}
) | tee $GITHUB_OUTPUT
timeout-minutes: 1
- name: Test docker image
run: python .github/scripts/test-server.py
timeout-minutes: 1
- name: Stop docker test container
run: docker container stop ${{ steps.test-container.outputs.id }}
timeout-minutes: 1
- name: Image to be published
run: echo "${{ steps.metadata.outputs.tags }}"
- name: Build and publish
if: github.event_name == 'workflow_dispatch'
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
context: .
file: server/packaging/testbed-server/testbed-server.dockerfile
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
push: true
timeout-minutes: 5