-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (110 loc) · 3.48 KB
/
tests.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
name: Tests and code quality
on:
push:
branches:
- main
- "renovate/**"
pull_request:
branches:
- main
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: same_content
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
skip_after_successful_duplicate: true
components:
name: Components tests and code coverage
runs-on: ubuntu-latest
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
env:
GHP_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Get Node version from Dockerfile
id: get-node-version
run: echo "node_version=$(grep -oP 'FROM .* node:\K[\d.]+' Dockerfile)" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v3
with:
node-version: ${{ steps.get-node-version.outputs.node_version }}
cache: yarn
- run: yarn install
- name: Lint code
run: yarn lint
- name: Run components tests 🧪
uses: cypress-io/github-action@v4
with:
command: yarn test:component:ci
- name: Upload coverage to Codecov ☂️
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
- name: Upload Cypress screenshots and videos 🖥️📽️
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-results-components
path: |
test/cypress/screenshots
test/cypress/videos
e2e:
name: End-to-end tests
runs-on: ubuntu-latest
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
env:
GHP_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Start services
run: docker compose --project-directory integration up -d
- name: Get Node version from Dockerfile
id: get-node-version
run: echo "node_version=$(grep -oP 'FROM .* node:\K[\d.]+' Dockerfile)" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v3
with:
node-version: ${{ steps.get-node-version.outputs.node_version }}
cache: yarn
- name: Run end-to-end tests 🧪
uses: cypress-io/github-action@v4
env:
CENTRIFUGO_HOST: localhost
with:
command: yarn test:e2e:ci
- name: Upload Cypress screenshots and videos 🖥️📽️
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-results-e2e
path: |
test/cypress/screenshots
test/cypress/videos
- name: Stop services
if: always()
run: docker compose --project-directory integration down -v
docker:
name: Check Docker build
runs-on: ubuntu-latest
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
steps:
- uses: actions/checkout@v3
- name: Lint Dockerfile
uses: hadolint/[email protected]
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build local image
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha,mode=max
secrets: GHP_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}