-
Notifications
You must be signed in to change notification settings - Fork 2
100 lines (81 loc) · 3.1 KB
/
ci.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
name: CI
on:
push:
branches:
- master
- "legacy/*"
pull_request:
branches:
- master
- "legacy/*"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache for yarn (master)
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: node-cache-${{ runner.os }}-yarn-master-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-cache-${{ runner.os }}-yarn-master-
if: (github.event_name == 'pull_request' && github.base_ref == 'master') || (github.event_name == 'push' && github.ref_name == 'master')
- name: Cache for yarn (legacy)
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: node-cache-${{ runner.os }}-yarn-legacy-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-cache-${{ runner.os }}-yarn-legacy-
if: (github.event_name == 'pull_request' && github.base_ref != 'master') || (github.event_name == 'push' && github.ref_name != 'master')
- name: Cache nx cache (master)
uses: actions/cache@v3
with:
path: .cache
key: ${{ runner.os }}-nx-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-nx
if: (github.event_name == 'pull_request' && github.base_ref == 'master') || (github.event_name == 'push' && github.ref_name == 'master')
# Fix `yarn install --frozen-lockfile` not working in monorepo.
# https://github.com/yarnpkg/yarn/issues/5840#issuecomment-468782288
- name: Get checksum before yarn install
id: yarn-lock-check-before
run: echo "::set-output name=sum::$(cksum yarn.lock)"
- run: yarn install --frozen-lockfile
- name: Get checksum after yarn install
id: yarn-lock-check-after
run: echo "::set-output name=sum::$(cksum yarn.lock)"
- name: Exit if yarn.lock updated
run: exit 1
if: steps.yarn-lock-check-before.outputs.sum != steps.yarn-lock-check-after.outputs.sum
- run: yarn build
- run: yarn test:ci
- name: Codecov
uses: codecov/codecov-action@v3
with:
directory: libs
- id: next-publish-from-tags
uses: easyops-cn/actions-next-publish-from-tags@master
with:
npm-token: ${{ secrets.NPM_TOKEN }}
if: github.event_name == 'push'
- name: Sync taobao npm mirror
run: npx lerna exec -- curl -sLX PUT 'https://registry-direct.npmmirror.com/-/package/$LERNA_PACKAGE_NAME/syncs'
if: github.event_name == 'push' && steps.next-publish-from-tags.outputs.has-tags
continue-on-error: true