-
Notifications
You must be signed in to change notification settings - Fork 9
121 lines (100 loc) · 3.7 KB
/
Copy pathtest.yml
File metadata and controls
121 lines (100 loc) · 3.7 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Test
on:
pull_request:
branches: [main]
jobs:
unit:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: gateway
- name: Run unit tests
run: npm test
working-directory: gateway
e2e:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: gateway
- name: Build Huddle image
run: docker build -t huddle ./gateway
- name: Start Huddle
# Het operator-token is per run random (alleen deze wegwerp-gateway kent
# het); via GITHUB_ENV is het beschikbaar voor de wait- en e2e-stappen.
run: |
HUDDLE_OPERATOR_TOKEN=$(openssl rand -hex 24)
echo "HUDDLE_OPERATOR_TOKEN=$HUDDLE_OPERATOR_TOKEN" >> "$GITHUB_ENV"
docker network create --internal devcontainer-net
mkdir -p /tmp/dc-sockets
docker run -d \
--name huddle \
--network devcontainer-net \
-p 3000:3000 \
-e HUDDLE_OPERATOR_TOKEN="$HUDDLE_OPERATOR_TOKEN" \
-v huddle-data:/data \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/dc-sockets:/tmp/dc-sockets \
huddle
docker network connect bridge huddle
- name: Wait for Huddle
run: |
for i in $(seq 1 20); do
curl -sf -H "Authorization: Bearer $HUDDLE_OPERATOR_TOKEN" http://localhost:3000/api/rules && break
sleep 2
done
- name: Login ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Controleer of base-devimage gewijzigd is
id: base-changed
run: |
git diff --name-only origin/main...HEAD | grep -q '^base-devimage/' \
&& echo "changed=true" >> $GITHUB_OUTPUT \
|| echo "changed=false" >> $GITHUB_OUTPUT
- name: Pull base-devimage (ongewijzigd)
if: steps.base-changed.outputs.changed == 'false'
run: docker pull ghcr.io/infosupport/base-devimage:latest
- name: Build base-devimage (gewijzigd)
if: steps.base-changed.outputs.changed == 'true'
run: docker build -t ghcr.io/infosupport/base-devimage:latest -f base-devimage/Dockerfile .
- name: Controleer of base-devimage-vscode gewijzigd is
id: vscode-changed
run: |
git diff --name-only origin/main...HEAD | grep -q '^base-devimage-vscode/' \
&& echo "changed=true" >> $GITHUB_OUTPUT \
|| echo "changed=false" >> $GITHUB_OUTPUT
- name: Pull base-devimage-vscode (ongewijzigd)
if: steps.vscode-changed.outputs.changed == 'false'
run: docker pull ghcr.io/infosupport/base-devimage-vscode:latest
- name: Build base-devimage-vscode (gewijzigd)
if: steps.vscode-changed.outputs.changed == 'true'
run: docker build -t ghcr.io/infosupport/base-devimage-vscode:latest -f base-devimage-vscode/Dockerfile .
- name: Run e2e tests
run: npm run test:e2e
working-directory: gateway
env:
HUDDLE_E2E: "1"
HUDDLE_OPERATOR_TOKEN: ${{ env.HUDDLE_OPERATOR_TOKEN }}