-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (139 loc) · 4.49 KB
/
Copy pathci-ts.yml
File metadata and controls
168 lines (139 loc) · 4.49 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: ci-ts
# TypeScript / JavaScript CI for the CumulusVPN monorepo.
# Covers the three root Yarn workspaces (core-ts, web, desktop) plus the two
# standalone packages that are intentionally NOT root workspaces: the mobile
# React Native app and the deploy tooling (each carries its own yarn.lock).
on:
push:
branches: [main]
paths:
- 'clients/**'
- 'deploy/**'
- 'package.json'
- 'yarn.lock'
- 'tsconfig*.json'
- '.prettierrc'
- '.prettierignore'
- '.yarnrc.yml'
- '.github/workflows/ci-ts.yml'
pull_request:
paths:
- 'clients/**'
- 'deploy/**'
- 'package.json'
- 'yarn.lock'
- 'tsconfig*.json'
- '.prettierrc'
- '.prettierignore'
- '.yarnrc.yml'
- '.github/workflows/ci-ts.yml'
permissions:
contents: read
concurrency:
group: ci-ts-${{ github.ref }}
cancel-in-progress: true
jobs:
# Root workspaces share one immutable install; the matrix fans out per package.
workspaces:
name: workspace (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: core-ts
pkg: '@cumulusvpn/core'
- name: web
pkg: '@cumulusvpn/web'
- name: desktop
pkg: '@cumulusvpn/desktop'
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 22
# Corepack must be enabled BEFORE any `yarn` call: the packageManager
# field pins yarn@4, and setup-node's built-in `cache: yarn` would invoke
# the runner's global Yarn 1 and fail. So no setup-node cache here.
- name: Enable Corepack
run: corepack enable
- name: Install (immutable)
run: yarn install --immutable
# web and desktop import @cumulusvpn/core via its built dist (types + js),
# so build it before the per-package checks run on a clean checkout.
- name: Build @cumulusvpn/core
run: yarn workspace @cumulusvpn/core run build
- name: format:check
run: yarn workspace ${{ matrix.pkg }} run format:check
- name: lint
run: yarn workspace ${{ matrix.pkg }} run lint
- name: typecheck
run: yarn workspace ${{ matrix.pkg }} run typecheck
- name: test
run: yarn workspace ${{ matrix.pkg }} run test
- name: build
run: yarn workspace ${{ matrix.pkg }} run build
# React Native app — standalone install, no bundler build in CI (store builds
# happen on native runners); we gate on format, lint, types and unit tests.
mobile:
name: mobile (react-native)
runs-on: ubuntu-latest
defaults:
run:
working-directory: clients/mobile
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 22
- name: Enable Corepack
run: corepack enable
# The mobile app consumes @cumulusvpn/core via `file:../core-ts`, and its
# jest moduleNameMapper resolves it to dist/index.js. dist/ is a build
# output (gitignored), so it must be built BEFORE the mobile install copies
# the package — otherwise `yarn test` fails on a clean checkout.
- name: Build shared core
working-directory: ${{ github.workspace }}
run: |
yarn install --immutable
yarn workspace @cumulusvpn/core run build
# @cumulusvpn/core is a file:../core-ts dep whose content-hash drifts as
# core-ts changes; CI defaults to immutable installs, so opt out here.
- name: Install
run: yarn install --no-immutable
- name: format:check
run: yarn format:check
- name: lint
run: yarn lint
- name: typecheck
run: yarn tsc --noEmit
- name: test
run: yarn test
# Deploy tooling — standalone install; pure Node (.mjs), so no typecheck/build.
deploy:
name: deploy (tooling)
runs-on: ubuntu-latest
defaults:
run:
working-directory: deploy
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 22
- name: Enable Corepack
run: corepack enable
- name: Install
run: yarn install
- name: lint
run: yarn lint
- name: format:check
run: yarn format:check
- name: test
run: yarn test