87 lines (84 loc) · 2.63 KB
/
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
name: CI
on:
push:
branches: [main]
paths-ignore:
- '.devcontainer/**'
- '.github/**'
- '!.github/workflows/ci.yml'
- '.vscode/**'
- 'examples/**'
- '**.md'
- .gitignore
- .release-it.json
pull_request:
branches: [main]
paths-ignore:
- '.devcontainer/**'
- '.github/**'
- '!.github/workflows/ci.yml'
- '.vscode/**'
- 'examples/**'
- '**.md'
- .gitignore
- .release-it.json
schedule:
- cron: '0 0 1 * *' # Every month
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm i
- name: Check formatting
run: npm run format:check
- name: Lint
run: npm run lint:check
- name: Run unit tests
run: npm test
e2e-test:
runs-on: ubuntu-latest
# Skip pull requests!
if: ${{ ! startsWith(github.event_name, 'pull_request') }}
needs:
- build
steps:
- name: Set up BrowserStack env
# Third-party action, pin to commit SHA!
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
uses: browserstack/github-actions/setup-env@00ce173eae311a7838f80682a5fad5144c4219ad
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
build-name: BUILD_INFO
project-name: REPO_NAME
- name: Set up BrowserStack local tunnel
# Third-party action, pin to commit SHA!
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
uses: browserstack/github-actions/setup-local@00ce173eae311a7838f80682a5fad5144c4219ad
with:
local-testing: start
local-identifier: random
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
check-latest: true
- name: Install dependencies
run: npm i
- name: Run BrowserStack E2E tests
run: grunt browserstack
- name: Stop BrowserStackLocal
# Third-party action, pin to commit SHA!
# See https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
uses: browserstack/github-actions/setup-local@00ce173eae311a7838f80682a5fad5144c4219ad
with:
local-testing: stop