Skip to content

Commit a11146d

Browse files
committed
Start switching workflows to pnpm
1 parent d4028e4 commit a11146d

File tree

6 files changed

+46
-44
lines changed

6 files changed

+46
-44
lines changed

.github/workflows/action-format.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,18 @@ jobs:
6060
git clone $HEAD_REPO .
6161
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"
6262
63-
- name: Use Node.js LTS (18.x)
63+
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
64+
run: corepack enable pnpm
65+
66+
- name: Use Node.js LTS (20.x)
6467
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
6568
with:
66-
node-version: '18'
69+
node-version: 20.x
70+
cache: 'pnpm'
71+
6772
- name: Install project development dependencies
68-
run: npm install --no-save
73+
run: corepack pnpm install --no-save
74+
6975
- name: 'Format code'
7076
run: ./bin/format.sh
7177

.github/workflows/action-sync.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ jobs:
6161
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"
6262
6363
- name: 'Install dependencies'
64-
run: yarn install
64+
run: |
65+
corepack enable pnpm
66+
corepack pnpm install
6567
- name: 'Sync exercises'
66-
run: npx babel-node scripts/sync
68+
run: corepack pnpm node scripts/sync.mjs
6769

6870
- name: 'Commit changes'
6971
run: |

.github/workflows/ci.js.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,41 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
16-
- name: Use Node.js LTS (18.x)
16+
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
17+
run: corepack enable pnpm
18+
19+
- name: Use Node.js LTS (20.x)
1720
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
1821
with:
19-
node-version: '18'
22+
node-version: 20.x
23+
cache: 'pnpm'
2024

2125
- name: Install project dependencies
22-
run: npm ci
26+
run: corepack pnpm install --frozen-lockfile
2327

2428
- name: Run exercism/javascript ci precheck (checks config, lint code, and runs tests) for all exercises
25-
run: npx babel-node scripts/ci-check
29+
run: corepack pnpm node scripts/ci-check.mjs
2630

2731
ci:
2832
runs-on: ubuntu-22.04
2933

3034
strategy:
3135
matrix:
32-
node-version: ['18', '20']
36+
node-version: [20.x, 22.x]
3337

3438
steps:
3539
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
40+
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
41+
run: corepack enable pnpm
42+
3643
- name: Use Node.js ${{ matrix.node-version }}
3744
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
3845
with:
3946
node-version: ${{ matrix.node-version }}
47+
cache: 'pnpm'
4048

4149
- name: Install project dependencies
42-
run: npm ci
50+
run: corepack pnpm install --frozen-lockfile
4351

4452
- name: Run exercism/javascript ci (checks config, lint code, and runs tests) for all exercises
45-
run: npx babel-node scripts/ci
53+
run: corepack pnpm node scripts/ci.mjs

.github/workflows/pr.ci.js.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,42 @@ jobs:
1212
steps:
1313
- name: Checkout PR
1414
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
15+
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
16+
run: corepack enable pnpm
1517

16-
- name: Use Node.js LTS (18.x)
18+
- name: Use Node.js LTS (20.x)
1719
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
1820
with:
19-
node-version: '18'
21+
node-version: 20.x
22+
cache: 'pnpm'
2023

2124
- name: Install project dependencies
22-
run: npm ci
25+
run: corepack pnpm install --frozen-lockfile
2326

2427
- name: Run exercism/javascript ci precheck (stub files, config integrity) for changed exercises
25-
run: |
26-
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
27-
curl --url $"${PULL_REQUEST_URL}/files?per_page=100" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
28-
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("\\.(js|jsx|md|json)$")) | .filename' | \
29-
xargs -r npx babel-node scripts/pr-check
28+
run: corepack pnpm node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }}
3029

3130
ci:
3231
runs-on: ubuntu-22.04
3332

3433
strategy:
3534
matrix:
36-
node-version: ['18', '20']
35+
node-version: [20.x, 22.x]
3736

3837
steps:
3938
- name: Checkout PR
4039
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
40+
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
41+
run: corepack enable pnpm
4142

4243
- name: Use Node.js ${{ matrix.node-version }}
4344
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
4445
with:
4546
node-version: ${{ matrix.node-version }}
47+
cache: 'pnpm'
4648

4749
- name: Install project dependencies
48-
run: npm ci
50+
run: corepack pnpm install --frozen-lockfile
4951

5052
- name: Run exercism/javascript ci (runs tests) for changed/added exercises
51-
run: |
52-
PULL_REQUEST_URL=$(jq -r ".pull_request.url" "$GITHUB_EVENT_PATH")
53-
curl --url $"${PULL_REQUEST_URL}/files?per_page=100" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | \
54-
jq -c '.[] | select(.status == "added" or .status == "modified") | select(.filename | match("\\.(js|jsx|md|json)$")) | .filename' | \
55-
xargs -r npx babel-node scripts/pr
53+
run: corepack pnpm node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }}

.github/workflows/verify-code-formatting.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ jobs:
1111
steps:
1212
- name: 'Checkout code'
1313
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
14-
- name: Use Node.js LTS (18.x)
15-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
16-
with:
17-
node-version: '18'
18-
- name: Install project development dependencies
19-
run: npm i
14+
2015
- name: 'Verify formatting of all files'
2116
run: ./bin/check-formatting.sh

scripts/helpers.mjs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@ export function assertAssignment(assignment, shouldExist = true) {
3737
}
3838

3939
shell.echo("[Failure] that's not a valid assignment reference");
40-
const chalk = require('chalk');
4140

4241
if (assignment.split(path.sep).length === 1) {
4342
// prettier-ignore
4443
shell.echo(`
45-
Expected ${chalk.cyan(`{type}${path.sep}{slug}`)}, actual: ${chalk.yellow(assignment)}.
46-
- Use ${chalk.green(`concept${path.sep}${assignment}`)} if ${chalk.yellow(assignment)} is a concept exercise.
47-
- Use ${chalk.green(`practice${path.sep}${assignment}`)} if ${chalk.yellow(assignment)} is a practice exercise.
44+
Expected ${`{type}${path.sep}{slug}`}, actual: ${assignment}.
45+
- Use ${`concept${path.sep}${assignment}`} if ${assignment} is a concept exercise.
46+
- Use ${`practice${path.sep}${assignment}`} if ${assignment} is a practice exercise.
4847
`.trim());
4948
}
5049

@@ -172,13 +171,7 @@ export function cleanUp() {
172171
// These packages will be skipped while performing checksum. In other words,
173172
// these packages are only interesting for maintaining this repository and not
174173
// for the student.
175-
const SKIP_PACKAGES_FOR_CHECKSUM = [
176-
'shelljs',
177-
'@babel/node',
178-
'prettier',
179-
'diff',
180-
'chalk',
181-
];
174+
const SKIP_PACKAGES_FOR_CHECKSUM = ['shelljs', 'prettier'];
182175

183176
// These fields may differ between package.json files.
184177
const SKIP_FIELDS_FOR_CHECKSUM = [

0 commit comments

Comments
 (0)