Skip to content

Commit

Permalink
Update Yarn, add cache to Github Actions, and fix action-format using…
Browse files Browse the repository at this point in the history
… npm (#1556)

* Update Yarn, add cache to Github Actions, and fix action-format using npm

* Remove unused packages and sync

* Fix corepack with setup-node

* Fix lint issues
  • Loading branch information
SleeplessByte authored Oct 18, 2024
1 parent 114d600 commit 5e919a0
Show file tree
Hide file tree
Showing 213 changed files with 2,944 additions and 4,211 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/action-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ jobs:
git clone $HEAD_REPO .
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable yarn
- name: Use Node.js LTS (20.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 20.x
cache: 'yarn'
- name: Install project development dependencies
run: npm install --no-save
run: corepack yarn install --immutable
- name: 'Format code'
run: ./bin/format.sh

Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ jobs:

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable yarn

- name: Use Node.js LTS (20.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 20.x
cache: 'yarn'

- name: Install project dependencies
run: |
corepack enable yarn
corepack yarn install --immutable
run: corepack yarn install --immutable

- name: Run exercism/typescript ci precheck (checks config, lint code, and runs tests) for all exercises
run: corepack yarn ci:check
Expand All @@ -35,15 +38,17 @@ jobs:

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable yarn

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install project dependencies
run: |
corepack enable yarn
corepack yarn install --immutable
run: corepack yarn install --immutable

- name: Run exercism/typescript ci (checks config, lint code, and runs tests) for all exercises
run: corepack yarn ci
Expand All @@ -57,10 +62,14 @@ jobs:

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable yarn

- name: Use Node.js 20.x
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 20.x
cache: 'yarn'

- name: Remove root project files
run: rm -f package.json yarn.lock .yarnrc.yml
Expand All @@ -73,9 +82,7 @@ jobs:
- name: Install project dependencies
working-directory: exercises/practice/hello-world
run: |
corepack enable yarn
corepack yarn install --no-immutable
run: corepack yarn install --no-immutable

- name: Run tests
working-directory: exercises/practice/hello-world
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/pr.ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Get changed files
id: changed-files
run: |
Expand All @@ -23,15 +24,17 @@ jobs:
echo "changed_files=$(git diff --name-only --diff-filter=ACM ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable yarn

- name: Use Node.js LTS (20.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 20.x
cache: 'yarn'

- name: Install project dependencies
run: |
corepack enable yarn
corepack yarn install --immutable
run: corepack yarn install --immutable

- name: Run exercism/typescript ci precheck (stub files, config integrity) for changed exercises
run: corepack yarn node scripts/pr-check.mjs ${{ steps.changed-files.outputs.changed_files }}
Expand All @@ -48,6 +51,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Get changed files
id: changed-files
run: |
Expand All @@ -57,15 +61,17 @@ jobs:
echo "changed_files=$(git diff --name-only --diff-filter=ACM ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable yarn

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install project dependencies
run: |
corepack enable yarn
corepack yarn install --immutable
run: corepack yarn install --immutable

- name: Run exercism/typescript ci (runs tests) for changed/added exercises
run: corepack yarn node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }}
Expand All @@ -79,10 +85,14 @@ jobs:

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
run: corepack enable yarn

- name: Use Node.js 20.x
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 20.x
cache: 'yarn'

- name: Remove root project files
run: rm -f package.json yarn.lock .yarnrc.yml
Expand All @@ -95,9 +105,7 @@ jobs:
- name: Install project dependencies
working-directory: exercises/practice/hello-world
run: |
corepack enable yarn
corepack yarn install --no-immutable
run: corepack yarn install --no-immutable

- name: Run tests
working-directory: exercises/practice/hello-world
Expand Down
894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.3.1.cjs

This file was deleted.

3 changes: 2 additions & 1 deletion babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
presets: [[require('@exercism/babel-preset-typescript'), { corejs: '3.37' }]],
// eslint-disable-next-line @typescript-eslint/no-require-imports
presets: [[require('@exercism/babel-preset-typescript'), { corejs: '3.38' }]],
plugins: [],
}
3 changes: 2 additions & 1 deletion common/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
presets: [[require('@exercism/babel-preset-typescript'), { corejs: '3.37' }]],
// eslint-disable-next-line @typescript-eslint/no-require-imports
presets: [[require('@exercism/babel-preset-typescript'), { corejs: '3.38' }]],
plugins: [],
}
16 changes: 8 additions & 8 deletions common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
"node": "^18.16.0 || >=20.0.0"
},
"devDependencies": {
"@exercism/babel-preset-typescript": "^0.5.0",
"@exercism/eslint-config-typescript": "^0.7.1",
"@exercism/babel-preset-typescript": "^0.6.0",
"@exercism/eslint-config-typescript": "^0.8.0",
"@jest/globals": "^29.7.0",
"@types/node": "~22.0.2",
"@types/node": "~22.7.6",
"babel-jest": "^29.7.0",
"core-js": "~3.37.1",
"eslint": "^9.8.0",
"core-js": "~3.38.1",
"eslint": "^9.12.0",
"expect": "^29.7.0",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"tstyche": "^2.1.1",
"typescript": "~5.5.4",
"typescript-eslint": "^7.18.0"
"typescript": "~5.6.3",
"typescript-eslint": "^8.10.0"
},
"scripts": {
"test": "corepack yarn node test-runner.mjs",
Expand All @@ -38,5 +38,5 @@
"lint:types": "corepack yarn tsc --noEmit -p .",
"lint:ci": "corepack yarn eslint . --ext .tsx,.ts"
},
"packageManager": "yarn@4.3.1"
"packageManager": "yarn@4.5.1"
}
Loading

0 comments on commit 5e919a0

Please sign in to comment.