-
-
Notifications
You must be signed in to change notification settings - Fork 70
99 lines (89 loc) · 2.96 KB
/
test.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
name: test
on:
push:
branches:
- 'main'
pull_request:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Test node 18/20/22 on ubuntu
# Test node 22 on macos/windows
# Enable annotations only for node 22 + ubuntu
matrix:
os: [ubuntu-latest]
node: [18, 20, 22]
include:
- os: macos-latest
node: 22
- os: windows-latest
node: 22
- os: ubuntu-latest
is_base_os_version: true
- node: 22
is_base_node_version: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: npm ci
run: |
npm ci
if: ${{ (matrix.is_base_node_version && matrix.is_base_os_version) }}
- name: npm ci
run: |
NPM_CONFIG_ENGINE_STRICT=false npm ci --ignore-scripts
if: ${{ !(matrix.is_base_node_version && matrix.is_base_os_version) }}
- name: determine modified workspaces
run: |
echo "MODIFIED_WORKSPACES=$(node './.github/bin/modified-workspaces/log-modified-workspaces.mjs')" >> $GITHUB_ENV
env:
GITHUB_ACTION_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build and PostCSS Tape tests must all work and pass :
# - with exact dependencies from package-lock.json
# - without requiring postinstall scripts from dependencies to run
- name: build
run: |
npm run build --if-present $MODIFIED_WORKSPACES
if: matrix.is_base_node_version && matrix.is_base_os_version
env:
NODE_COMPILE_CACHE: '.cache/v8'
- name: repo is clean after "build", "lint" and "docs" steps
run: |
git diff --name-only --exit-code
# Basic tests
- name: test
run: npm run test --if-present $MODIFIED_WORKSPACES
env:
BROWSER_TESTS: ${{ (matrix.is_base_node_version && matrix.is_base_os_version) }}
ENABLE_ANNOTATIONS_FOR_NODE: ${{ matrix.is_base_node_version }}
ENABLE_ANNOTATIONS_FOR_OS: ${{ matrix.is_base_os_version }}
# CLI Tests
# running "npm install" places the cli in node_modules/bin
- name: test:cli
run: |
NPM_CONFIG_ENGINE_STRICT=false npm ci --ignore-scripts
npm run test:cli --if-present $MODIFIED_WORKSPACES
# E2E Tests
- name: test:e2e
run: |
cd e2e
npm install
npm run build
npm run test
if: matrix.is_base_node_version && matrix.is_base_os_version
# E2E Package Managers Tests
- name: test:e2e-package-managers
run: |
cd e2e-package-managers/yarn && bash test.sh
if: matrix.is_base_node_version && matrix.is_base_os_version