Repository navigation
144 lines (121 loc) · 3.96 KB
/
Copy pathci.yml
File metadata and controls
144 lines (121 loc) · 3.96 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on:
push:
branches:
- develop
- 'feature/**'
pull_request:
branches:
- develop
- 'feature/**'
workflow_call:
inputs:
full:
description: 'Run full OS x Node matrix'
required: false
type: boolean
default: false
jobs:
# Real-browser checks, not an OS x Node matrix. Release also waits for this reusable CI job.
browser-match-patterns:
name: Browser API integration and context messaging smoke
# Keep Chromium's sandbox enabled; Ubuntu 23.10+ restricts user namespaces for downloaded binaries.
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Use Node.js
uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Check generated sources
run: npm run generate:check
- name: Build
run: npm run build
- name: Install Chrome for Testing
id: chrome
uses: browser-actions/setup-chrome@2e1d749697dd1612b833dba4a722266286fbefcd # v2.1.2
with:
chrome-version: stable
install-dependencies: true
- name: Run browser API and context messaging smoke
env:
CHROME_FOR_TESTING_PATH: ${{ steps.chrome.outputs.chrome-path }}
run: npm run test:browser-match-patterns -- "$CHROME_FOR_TESTING_PATH"
- name: Run production API integration tests in Chromium
env:
CHROME_FOR_TESTING_PATH: ${{ steps.chrome.outputs.chrome-path }}
run: npm run test:browser -- --browser chromium
- name: Install Firefox
id: firefox
uses: browser-actions/setup-firefox@2ddc1281882c66dd6a359947714eed0a4b91afc1 # v1
with:
firefox-version: latest
- name: Run production API integration tests in Firefox
env:
FIREFOX_PATH: ${{ steps.firefox.outputs.firefox-path }}
run: npm run test:browser -- --browser firefox
compute-matrix:
name: Compute matrix
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.set.outputs.matrix }}
name_suffix: ${{ steps.set.outputs.name_suffix }}
steps:
- id: set
run: |
if [[ "${{ inputs.full }}" == "true" || "${{ github.ref }}" == "refs/heads/develop" ]]; then
echo 'matrix={"os":["ubuntu-24.04","windows-latest"],"node":[22,24]}' >> "$GITHUB_OUTPUT"
echo 'name_suffix=(full matrix)' >> "$GITHUB_OUTPUT"
else
echo 'matrix={"os":["ubuntu-24.04"],"node":[24]}' >> "$GITHUB_OUTPUT"
echo 'name_suffix=' >> "$GITHUB_OUTPUT"
fi
build-and-test:
name: Build, Lint, Test ${{ needs.compute-matrix.outputs.name_suffix }}
needs: compute-matrix
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.compute-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Configure git EOL (Windows)
if: runner.os == 'Windows'
run: |
git config core.autocrlf false
git config core.eol lf
- name: Use Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Check generated sources
run: npm run generate:check
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm run test:ci
- name: Build
run: npm run build
- name: Consumer typecheck
run: npm run test:consumer-types
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.os }}-node${{ matrix.node }}
path: coverage