-
Notifications
You must be signed in to change notification settings - Fork 824
173 lines (147 loc) · 4.37 KB
/
test.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
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
166
167
168
169
170
171
172
173
name: Tests
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
env:
DOCKER_GEN_CONTAINER_NAME: nginx-proxy-gen
IMAGE: nginxproxy/acme-companion
NGINX_CONTAINER_NAME: nginx-proxy
TEST_DOMAINS: le1.wtf,le2.wtf,le3.wtf
jobs:
companion-build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Image
run: docker build -t "$IMAGE" .
- name: Inspect Image
run: docker inspect "$IMAGE"
- name: Get acme.sh Version
run: docker run --rm "$IMAGE" acme.sh --version
- name: List Docker Images
run: docker images
- name: Export Image Artifact
run: docker save $IMAGE > companion.tar
- name: Upload Image Artifact
uses: actions/upload-artifact@v3
with:
name: companion.tar
path: companion.tar
docker-specs-tests:
needs: companion-build
runs-on: ubuntu-latest
steps:
- name: Checkout Docker official images tests
uses: actions/checkout@v4
with:
repository: docker-library/official-images
path: official-images
- name: Download Builded Image
uses: actions/download-artifact@v3
with:
name: companion.tar
- name: Import Builded Image
run: docker load < companion.tar
- name: Docker Specifications Testing
run: official-images/test/run.sh "$IMAGE"
- name: Display containers logs
if: ${{ failure() }}
run: test/github_actions/containers-logs.sh
integration-tests:
needs:
- companion-build
strategy:
fail-fast: false
matrix:
test-name:
[
docker_api,
docker_api_legacy,
location_config,
certs_single,
certs_san,
certs_single_domain,
certs_standalone,
force_renew,
acme_accounts,
private_keys,
container_restart,
permissions_default,
permissions_custom,
symlinks,
acme_hooks,
]
setup: [2containers, 3containers]
acme-ca: [pebble]
pebble-config: [pebble-config.json]
include:
- test-name: acme_eab
setup: 2containers
acme-ca: pebble
pebble-config: pebble-config-eab.json
- test-name: acme_eab
setup: 3containers
acme-ca: pebble
pebble-config: pebble-config-eab.json
- test-name: ocsp_must_staple
setup: 2containers
acme-ca: boulder
- test-name: ocsp_must_staple
setup: 3containers
acme-ca: boulder
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
# PREPARE RUNNER ENV
- name: Add Test Domains in /etc/hosts
run: |
IFS=',' read -r -a test_domains <<< "$TEST_DOMAINS"
test_domains+=(pebble pebble-challtestsrv)
for domain in "${test_domains[@]}"
do
echo "127.0.0.1 $domain" | sudo tee -a /etc/hosts
done
- name: Setup Pebble
if: ${{ matrix.acme-ca == 'pebble' }}
env:
PEBBLE_CONFIG: ${{ matrix.pebble-config }}
run: test/setup/pebble/setup-pebble.sh
- name: Setup Boulder
if: ${{ matrix.acme-ca == 'boulder' }}
run: test/setup/setup-boulder.sh
- name: Setup nginx-proxy
env:
SETUP: ${{ matrix.setup }}
ACME_CA: ${{ matrix.acme-ca }}
run: test/setup/setup-nginx-proxy.sh
# ADD BUILT IMAGE
- name: Download Built Image
uses: actions/download-artifact@v3
with:
name: companion.tar
- name: Import Built Image
run: docker load < companion.tar
# TEST
- name: Integration Testing
env:
SETUP: ${{ matrix.setup }}
ACME_CA: ${{ matrix.acme-ca }}
PEBBLE_CONFIG: ${{ matrix.pebble-config }}
run: test/run.sh -t ${{ matrix.test-name }} "$IMAGE"
- name: Display containers logs
if: ${{ failure() }}
env:
SETUP: ${{ matrix.setup }}
ACME_CA: ${{ matrix.acme-ca }}
run: test/github_actions/containers-logs.sh