-
-
Notifications
You must be signed in to change notification settings - Fork 28
241 lines (202 loc) Β· 9.33 KB
/
vortex-test-common.yml
File metadata and controls
241 lines (202 loc) Β· 9.33 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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# This action is used for Vortex maintenance. It will not be used in the scaffolded project.
name: Vortex - Test
on:
push:
branches:
- main
- release/**
- project/**
pull_request:
branches:
- main
- feature/**
- bugfix/**
- release/**
- project/**
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
vortex-test-common:
runs-on: ubuntu-latest
container:
image: drevops/ci-runner:26.1.0@sha256:1fd1a2bc6311ae1c8b726fa2326dc509f6c8918b7d394bceb10d3aada1c7afcb
env:
# Prevent GitHub overriding the Docker config.
DOCKER_CONFIG: /root/.docker
VORTEX_DOCTOR_CHECK_MINIMAL: 1
TEST_PACKAGE_TOKEN: ${{ secrets.TEST_PACKAGE_TOKEN }}
TEST_VORTEX_CONTAINER_REGISTRY_USER: ${{ secrets.TEST_VORTEX_CONTAINER_REGISTRY_USER }}
TEST_VORTEX_CONTAINER_REGISTRY_PASS: ${{ secrets.TEST_VORTEX_CONTAINER_REGISTRY_PASS }}
VORTEX_DEV_VOLUMES_SKIP_MOUNT: 1
VORTEX_DEV_TEST_COVERAGE_DIR: /tmp/.vortex-coverage-html
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Adjust git config to allow running git-related tests
run: git config --global safe.directory '*'
- name: Process codebase to run in CI
run: find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}"
- name: Login to container registry
run: ./scripts/vortex/login-container-registry.sh
env:
VORTEX_CONTAINER_REGISTRY_USER: ${{ secrets.VORTEX_CONTAINER_REGISTRY_USER }}
VORTEX_CONTAINER_REGISTRY_PASS: ${{ secrets.VORTEX_CONTAINER_REGISTRY_PASS }}
- name: Generate test SSH key pair used for deployment tests
run: |
mkdir -p "$HOME/.ssh"
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f "$HOME/.ssh/id_rsa"
chmod 600 "$HOME/.ssh/id_rsa"
ssh-agent -a "${HOME}/ssh-agent.sock" > ssh-agent-output
export SSH_AUTH_SOCK=$(grep SSH_AUTH_SOCK ssh-agent-output | cut -d';' -f1 | cut -d= -f2)
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> "$GITHUB_ENV"
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: 22.17.1
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: .vortex/tests
- name: Lint code
run: |
./tests/lint.scripts.sh
./tests/lint.dockerfiles.sh
./tests/lint.markdown.sh
working-directory: .vortex
# Special case to validate Renovate configuration with the same action
# as used in the Renovate workflow to ensure that they both use the same
# version.
- name: Validate Renovate configuration
uses: suzuki-shunsuke/github-action-renovate-config-validator@ca480cb7ec89a9e1cd8c214ad33bda1617184027 # v2.0.0
- name: Install Ahoy
run: |
version=2.4.0 && \
set -x && curl -L -o "/usr/local/bin/ahoy" "https://github.com/ahoy-cli/ahoy/releases/download/v${version}/ahoy-bin-$(uname -s)-amd64" && \
chmod +x /usr/local/bin/ahoy && \
ahoy --version
- name: Run tests
run: ./tests/test.common.sh
working-directory: .vortex
env:
TEST_VORTEX_DEBUG: ${{ vars.TEST_VORTEX_DEBUG }}
- name: Upload coverage report as an artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: ${{github.job}}-code-coverage-report
path: /tmp/.vortex-coverage-html
include-hidden-files: true
if-no-files-found: error
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
with:
directory: /tmp/.vortex-coverage-html
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
vortex-test-workflow:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
batch: [0, 1, 2, 3, 4]
container:
image: drevops/ci-runner:26.1.0@sha256:1fd1a2bc6311ae1c8b726fa2326dc509f6c8918b7d394bceb10d3aada1c7afcb
env:
# Prevent GitHub overriding the Docker config.
DOCKER_CONFIG: /root/.docker
VORTEX_DOCTOR_CHECK_MINIMAL: 1
TEST_PACKAGE_TOKEN: ${{ secrets.TEST_PACKAGE_TOKEN }}
TEST_VORTEX_CONTAINER_REGISTRY_USER: ${{ secrets.TEST_VORTEX_CONTAINER_REGISTRY_USER }}
TEST_VORTEX_CONTAINER_REGISTRY_PASS: ${{ secrets.TEST_VORTEX_CONTAINER_REGISTRY_PASS }}
VORTEX_DEV_VOLUMES_SKIP_MOUNT: 1
VORTEX_DEV_TEST_COVERAGE_DIR: /tmp/.vortex-coverage-html
TEST_NODE_INDEX: ${{ matrix.batch }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Adjust git config to allow running git-related tests
run: git config --global safe.directory '*'
- name: Generate test SSH key pair used for deployment tests
run: |
mkdir -p "$HOME/.ssh"
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f "$HOME/.ssh/id_rsa"
chmod 600 "$HOME/.ssh/id_rsa"
ssh-agent -a "${HOME}/ssh-agent.sock" > ssh-agent-output
export SSH_AUTH_SOCK=$(grep SSH_AUTH_SOCK ssh-agent-output | cut -d';' -f1 | cut -d= -f2)
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> "$GITHUB_ENV"
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: 22.17.1
- name: Install dependencies
run: composer install
working-directory: .vortex/tests
- name: Lint code
run: |
php -d memory_limit=-1 ./vendor/bin/phpcs
php -d memory_limit=-1 ./vendor/bin/phpstan
php -d memory_limit=-1 ./vendor/bin/rector --dry-run
working-directory: .vortex/tests
- name: Install Ahoy
run: |
version=2.4.0 && \
set -x && curl -L -o "/usr/local/bin/ahoy" "https://github.com/ahoy-cli/ahoy/releases/download/v${version}/ahoy-bin-$(uname -s)-amd64" && \
chmod +x /usr/local/bin/ahoy && \
ahoy --version
- name: Run tests
run: |
# Create an empty coverage directory to avoid errors. @see https://github.com/actions/upload-artifact/issues/255
mkdir -p /tmp/.vortex-coverage-html && touch "/tmp/.vortex-coverage-html/.empty-$(date +%Y%m%d%H%M%S)"
# Configure git username and email if it is not set.
[ "$(git config --global user.name)" = "" ] && echo "==> Configuring global test git user name" && git config --global user.name "Test user"
[ "$(git config --global user.email)" = "" ] && echo "==> Configuring global test git user email" && git config --global user.email "someone@example.com"
# Create stub of local network.
docker network create amazeeio-network 2>/dev/null || true
php -d memory_limit=-1 vendor/bin/phpunit --group="p${TEST_NODE_INDEX:-*}"
working-directory: .vortex/tests
env:
TEST_VORTEX_DEBUG: ${{ vars.TEST_VORTEX_DEBUG }}
- name: Upload test artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
if: always()
with:
name: ${{github.job}}-${{ matrix.batch }}-test-artifacts
path: .vortex/tests/.logs
include-hidden-files: true
if-no-files-found: ignore
- name: Upload coverage report as an artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: ${{github.job}}-${{ matrix.batch }}-code-coverage-report
path: /tmp/.vortex-coverage-html
include-hidden-files: true
if-no-files-found: error
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
with:
directory: /tmp/.vortex-coverage-html
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
vortex-test-actions:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Login to container registry
run: ./scripts/vortex/login-container-registry.sh
env:
VORTEX_CONTAINER_REGISTRY_USER: ${{ secrets.VORTEX_CONTAINER_REGISTRY_USER }}
VORTEX_CONTAINER_REGISTRY_PASS: ${{ secrets.VORTEX_CONTAINER_REGISTRY_PASS }}
- name: Check coding standards with yamllint
run: yamllint --config-file .vortex/tests/.yamllint-for-gha.yml .github/workflows
continue-on-error: ${{ vars.VORTEX_CI_YAMLLINT_IGNORE_FAILURE == '1' }}
- name: Check coding standards with actionlint
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.7.2 -ignore 'SC2002:' -ignore 'SC2155:' -ignore 'SC2015:' -ignore 'SC2046:' -ignore 'SC1090:'
continue-on-error: ${{ vars.VORTEX_CI_ACTIONLINT_IGNORE_FAILURE == '1' }}