-
Notifications
You must be signed in to change notification settings - Fork 7
108 lines (108 loc) · 3.74 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
name: Test & Deploy Docs
on: [push, pull_request]
permissions:
contents: read
pages: write
id-token: write
deployments: write
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
- name: Run lint
run: npm run lint
- name: Run prettier
run: npm run prettier.check
- name: Run tests
run: npm run test.unit
build:
runs-on: ubuntu-20.04
needs: test
steps:
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Cache build outputs
id: build-output
uses: actions/cache@v3
with:
path: build/docs
key: build-output-${{ github.run_id }}
- name: Build all
run: npm run build
###
### Run clean-tree following the build - no changes should be present
###
- name: Clean tree (build)
run: npm run test.clean-tree
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright (integration) tests
run: npm run test.int
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Build docs
run: npm run docs
- name: copy-to-docs
run: cp -r build/app/ build/docs/app
deploy:
runs-on: ubuntu-20.04
needs: build
if: ${{ github.ref == 'refs/heads/main' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js from .nvmrc
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Cache build outputs
id: build-output
uses: actions/cache@v3
with:
path: build/docs
key: build-output-${{ github.run_id }}
- name: Setup Github Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: build/docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2