Convert to ESLint 9 flat config and move to pnpm, use .mjs and new jest types #3248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: javascript / pr | |
on: pull_request | |
jobs: | |
precheck: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
with: | |
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} | |
- name: Get changed files | |
id: changed-files | |
run: | | |
if ${{ github.event_name == 'pull_request' }}; then | |
echo "changed_files=$(git diff --name-only --diff-filter=ACM -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT | |
else | |
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 pnpm | |
- name: Use Node.js LTS (20.x) | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b | |
with: | |
node-version: 20.x | |
cache: 'pnpm' | |
- name: Install project dependencies | |
run: corepack pnpm install --frozen-lockfile | |
- name: Run exercism/javascript ci precheck (stub files, config integrity) for changed exercises | |
run: corepack pnpm node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }} | |
ci: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
node-version: [20.x, 22.x] | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
with: | |
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} | |
- name: Get changed files | |
id: changed-files | |
run: | | |
if ${{ github.event_name == 'pull_request' }}; then | |
echo "changed_files=$(git diff --name-only --diff-filter=ACM -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT | |
else | |
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 pnpm | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install project dependencies | |
run: corepack pnpm install --frozen-lockfile | |
- name: Run exercism/javascript ci (runs tests) for changed/added exercises | |
run: corepack pnpm node scripts/pr.mjs ${{ steps.changed-files.outputs.changed_files }} |