-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (71 loc) · 1.85 KB
/
Copy pathtest-workflow.yml
File metadata and controls
75 lines (71 loc) · 1.85 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
name: test
on:
push:
branches:
- main
pull_request:
paths:
- '**.js'
- '**.mjs'
- '**.ts'
- 'src/**.js'
- 'src/**.mjs'
- 'src/**.ts'
- 'src/**/**.js'
- 'src/**/**.mjs'
- 'src/**/**.ts'
- 'patches/**.patch'
- '.github/**'
workflow_dispatch:
jobs:
run_test:
# Running only on self hosted runner which has tag "tests"
runs-on: [self-hosted, tests]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
environment: test
steps:
- uses: actions/checkout@v4
- name: Set up Docker Compose
uses: docker/setup-compose-action@v1
- name: Set up Docker
run: docker compose -f ./docker-compose.yml up -d
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- id: install
name: Install npm dependencies
run: npm ci --no-audit --silent
- id: build
name: Build
run: npm run build
- id: lint
name: Run lint
run: npm run lint
- id: unit_tests
name: Run unit tests
run: npm test
env:
CI: true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
APP_ID: ${{ secrets.APP_ID }}
- id: e2e_tests
name: Run e2e tests
run: npm run test:e2e
env:
CI: true
CLIENT_ID: ${{ secrets.CLIENT_ID }}
APP_ID: ${{ secrets.APP_ID }}
- name: Post Set up Docker
if: always()
run: |
docker compose -f ./docker-compose.yml down -v
docker volume prune -a -f
containers=$(docker ps -aq)
if [ -n "$containers" ]; then
docker rm -f $containers
else
echo "No containers to remove."
fi