-
Notifications
You must be signed in to change notification settings - Fork 814
98 lines (82 loc) · 3.02 KB
/
coverage.yml
File metadata and controls
98 lines (82 loc) · 3.02 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
name: PR Diff Coverage
on:
pull_request:
branches: [main]
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true
jobs:
detect-changes:
name: Detect changed packages
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
cli: ${{ steps.filter.outputs.cli }}
web: ${{ steps.filter.outputs.web }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core:
- 'packages/core/**'
cli:
- 'packages/cli/**'
web:
- 'packages/web/**'
diff-coverage:
name: Diff Coverage (80% on changed code)
needs: detect-changes
if: needs.detect-changes.outputs.core == 'true' || needs.detect-changes.outputs.cli == 'true' || needs.detect-changes.outputs.web == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install diff-cover
run: pip install diff-cover
- name: Install tmux
if: needs.detect-changes.outputs.web == 'true'
run: sudo apt-get update && sudo apt-get install -y tmux
- name: Start tmux server
if: needs.detect-changes.outputs.web == 'true'
run: tmux start-server
- run: pnpm install --frozen-lockfile
- run: pnpm -r --filter '!@composio/ao-web' build
- name: Core tests with coverage
if: needs.detect-changes.outputs.core == 'true'
run: pnpm --filter @composio/ao-core exec vitest run --coverage
- name: CLI tests with coverage
if: needs.detect-changes.outputs.cli == 'true'
run: pnpm --filter @composio/ao-cli exec vitest run --coverage
- name: Web tests with coverage
if: needs.detect-changes.outputs.web == 'true'
run: pnpm --filter @composio/ao-web exec vitest run --coverage
- name: Prepare and merge lcov reports
run: |
mkdir -p combined-coverage
touch combined-coverage/lcov.info
if [ -f packages/core/coverage/lcov.info ]; then
sed 's|^SF:|SF:packages/core/|' packages/core/coverage/lcov.info >> combined-coverage/lcov.info
fi
if [ -f packages/cli/coverage/lcov.info ]; then
sed 's|^SF:|SF:packages/cli/|' packages/cli/coverage/lcov.info >> combined-coverage/lcov.info
fi
if [ -f packages/web/coverage/lcov.info ]; then
sed 's|^SF:|SF:packages/web/|' packages/web/coverage/lcov.info >> combined-coverage/lcov.info
fi
- name: Check diff coverage (80% on changed lines)
run: |
diff-cover combined-coverage/lcov.info \
--compare-branch=origin/${{ github.base_ref }} \
--fail-under=80 \
--diff-range-notation='...'