forked from civiform/civiform
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (158 loc) · 5.82 KB
/
tests.yaml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: tests
on:
workflow_call:
# Setting this enables manually triggering workflow in the GitHub UI
# see https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch: {}
permissions: read-all
jobs:
run_junit_tests:
runs-on: ubuntu-latest
steps:
- name: check out ${{ env.GITHUB_REF }}
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build test container
env:
DOCKER_BUILDKIT: 1
run: docker build -t civiform-dev --cache-from docker.io/civiform/civiform-dev:latest ./
- name: Build dev-oidc
env:
DOCKER_BUILDKIT: 1
run: bin/build-dev-oidc
- name: Run tests
run: bin/run-test-ci
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: server/code-coverage/report/jacoco.xml
verbose: true
fail_ci_if_error: true
run_browser_tests_aws:
strategy:
fail-fast: false
matrix:
batch_number: [1, 2, 3, 4]
runs-on: ubuntu-latest
steps:
- name: check out ${{ env.GITHUB_REF }}
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build test app container
env:
DOCKER_BUILDKIT: 1
run: docker build -t civiform-dev --cache-from docker.io/civiform/civiform-dev:latest ./
- name: Build browser testing container
env:
DOCKER_BUILDKIT: 1
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
run: bin/build-browser-tests
- name: Build dev-oidc
env:
DOCKER_BUILDKIT: 1
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
run: bin/build-dev-oidc
- name: Build localstack
env:
DOCKER_BUILDKIT: 1
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
run: bin/build-localstack-env
- name: Bring up test env with Localstack
run: bin/run-browser-test-env --aws --ci
- name: Run browser tests with Localstack
run: bin/run-browser-tests-ci-batch ${{ matrix.batch_number }}
- name: Verify no new image snapshots added
# jest-image-snapshots automatically adds snapshot if it's missing.
# Use git diff to fail if we detect new images.
run: git add browser-test/image_snapshots ; git diff --compact-summary --exit-code HEAD
- name: Upload image diff outputs
uses: actions/upload-artifact@v3
with:
name: image diff output directory
path: browser-test/diff_output
if: failure()
- name: Upload test videos on failure
uses: actions/upload-artifact@v3
with:
name: tests videos
path: browser-test/tmp
if: failure()
- name: Print logs on failure
if: failure()
run: cat .dockerlogs
run_browser_tests_azure:
strategy:
fail-fast: false
matrix:
batch_number: [1, 2, 3, 4]
runs-on: ubuntu-latest
steps:
- name: check out ${{ env.GITHUB_REF }}
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build test app container
env:
DOCKER_BUILDKIT: 1
run: docker build -t civiform-dev --cache-from docker.io/civiform/civiform-dev:latest ./
- name: Build browser testing container
env:
DOCKER_BUILDKIT: 1
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
run: bin/build-browser-tests
- name: Build dev-oidc
env:
DOCKER_BUILDKIT: 1
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
run: bin/build-dev-oidc
- name: Build localstack
env:
DOCKER_BUILDKIT: 1
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
run: bin/build-localstack-env
- name: Bring up test env with Azurite
run: bin/run-browser-test-env --azure --ci
- name: Run browser tests with Azurite
run: bin/run-browser-tests-ci-batch ${{ matrix.batch_number }}
- name: Upload image diff outputs
uses: actions/upload-artifact@v3
with:
name: image diff output directory
path: browser-test/diff_output
if: failure()
- name: Upload test videos on failure
uses: actions/upload-artifact@v3
with:
name: tests videos
path: browser-test/tmp
if: failure()
- name: Print logs on failure
if: failure()
run: cat .dockerlogs
test_prod:
runs-on: ubuntu-latest
steps:
- name: check out ${{ env.GITHUB_REF }}
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build prod container
env:
DOCKER_BUILDKIT: 1
run: docker build -f prod.Dockerfile -t civiform:prod --cache-from docker.io/civiform/civiform:latest ./
- name: Build the stack
env:
SECRET_KEY: notarealsecret
run: docker compose -f test-support/prod-simulator-compose.yml up -d
- name: Test
# Confirm that we get a response on port 9000.
run: while ! docker run --network host appropriate/curl -v -s --retry-max-time 180 --retry-connrefused http://localhost:9000/ ; do sleep 5; done
timeout-minutes: 3