Skip to content

Commit fccae18

Browse files
committed
ci: corepack-enable yarn 4 in main.yml + use mise node + add cache
1 parent 1384dbf commit fccae18

1 file changed

Lines changed: 48 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,56 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
21+
22+
- name: Read Node version from mise.toml
23+
id: node
24+
run: echo "version=$(grep -E '^node\s*=' mise.toml | sed -E 's/.*"([^"]+)".*/\1/')" >> "$GITHUB_OUTPUT"
25+
26+
- name: Install package manager (from package.json)
27+
run: |
28+
corepack enable
29+
corepack install
30+
2131
- uses: actions/setup-node@v4
2232
with:
23-
node-version: 18.x
24-
- run: yarn
25-
- run: yarn lint
26-
- run: yarn test
27-
- run: yarn build || { echo "build command should always succeed" ; exit 61; }
28-
# - run: yarn build --quiet && git diff --quiet action || { echo "ERROR - index.js is different from repository version. Forgot to run `yarn build`?" ; exit 62; }
33+
node-version: ${{ steps.node.outputs.version }}
34+
35+
- name: Resolve yarn cache folder
36+
id: yarn-config
37+
run: echo "cacheFolder=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
38+
39+
- name: Restore yarn install cache (node_modules + cacheFolder + install-state)
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
node_modules
44+
${{ steps.yarn-config.outputs.cacheFolder }}
45+
.yarn/install-state.gz
46+
key: yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-${{ hashFiles('yarn.lock') }}
47+
restore-keys: |
48+
yarn-${{ runner.os }}-node${{ steps.node.outputs.version }}-
49+
50+
- name: Install deps
51+
env:
52+
YARN_ENABLE_HARDENED_MODE: 'false'
53+
run: |
54+
case "$(yarn --version)" in 1.*) echo 'expected up-to-date yarn version'; exit 1 ;; esac
55+
yarn install --immutable
56+
57+
- name: Format
58+
run: yarn format:check
59+
60+
- name: Lint
61+
run: yarn lint
62+
63+
- name: Typecheck
64+
run: yarn typecheck
65+
66+
- name: Test
67+
run: yarn test
68+
69+
- name: Build
70+
run: yarn build || { echo 'build command should always succeed'; exit 61; }
2971

3072
testAllModesLikeInTheReadme:
3173
name: Test in ${{ matrix.testMode }} of version ${{ matrix.unityVersion }} on ${{ matrix.baseRunner }}

0 commit comments

Comments
 (0)