-
Notifications
You must be signed in to change notification settings - Fork 145
138 lines (124 loc) · 4.33 KB
/
Copy pathtests-integration.yaml
File metadata and controls
138 lines (124 loc) · 4.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
on:
workflow_call:
secrets:
stripeTestPublicKey:
required: true
stripeTestSecretKey:
required: true
inputs:
registry:
default: ghcr.io
type: string
imageName:
default: ${{ github.repository_owner }}
type: string
imageTag:
required: true
type: string
configureEnv:
default: ''
type: string
jobs:
integration:
runs-on: ubuntu-22.04
name: integration (${{ matrix.shardIndex }})
strategy:
fail-fast: false
matrix:
include:
- shardIndex: 1
memoryLeakTest: '0'
- shardIndex: 2
memoryLeakTest: '0'
- shardIndex: 3
memoryLeakTest: '0'
- shardIndex: 'memory leaks'
memoryLeakTest: '1'
env:
DOCKER_REGISTRY: ${{ inputs.registry }}/${{ inputs.imageName }}/
DOCKER_TAG: :${{ inputs.imageTag }}
steps:
- name: checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
with:
fetch-depth: 2
- name: configure env vars
if: ${{ inputs.configureEnv != '' }}
env:
CONFIGURE_ENV: ${{ inputs.configureEnv }}
run: $CONFIGURE_ENV
- name: configure Docker Node.js image tag
id: node-version-tag
if: ${{ inputs.dockerize }}
run: echo "value=:$(< .node-version)-slim" >> "$GITHUB_OUTPUT"
- name: setup environment
uses: ./.github/actions/setup
with:
actor: test-integration
- name: prepare packages
run: pnpm --filter integration-tests prepare:env
- name: patch compose file volumes
uses: mikefarah/yq@4839dbbf80445070a31c7a9c1055da527db2d5ee # v4.44.6
with:
cmd: yq -i 'del(.services.*.volumes)' docker/docker-compose.community.yml
# tests need to access host machine for OIDC stuff
- name: make host machine accessible to server container
uses: mikefarah/yq@4839dbbf80445070a31c7a9c1055da527db2d5ee # v4.44.6
with:
cmd:
yq -i '.services.server.extra_hosts[] |= sub("host-gateway"; "172.17.0.1")'
./integration-tests/docker-compose.integration.yaml
- name: get cpu count for vitest
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@97ba232459a8e02ff6121db9362b09661c875ab8 # v2
- name: run containers
timeout-minutes: 8
env:
NODE_VERSION_TAG: ${{ steps.node-version-tag.outputs.value }}
run: |
docker compose \
-f docker/docker-compose.community.yml \
-f ./integration-tests/docker-compose.integration.yaml \
--env-file ./integration-tests/.env \
up -d --wait --no-build
- name: troubleshoot containers
if: ${{ failure() }}
env:
NODE_VERSION_TAG: ${{ steps.node-version-tag.outputs.value }}
run: |
docker compose \
-f docker/docker-compose.community.yml \
-f ./integration-tests/docker-compose.integration.yaml \
--env-file ./integration-tests/.env \
ps
- name: run integration tests
timeout-minutes: 30
if: ${{ matrix.memoryLeakTest == '0' }}
run: |
pnpm test:integration --shard=${{ matrix.shardIndex }}/3
env:
VITEST_MAX_THREADS: ${{ steps.cpu-cores.outputs.count }}
- name: run mem leaks integration tests
timeout-minutes: 30
if: ${{ matrix.memoryLeakTest == '1' }}
run: |
pnpm test:integration
env:
VITEST_MAX_THREADS: 1
RUN_MEMORY_LEAKS_TESTS: '1'
- name: log dump
if: ${{ failure() }}
env:
NODE_VERSION_TAG: ${{ steps.node-version-tag.outputs.value }}
run: |
docker compose \
-f docker/docker-compose.community.yml \
-f ./integration-tests/docker-compose.integration.yaml \
--env-file ./integration-tests/.env \
logs
- name: inspect health
if: ${{ failure() }}
env:
NODE_VERSION_TAG: ${{ steps.node-version-tag.outputs.value }}
run: |
docker inspect $(docker compose -f ./docker/docker-compose.community.yml -f ./integration-tests/docker-compose.integration.yaml --env-file ./integration-tests/.env ps -aq) | jq