generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
115 lines (88 loc) · 3.4 KB
/
tests-ci.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
113
114
115
name: Continuous Integration
on:
push:
branches:
- main
pull_request:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
security-audit:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 18
- name: Report known vulnerabilities
run: npm audit
test-with-node:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install latest npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Build all workspace packages
run: npm run build
- name: Run linter for all packages
run: npm run lint --ws
- name: Start dwn-server container
run: cd packages/dev-env && docker-compose up -d
- name: Wait for dwn-server to be ready
run: until curl -sf http://localhost:3000/health; do echo -n .; sleep .1; done
- name: Run tests for all packages
run: npm run test:node --ws -- --color
env:
TEST_DWN_URL: http://localhost:3000
- name: Upload test coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-with-browsers:
# Run browser tests using macOS so that WebKit tests don't fail under a Linux environment
runs-on: macos-latest
steps:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install latest npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Build all workspace packages
run: npm run build
- name: Install docker
run: brew install docker && brew install docker-compose # && colima start
- name: Update qemu to work around https://github.com/actions/runner-images/issues/8104
run: |
brew remove --ignore-dependencies qemu &&
curl -o ./qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/dc0669eca9479e9eeb495397ba3a7480aaa45c2e/Formula/qemu.rb &&
brew install ./qemu.rb
- name: Start docker
run: colima start
- name: Start dwn-server container
run: cd packages/dev-env && docker-compose up -d
- name: Wait for dwn-server to be ready
run: until curl -sf http://localhost:3000/health; do echo -n .; sleep .1; done
- name: Run tests for all packages
run: npm run test:browser --ws -- --color
env:
TEST_DWN_URL: http://localhost:3000