-
Notifications
You must be signed in to change notification settings - Fork 46
100 lines (79 loc) · 2.28 KB
/
Copy pathci.yml
File metadata and controls
100 lines (79 loc) · 2.28 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm ci
- name: Type check
run: npm run type-check
- name: Lint
run: npm run lint
- name: Format check
run: npm run fmt:check
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
node-version: 22
- os: ubuntu-latest
node-version: 20
- os: windows-latest
node-version: 22
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- name: Build
run: npm run build
- name: Unit tests with coverage
run: npm run test:coverage
- name: E2E tests
run: npm run test:e2e
- name: Install bats and helpers
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq bats
mkdir -p tests/bash/test_helper
git clone --depth 1 https://github.com/bats-core/bats-support tests/bash/test_helper/bats-support
git clone --depth 1 https://github.com/bats-core/bats-assert tests/bash/test_helper/bats-assert
- name: Bash tests
if: matrix.os == 'ubuntu-latest'
run: npm run test:bash
- name: Upload coverage to Codecov
if: matrix.node-version == 22 && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v5
with:
files: ./coverage/lcov.info
fail_ci_if_error: false
- name: Validate npm package
run: npm pack --dry-run
ci-success:
name: ci
if: always()
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- run: |
if [[ "${{ needs.lint.result }}" != "success" || "${{ needs.test.result }}" != "success" ]]; then
echo "CI failed: lint=${{ needs.lint.result }}, test=${{ needs.test.result }}"
exit 1
fi