Skip to content

Commit a695f01

Browse files
authored
Merge pull request #1144 from wantedly/chloe463/ci/clean-up
2 parents 8dddfd0 + 8203837 commit a695f01

File tree

3 files changed

+120
-52
lines changed

3 files changed

+120
-52
lines changed

.github/workflows/ci.yml

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Node CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/[email protected]
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Use Node.js
15+
uses: actions/[email protected]
16+
with:
17+
node-version: 22
18+
19+
- name: Get yarn cache directory path
20+
id: yarn-cache-dir-path
21+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
22+
23+
- name: Restore cache for yarn and lerna
24+
uses: actions/[email protected]
25+
id: yarn-cache
26+
with:
27+
path: |
28+
${{ steps.yarn-cache-dir-path.outputs.dir }}
29+
node_modules
30+
*/*/node_modules
31+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-yarn-
34+
35+
- name: Install dependencies
36+
run: yarn install --frozen-lockfile
37+
38+
- name: Run ESLint
39+
run: |
40+
BASE_BRANCH=${GITHUB_BASE_REF:-master}
41+
BASE_COMMIT=$(git merge-base HEAD origin/${BASE_BRANCH})
42+
yarn lint-staged --concurrent=false --diff="${BASE_COMMIT}..HEAD" --verbose
43+
44+
test:
45+
runs-on: ubuntu-latest
46+
47+
strategy:
48+
matrix:
49+
node-version: [20.x, 22.x]
50+
51+
steps:
52+
- uses: actions/[email protected]
53+
54+
- name: Use Node.js ${{ matrix.node-version }}
55+
uses: actions/[email protected]
56+
with:
57+
node-version: ${{ matrix.node-version }}
58+
59+
- name: Get yarn cache directory path
60+
id: yarn-cache-dir-path
61+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
62+
63+
- name: Restore cache for yarn and lerna
64+
uses: actions/[email protected]
65+
id: yarn-cache
66+
with:
67+
path: |
68+
${{ steps.yarn-cache-dir-path.outputs.dir }}
69+
node_modules
70+
*/*/node_modules
71+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
72+
restore-keys: |
73+
${{ runner.os }}-yarn-
74+
75+
- name: Install dependencies
76+
run: yarn install --frozen-lockfile
77+
78+
- name: Build
79+
run: yarn build
80+
81+
- name: Test
82+
run: yarn test
83+
84+
build:
85+
runs-on: ubuntu-latest
86+
87+
strategy:
88+
matrix:
89+
node-version: [20.x, 22.x]
90+
91+
steps:
92+
- uses: actions/[email protected]
93+
94+
- name: Use Node.js ${{ matrix.node-version }}
95+
uses: actions/[email protected]
96+
with:
97+
node-version: ${{ matrix.node-version }}
98+
99+
- name: Get yarn cache directory path
100+
id: yarn-cache-dir-path
101+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
102+
103+
- name: Restore cache for yarn and lerna
104+
uses: actions/[email protected]
105+
id: yarn-cache
106+
with:
107+
path: |
108+
${{ steps.yarn-cache-dir-path.outputs.dir }}
109+
node_modules
110+
*/*/node_modules
111+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
112+
restore-keys: |
113+
${{ runner.os }}-yarn-
114+
115+
- name: Install dependencies
116+
run: yarn install --frozen-lockfile
117+
118+
- name: Build
119+
run: yarn build

.github/workflows/nodejs.yml

-52
This file was deleted.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"scripts": {
3333
"postinstall": "lerna bootstrap",
34+
"pretest": "yarn build",
3435
"test": "FORCE_COLOR=1 lerna run --stream test",
3536
"test:watch": "FORCE_COLOR=1 lerna exec --stream --ignore prettier-config-wantedly -- npm run test -- --watch",
3637
"test:watch:frolint": "lerna exec \"npm run test -- --watch\" --scope frolint",

0 commit comments

Comments
 (0)