-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (111 loc) · 4.47 KB
/
ci.yml
File metadata and controls
130 lines (111 loc) · 4.47 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
name: CI
# PNPM setup based on https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CI: true
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
# Required for the Turborepo Git filters.
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: ">=24.0.0"
check-latest: true
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Restore Turborepo cache
id: cache-turborepo-restore
uses: actions/cache/restore@v5
with:
# Using SHA will usually provide cache hit on subsequent commits in a PR
# but will not provide cache hits between PRs, meaning the first run of a PR
# will usually only be cache misses.
key: ${{ runner.os }}-turbo-ci-v11-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-ci-v11-
${{ runner.os }}-turbo-v11-
path: .turbo
- name: Build packages
# For a PR, only build the packages that are diverging from the pull request original baseline.
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
pnpm turbo run build --filter={./packages/*}...[${{ github.event.pull_request.base.sha }}]
else
pnpm build-pkg
fi
- name: Build all platforms sample
# For a PR, only build the sample if it's diverging from the pull request original baseline.
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
pnpm turbo run build --filter={./samples/all-platforms/**}...[${{ github.event.pull_request.base.sha }}]
else
pnpm build-all-platforms
fi
- name: Build honeycomb api-key sample
# For a PR, only build the sample if it's diverging from the pull request original baseline.
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
pnpm turbo run build --filter={./samples/honeycomb/api-key/**}...[${{ github.event.pull_request.base.sha }}]
else
pnpm build-honeycomb-api-key
fi
- name: Build honeycomb proxy sample
# For a PR, only build the sample if it's diverging from the pull request original baseline.
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
pnpm turbo run build --filter={./samples/honeycomb/proxy/**}...[${{ github.event.pull_request.base.sha }}]
else
pnpm build-honeycomb-proxy
fi
- name: ESLint
# For a PR, only lint the projects that are diverging from the pull request original baseline.
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
pnpm turbo run eslint --filter=...[${{ github.event.pull_request.base.sha }}]
else
pnpm turbo run eslint
fi
- name: Typecheck
# For a PR, only typecheck the projects that are diverging from the pull request original baseline.
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
pnpm turbo run typecheck --filter=...[${{ github.event.pull_request.base.sha }}]
else
pnpm turbo run typecheck
fi
- name: Syncpack
run: pnpm turbo run syncpack
- name: Test packages
# For a PR, only test the projects that are diverging from the pull request original baseline.
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
pnpm test --filter=...[${{ github.event.pull_request.base.sha }}]
else
pnpm test
fi
- name: Save Turborepo cache
id: cache-turborepo-save
if: always() && steps.cache-turborepo-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
key: ${{ steps.cache-turborepo-restore.outputs.cache-primary-key }}
path: .turbo