-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (104 loc) · 3.55 KB
/
Copy pathci.yml
File metadata and controls
121 lines (104 loc) · 3.55 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: CI
permissions:
contents: read
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths-ignore:
- '**.md'
- 'docs/**'
- '.cursor/**'
- '.agents/**'
- '.opencode/**'
- '.github/skills/**'
- '.github/prompts/**'
- '.github/agents/**'
- 'apps/mobile/**'
- 'packages/media-pipeline/**'
- 'packages/moq-probe/**'
- 'packages/offloading/**'
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
outputs:
api-node: ${{ steps.detect.outputs.api-node }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Detect api-node relevant changes
id: detect
shell: bash
run: |
set -euo pipefail
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
api_node=false
while IFS= read -r file; do
case "$file" in
packages/api-node/*|packages/shared/*|packages/storage/*|packages/api/*|package.json|package-lock.json)
api_node=true
break
;;
esac
done < <(git diff --name-only "$BASE" "$HEAD")
echo "api-node=$api_node" >> "$GITHUB_OUTPUT"
typecheck:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: lts/*
cache: npm
- uses: nrwl/nx-set-shas@v4
- name: Install dependencies (npm ci with npm install fallback)
run: |
if ! npm ci; then
echo "::warning title=npm ci failed; using npm install fallback::Lockfile drift detected (package.json and package-lock.json may be out of sync). Regenerate and commit package-lock.json."
npm install
fi
- name: Typecheck (affected)
run: |
bash .github/scripts/nx-with-cloud-fallback.sh affected -t typecheck typecheck:scripts --base=$NX_BASE --head=$NX_HEAD
- run: bash .github/scripts/nx-with-cloud-fallback.sh fix-ci
if: always()
api-node:
needs: changes
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Skip api-node verification (no relevant changes)
if: needs.changes.outputs.api-node != 'true'
run: echo "No api-node-related files changed; skipping verify:api-node."
- uses: actions/checkout@v6
if: needs.changes.outputs.api-node == 'true'
with:
persist-credentials: false
- uses: actions/setup-node@v6
if: needs.changes.outputs.api-node == 'true'
with:
node-version: lts/*
cache: npm
- name: Install dependencies (npm ci with npm install fallback)
if: needs.changes.outputs.api-node == 'true'
run: |
if ! npm ci; then
echo "::warning title=npm ci failed; using npm install fallback::Lockfile drift detected (package.json and package-lock.json may be out of sync). Regenerate and commit package-lock.json."
npm install
fi
- name: Verify api-node (typecheck, tests, esbuild bundle)
if: needs.changes.outputs.api-node == 'true'
run: npm run verify:api-node