|
1 | 1 | name: CI |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: [ master ] |
6 | | - pull_request: |
7 | | - branches: [ master ] |
8 | | - |
| 2 | +on: [push, pull_request] |
9 | 3 | jobs: |
10 | | - setup: |
11 | | - runs-on: ubuntu-latest |
12 | | - steps: |
13 | | - - name: checkout |
14 | | - uses: actions/checkout@v4 |
15 | | - |
16 | | - - uses: actions/setup-node@v4 |
17 | | - with: |
18 | | - node-version: 20 |
19 | | - |
20 | | - - name: cache package-lock.json |
21 | | - uses: actions/cache@v4 |
22 | | - with: |
23 | | - path: package-temp-dir |
24 | | - key: lock-${{ github.sha }} |
25 | | - |
26 | | - - name: create package-lock.json |
27 | | - run: npm i --package-lock-only --ignore-scripts |
28 | | - |
29 | | - - name: hack for singe file |
30 | | - run: | |
31 | | - if [ ! -d "package-temp-dir" ]; then |
32 | | - mkdir package-temp-dir |
33 | | - fi |
34 | | - cp package-lock.json package-temp-dir |
35 | | -
|
36 | | - - name: cache node_modules |
37 | | - id: node_modules_cache_id |
38 | | - uses: actions/cache@v4 |
39 | | - with: |
40 | | - path: node_modules |
41 | | - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} |
42 | | - |
43 | | - - name: install |
44 | | - if: steps.node_modules_cache_id.outputs.cache-hit != 'true' |
45 | | - run: npm ci |
46 | | - |
47 | | - lint: |
48 | | - runs-on: ubuntu-latest |
49 | | - steps: |
50 | | - - name: checkout |
51 | | - uses: actions/checkout@v4 |
52 | | - |
53 | | - - name: restore cache from package-lock.json |
54 | | - uses: actions/cache@v4 |
55 | | - with: |
56 | | - path: package-temp-dir |
57 | | - key: lock-${{ github.sha }} |
58 | | - |
59 | | - - name: restore cache from node_modules |
60 | | - uses: actions/cache@v4 |
61 | | - with: |
62 | | - path: node_modules |
63 | | - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} |
64 | | - |
65 | | - - name: lint |
66 | | - run: npm run lint |
67 | | - |
68 | | - - name: ts check |
69 | | - run: npm run tsc |
70 | | - needs: setup |
71 | | - |
72 | | - compile: |
73 | | - runs-on: ubuntu-latest |
74 | | - steps: |
75 | | - - name: checkout |
76 | | - uses: actions/checkout@v4 |
77 | | - |
78 | | - - name: restore cache from package-lock.json |
79 | | - uses: actions/cache@v4 |
80 | | - with: |
81 | | - path: package-temp-dir |
82 | | - key: lock-${{ github.sha }} |
83 | | - |
84 | | - - name: restore cache from node_modules |
85 | | - uses: actions/cache@v4 |
86 | | - with: |
87 | | - path: node_modules |
88 | | - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} |
89 | | - |
90 | | - - name: compile |
91 | | - run: npm run compile |
92 | | - |
93 | | - needs: setup |
94 | | - |
95 | | - coverage: |
96 | | - runs-on: ubuntu-latest |
97 | | - steps: |
98 | | - - name: checkout |
99 | | - uses: actions/checkout@v4 |
100 | | - |
101 | | - - name: restore cache from package-lock.json |
102 | | - uses: actions/cache@v4 |
103 | | - with: |
104 | | - path: package-temp-dir |
105 | | - key: lock-${{ github.sha }} |
106 | | - |
107 | | - - name: restore cache from node_modules |
108 | | - uses: actions/cache@v4 |
109 | | - with: |
110 | | - path: node_modules |
111 | | - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} |
112 | | - |
113 | | - - name: coverage |
114 | | - run: npm test -- --coverage |
115 | | - |
116 | | - - name: Upload coverage to Codecov |
117 | | - uses: codecov/codecov-action@v4 |
118 | | - with: |
119 | | - token: ${{ secrets.CODECOV_TOKEN }} |
120 | | - |
121 | | - needs: setup |
| 4 | + CI: |
| 5 | + uses: react-component/rc-test/.github/workflows/test.yml@main |
| 6 | + secrets: inherit |
0 commit comments