-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(ci): run unit tests on all active node versions (#12513)
- Loading branch information
1 parent
83d0c96
commit bdff2b7
Showing
4 changed files
with
93 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: unit | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: # run on all PRs, not just PRs to a particular branch | ||
|
||
jobs: | ||
# `unit` includes just unit and proto tests. | ||
unit: | ||
strategy: | ||
matrix: | ||
node: ['12', '14', '16'] | ||
runs-on: ubuntu-latest | ||
name: node ${{ matrix.node }} | ||
env: | ||
LATEST_NODE: '16' | ||
|
||
steps: | ||
- name: git clone | ||
uses: actions/checkout@v2 | ||
with: | ||
# Depth of at least 2 for codecov coverage diffs. See https://github.com/GoogleChrome/lighthouse/pull/12079 | ||
fetch-depth: 2 | ||
|
||
- name: Use Node.js ${{ matrix.node }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Set up protoc | ||
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 | ||
with: | ||
version: '3.7.1' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 2.7 | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install protobuf==3.7.1 | ||
- run: yarn install --frozen-lockfile --network-timeout 1000000 | ||
|
||
- run: yarn test-proto # Run before unit-core because the roundtrip json is needed for proto tests. | ||
|
||
- run: sudo apt-get install xvfb | ||
|
||
- name: yarn unit | ||
if: ${{ matrix.node != env.LATEST_NODE }} | ||
run: xvfb-run --auto-servernum yarn unit:ci | ||
|
||
# Only gather coverage on latest node, where c8 is the most accurate. | ||
- name: yarn unit:coverage | ||
if: ${{ matrix.node == env.LATEST_NODE }} | ||
run: | | ||
xvfb-run --auto-servernum yarn unit:cicoverage | ||
yarn c8 report --reporter text-lcov > unit-coverage.lcov | ||
- name: Upload test coverage to Codecov | ||
if: ${{ matrix.node == env.LATEST_NODE }} | ||
uses: codecov/codecov-action@6004246f47ab62d32be025ce173b241cd84ac58e | ||
with: | ||
flags: unit | ||
file: ./unit-coverage.lcov | ||
|
||
# For windows, just test the potentially platform-specific code. | ||
unit-windows: | ||
runs-on: windows-latest | ||
name: Windows | ||
|
||
steps: | ||
- name: git clone | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 12.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- run: yarn install --frozen-lockfile --network-timeout 1000000 | ||
|
||
- name: yarn unit-cli | ||
run: yarn unit-cli | ||
- run: yarn diff:sample-json | ||
|
||
# Fail if any changes were written to any source files or generated untracked files (ex, from -GA). | ||
- run: git add -A && git diff --cached --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters