Python3.12 #305
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish docker testbed | |
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/tests/scripts/run_testbed_server.py | |
- server/packaging/testbed-server/** | |
- .github/workflows/publish-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/tests/scripts/run_testbed_server.py | |
- server/packaging/testbed-server/** | |
- .github/workflows/publish-testbed.yml | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
publish-testbed: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin v4.1.1 | |
timeout-minutes: 5 | |
- name: Log in to the Container registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build docker image | |
run: bash server/packaging/testbed-server/build.sh 2>&1 | |
env: | |
WRITE_ENV: 1 | |
timeout-minutes: 20 | |
- name: Test docker image | |
run: | | |
set -ex | |
source parsec-testbed.env | |
docker run --publish 6777:6777 --rm --name=parsec-testbed-server $PREFIX/parsec-testbed-server:$UNIQ_TAG & | |
python -c " | |
import time | |
from urllib.request import Request, urlopen | |
r = Request('http://127.0.0.1:6777/testbed/new/empty', method='POST') | |
for i in range(10): | |
try: | |
urlopen(r) | |
except Exception as exc: | |
print(f'Try {i + 1}/10: {exc}') | |
time.sleep(1) | |
continue | |
else: | |
break | |
else: | |
raise SystemExit('Cannot connect to testbed server :(') | |
" | |
kill %1 | |
- name: Publish docker image | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
set -ex | |
source parsec-testbed.env | |
for tag in $UNIQ_TAG; do | |
echo "Pushing tag \`$tag\` to \`$PREFIX\`" | |
docker push $PREFIX/parsec-testbed-server:$tag | |
done | |
timeout-minutes: 5 |