-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (85 loc) · 2.38 KB
/
Copy pathci.yml
File metadata and controls
91 lines (85 loc) · 2.38 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
name: CI
on:
pull_request:
branches: [main, master]
push:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
actions: read
checks: write
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.services.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- id: services
run: |
python scripts/ci/discover_services.py --format github > services.json
echo "matrix=$(cat services.json)" >> "$GITHUB_OUTPUT"
lint-and-test:
needs: discover
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
service: ${{ fromJSON(needs.discover.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- uses: pnpm/action-setup@v4
with:
version: 9.15.0
run_install: false
- name: Verify pnpm
run: pnpm --version
- name: Install workspace dependencies
run: pnpm install --frozen-lockfile
- name: Lint service
working-directory: ${{ matrix.service }}
run: |
if [ -f package.json ]; then
pnpm lint --if-present
fi
- name: Test service
working-directory: ${{ matrix.service }}
run: |
if [ -f package.json ]; then
pnpm test --if-present
elif [ -f pyproject.toml ] || [ -f requirements.txt ]; then
python -m pytest -q || true
fi
build:
needs: [discover, lint-and-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- uses: pnpm/action-setup@v4
with:
version: 9.15.0
run_install: false
- name: Verify pnpm
run: pnpm --version
- name: Install workspace dependencies
run: pnpm install --frozen-lockfile
- name: Build workspace targets
run: pnpm turbo run build --filter=...[HEAD^] || pnpm turbo run build --filter=...[HEAD~1] || true