-
-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (110 loc) · 5.07 KB
/
ci-packages.yml
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
name: CI-packages
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- '**'
permissions:
contents: read
jobs:
test-packages:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
# Fetch all git history so that yarn workspaces --since can compare with the correct commits
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
fetch-depth: 0
- name: ⚙️ Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
- name: ⚙️ Nx setup - SHAs for base and head for `nx affected` commands
id: nx-set-shas
uses: nrwl/nx-set-shas@v4
- run: |
echo "BASE: ${{ steps.nx-set-shas.outputs.base }}"
echo "HEAD: ${{ steps.nx-set-shas.outputs.head }}"
- name: Cache rotation keys
id: cache-rotation
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- name: ♻️ Restore packages cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.cache
key: ${{ runner.os }}-packages-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'integrations/**.[jt]sx?') }}
restore-keys: |
${{ runner.os }}-packages-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('yarn.lock') }}-
- name: 🕵️ Typecheck
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=typecheck --exclude='examples/**' --exclude='docs'
- name: 🔬 ESLint checks
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=lint --exclude='examples/**' --exclude='docs'
- name: 🧪 Unit tests (no-coverage - node !== 20.x)
if: matrix.node-version != '20.x'
run: yarn nx run-many --target=test-unit --exclude='examples/**' --exclude='docs'
- name: 🧪 Unit tests (coverage - only node 20.x)
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=test-unit-coverage --exclude='examples/**' --exclude='docs'
#- name: ☂️ Codecov upload (only node-20)
# if: matrix.node-version == '20.x'
# working-directory: ${{ github.workspace }}
# run: |
# bash .github/scripts/install-codecov.sh
# yarn g:ci-coverage-upload
# shell: bash
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: ☂️ Codecov upload (only node-20)
uses: codecov/codecov-action@v4
if: matrix.node-version == '20.x'
with:
fail_ci_if_error: true # optional (default = false)
#files: ./coverage1.xml,./coverage2.xml # optional
#flags: unittests # optional
flags: httpx-exception-unit,httpx-dsn-parser-unit,httpx-memo-intl-unit,httpx-plain-object-unit,httpx-assert-unit,httpx-json-api-unit,httpx-treeu-unit
#name: codecov-umbrella # optional
verbose: true # optional (default = false)
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: 🧪 Unit tests (edge-runtime)
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=test-unit-edge --exclude='examples/**' --exclude='docs'
- name: 🧪 Unit tests (cloudflare - only node 20.x)
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=test-unit-cloudflare --exclude='examples/**' --exclude='docs'
- name: ⚙️ Install Playwright Chrome (only node 20.x)
if: matrix.node-version == '20.x'
run: yarn playwright install chrome
# @todo make this working
#- name: 🧪 Unit tests (playwright chrome - only node 20.x)
# if: matrix.node-version == '20.x'
# run: yarn nx run-many --target=test-unit-browser --exclude='examples/**' --exclude='docs'
- name: 🏗 Build packages
run: yarn nx run-many --target=build --exclude='examples/**' --exclude='docs'
- name: 📐 Check build for size-limits
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=check-size --exclude='examples/**' --exclude='docs'
- name: 🛟 Check build for ecmascript compliance
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=check-dist --exclude='examples/**' --exclude='docs'
- name: 🛟 Check publishable dist (arethetypeswrong)
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=check-pub --exclude='examples/**' --exclude='docs'
- name: 📄 Check doc can be built
if: matrix.node-version == '20.x'
run: yarn nx run-many --target=docgen --exclude='examples/**' --exclude='docs'