Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to pnpm, ESLint 9, and helpful output #852

Merged
merged 63 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
e3d7a79
Switch to pnpm, ESLint 9, and helpful output
SleeplessByte Aug 7, 2024
4345236
Replace references of yarn with pnpm
SleeplessByte Aug 7, 2024
da2fa96
Use published packages
SleeplessByte Aug 8, 2024
f1cacb7
Bump version of docker/build-push-action
SleeplessByte Aug 8, 2024
4edf1ea
Attempt to enable pnpm to read prettier version
SleeplessByte Aug 8, 2024
1977be3
Fix test
SleeplessByte Aug 8, 2024
758c1e9
Try lts/* for .nvmrc
SleeplessByte Aug 8, 2024
15d214f
Fix tests
SleeplessByte Aug 8, 2024
9c59213
Fix unbound variable issue
SleeplessByte Aug 8, 2024
1c7e2b8
Use pnpm list instead of why
SleeplessByte Aug 8, 2024
d2df821
Correctly clear cache using store prune
SleeplessByte Aug 8, 2024
610579a
Attempt to fix formatting actions
SleeplessByte Aug 8, 2024
95dbcf1
Disable store prune for now
SleeplessByte Aug 8, 2024
d256a18
Prune dev dependencies
SleeplessByte Aug 8, 2024
1a0623a
Make binaries executable hopefully
SleeplessByte Aug 8, 2024
fd2e45d
Log the .bin folder
SleeplessByte Aug 8, 2024
3a68b3a
idk?
SleeplessByte Aug 8, 2024
987dcf4
Chown it then I guess?
SleeplessByte Aug 8, 2024
b969755
Don't symlink executables
SleeplessByte Aug 8, 2024
08d2543
Attempt to own and execute as appuser
SleeplessByte Aug 8, 2024
80b9027
Okay later then
SleeplessByte Aug 8, 2024
fadf724
Remove all changes to ownership for now
SleeplessByte Aug 9, 2024
c794d3f
Print executability
SleeplessByte Aug 11, 2024
6fb51d4
Log more things
SleeplessByte Aug 11, 2024
8be3ca6
Debug promise
SleeplessByte Aug 11, 2024
273648c
Hopefully fix the slug issue
SleeplessByte Aug 11, 2024
28b1ea0
Try alternatives
SleeplessByte Aug 11, 2024
7fff6ef
Other alternatives
SleeplessByte Aug 11, 2024
21ec568
Don't cd into output
SleeplessByte Aug 11, 2024
414a81c
Correctly cd into directory when needed
SleeplessByte Aug 11, 2024
c5ae4ab
Hopefully detect the docker run issue
SleeplessByte Aug 11, 2024
8af0549
Maybe chown will fix it?
SleeplessByte Aug 11, 2024
eb03d81
With full path
SleeplessByte Aug 11, 2024
15a8105
Different ls options
SleeplessByte Aug 11, 2024
f40a799
Print ls in case of not executable
SleeplessByte Aug 11, 2024
202773e
Fix typo
SleeplessByte Aug 11, 2024
c2efe41
idk
SleeplessByte Aug 11, 2024
6cbf634
Show whoami
SleeplessByte Aug 11, 2024
5d8bc66
Show whomai for real
SleeplessByte Aug 11, 2024
ee1b283
Separate tests for jest bin file
SleeplessByte Aug 11, 2024
f037f14
Woops, fix that remnant
SleeplessByte Aug 11, 2024
89ecb78
Ignore appuser for now
SleeplessByte Aug 12, 2024
8f48383
Show me that env
SleeplessByte Aug 12, 2024
269c755
Re-enable appuser
SleeplessByte Aug 12, 2024
88857ba
Debug etc/passwd
SleeplessByte Aug 12, 2024
926f77b
Debug mounts
SleeplessByte Aug 12, 2024
7744b5b
Make tmp executable for now
SleeplessByte Aug 12, 2024
2674912
Also make this one executable temporarily
SleeplessByte Aug 12, 2024
549ba8c
Collate layers
SleeplessByte Aug 12, 2024
d652f26
Try jest without corepack root
SleeplessByte Aug 12, 2024
c907f7b
Ensure no tmpfs for tests if running in docker without exec
SleeplessByte Aug 12, 2024
75639b6
Woops, typo
SleeplessByte Aug 12, 2024
bb287d1
Fix empty continuation
SleeplessByte Aug 12, 2024
b850b54
Probably fix issue with path?
SleeplessByte Aug 12, 2024
1fc134e
Remove :exec flag
SleeplessByte Aug 12, 2024
04e54f7
Make executable again
SleeplessByte Aug 12, 2024
1625585
Print mount before tests
SleeplessByte Aug 12, 2024
9b6dce1
Always use bash please
SleeplessByte Aug 12, 2024
478d981
Remove option :exec not supported by --mount
SleeplessByte Aug 13, 2024
10b8c1e
Hopefully make the tests work
SleeplessByte Oct 18, 2024
7364356
Remove color from expected results (docker only)
SleeplessByte Oct 18, 2024
f200f00
Fix expected results for clock
SleeplessByte Oct 18, 2024
2ac25c7
Add npm test
SleeplessByte Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions .eslintrc.js

This file was deleted.

12 changes: 7 additions & 5 deletions .github/workflows/action-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ jobs:
git clone $HEAD_REPO .
git checkout -b "$HEAD_REF" "origin/$HEAD_REF"

- name: Use Node.js LTS (18.x)
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
- name: Use Node.js LTS (20.x)
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: '18'
- name: Install project development dependencies
run: npm install --no-save
node-version: 20.x
- name: Enable pnpm
run: |
corepack enable pnpm
corepack pnpm -v
- name: 'Format code'
run: ./bin/format.sh

Expand Down
28 changes: 17 additions & 11 deletions .github/workflows/ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Use Node.js LTS (18.x)
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Use Node.js LTS
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 18.x
node-version-file: .nvmrc

- name: Install project dependencies
run: yarn install --immutable
run: |
corepack enable pnpm
corepack pnpm -v
corepack pnpm install --frozen-lockfile

- name: Run exercism/javascript-test-runner ci precheck (lint code)
run: bin/lint.sh
Expand All @@ -29,28 +32,31 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: ${{ matrix.node-version }}

- name: Install project dependencies
run: yarn install --immutable
run: |
corepack enable pnpm
corepack pnpm -v
corepack pnpm install --frozen-lockfile

- name: Build the test-runner (using Node ${{ matrix.node-version }})
run: bin/test.sh

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
with:
install: true

- name: Build Docker image and store in cache
uses: docker/build-push-action@4f7cdeb0f05278b464e71357394bf2c61f94138e
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: .
push: false
Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/pr.ci.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ jobs:
- name: Checkout PR
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Use Node.js LTS (18.x)
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
- name: Use Node.js LTS
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 18.x
node-version-file: .nvmrc

- name: Install project dependencies
run: yarn install --immutable
run: |
corepack enable pnpm
corepack pnpm -v
corepack pnpm install --frozen-lockfile

- name: Run exercism/javascript ci precheck (lint code)
run: bin/lint.sh
Expand All @@ -29,30 +32,33 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- name: Checkout PR
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install project dependencies
run: yarn install --immutable
run: |
corepack enable pnpm
corepack pnpm -v
corepack pnpm install --frozen-lockfile

- name: Build the test-runner (using Node ${{ matrix.node-version }})
run: bin/test.sh

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
with:
install: true

- name: Build Docker image and store in cache
uses: docker/build-push-action@4f7cdeb0f05278b464e71357394bf2c61f94138e
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: .
push: false
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/verify-code-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,15 @@ jobs:
- name: 'Checkout code'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

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

- name: Enable pnpm
run: |
corepack enable pnpm
corepack pnpm -v

- name: 'Verify formatting of all files'
run: ./bin/check-formatting.sh
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node-linker=hoisted
symlink=false
prefer-symlinked-executables=false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/*
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.0.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions .yarnrc.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 5.0.0

- Update dependencies including core-js
- Switch to pnpm
- Rework `run.sh` for console friendly output
- Use ESLint 9 (Flat Config)

## 4.0.0

- Update dependencies including core-js
Expand Down
46 changes: 35 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:18-bullseye-slim as runner
# Node.js 18 (curently LTS)
# Debian bullseye
FROM node:20-bookworm-slim AS runner
# Node.js 20 (curently LTS)
# Debian bookwork

# fetch latest security updates
RUN set -ex; \
Expand All @@ -18,17 +18,41 @@ RUN adduser --disabled-password --gecos "" appuser
WORKDIR /opt/test-runner
COPY . .

# Install pnpm so it will be available read-only
# https://github.com/nodejs/corepack/issues/183#issue-1379672431
# https://github.com/nodejs/corepack/blob/bc13d40037d0b1bfd386e260ae741f55505b5c7c/tests/main.test.ts#L483
RUN mkdir -p /idk/corepack
ENV COREPACK_HOME=/idk/corepack

RUN set -ex; \
corepack enable pnpm; \
# corepack pack -o ./corepack.tgz; \
# COREPACK_ENABLE_NETWORK=0 corepack install -g ./corepack.tgz;
#
# https://github.com/nodejs/corepack/pull/446#issue-2218976611
corepack install; \
corepack pnpm --version; \
#
# https://github.com/nodejs/corepack/issues/414#issuecomment-2096218732
# https://github.com/nodejs/corepack/blob/bc13d40037d0b1bfd386e260ae741f55505b5c7c/sources/folderUtils.ts#L26-L31
chmod 444 /idk/corepack/lastKnownGood.json; \
chmod 555 /idk/corepack;

# Build the test runner
RUN set -ex; \
# install all the development modules (used for building)
yarn plugin import workspace-tools; \
yarn install; \
yarn build; \
rm -rf node_modules; \
# install only the node_modules we need for production
yarn workspaces focus --production; \
# clean our yarn cache
yarn cache clean;
# corepack pnpm store prune; \
corepack pnpm install; \
corepack pnpm build; \
corepack pnpm prune --prod;

# Disable network for corepack
ENV COREPACK_ENABLE_NETWORK=0
ENV COREPACK_ENABLE_STRICT=0

# Mark this as a docker run so we don't try to execute things in /tmp
ENV TMP_MAY_BE_NON_EXEC=1

# Execute everything as the appuser
USER appuser
ENTRYPOINT [ "/opt/test-runner/bin/run.sh" ]
Loading
Loading