-
Notifications
You must be signed in to change notification settings - Fork 38
88 lines (74 loc) · 2.61 KB
/
publish-testbed.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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