[Yarn Classic] Enable corepack & fix pre-commit run --all-files (#472)

* Setup Yarn Classic through Corepack

* pre-commit: use corepack and silence warnings, add .eslintignore's

* .github/workflows/mjolnir.yml: use yarn through corepack

* mx-tester.yml: use corepack

* mx-tester.yml & package.json: replace references to npx and call corepack more

At least yarn build didn't break locally for me, so I think it's supported here too

* rm & gitignore .yarnrc

* mx-tester.yml & package.json: return to npx since yarn dlx doesn't exist in classic
This commit is contained in:
Aminda Suomalainen ⚧
2024-07-04 11:22:33 +01:00
committed by GitHub
parent 7f01383974
commit 8587280cdc
6 changed files with 38 additions and 17 deletions
+14
View File
@@ -1,3 +1,17 @@
lib/
node_modules/
.eslintrc.js
# pre-commit run --all-files
*.conf
Dockerfile
*.gif
*.json
LICENSE
*.lock
*.md
NOTICE
*.py
*.sh
*.yaml
*.yml
+9 -8
View File
@@ -21,9 +21,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '18'
- run: yarn install
- run: yarn build
- run: yarn lint
- run: corepack enable
- run: corepack yarn install
- run: corepack yarn build
- run: corepack yarn lint
unit:
name: Unit tests
runs-on: ubuntu-latest
@@ -33,8 +34,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '18'
- run: yarn install
- run: yarn test
- run: corepack yarn install
- run: corepack yarn test
integration:
name: Integration tests
runs-on: ubuntu-latest
@@ -52,7 +53,7 @@ jobs:
- name: Setup image
run: RUST_LOG=debug,hyper=info,rusttls=info mx-tester build up
- name: Setup dependencies
run: yarn install
run: corepack yarn install
- name: Run tests
run: RUST_LOG=debug,hyper=info,rusttls=info mx-tester run
- name: Cleanup
@@ -74,8 +75,8 @@ jobs:
- name: Setup image
run: RUST_LOG=debug,hyper=info,rusttls=info mx-tester build up
- name: Setup dependencies
run: yarn install
run: corepack yarn install
- name: Run tests
run: yarn test:appservice:integration
run: corepack yarn test:appservice:integration
- name: Cleanup
run: mx-tester down
+5
View File
@@ -77,3 +77,8 @@ mjolnir.egg-info/
# VS
.vs
# Yarn versions through corepack
.yarn
# Only contains possibly broken path, replaced by .yarnrc.yml in modern Yarn
.yarnrc
+1 -1
View File
@@ -23,5 +23,5 @@ repos:
hooks:
- id: yarn-lint
name: linter
entry: yarn lint --cache
entry: corepack yarn lint --cache --quiet
language: system
+3 -3
View File
@@ -7,8 +7,8 @@ up:
- until psql postgres://mjolnir-tester:mjolnir-test@127.0.0.1:8083/mjolnir-test-db -c ""; do echo "Waiting for psql..."; sleep 1s; done
# Launch the reverse proxy, listening for connections *only* on the local host.
- docker run --rm --network host --name mjolnir-test-reverse-proxy -p 127.0.0.1:8081:80 -v $MX_TEST_CWD/test/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
- yarn install
- npx ts-node src/appservice/cli.ts -r -u "http://host.docker.internal:9000"
- corepack yarn install
- corepack npx ts-node src/appservice/cli.ts -r -u "http://host.docker.internal:9000"
- cp mjolnir-registration.yaml $MX_TEST_SYNAPSE_DIR/data/
after:
# Wait until Synapse is ready
@@ -16,7 +16,7 @@ up:
- echo "Synapse is ready"
run:
- yarn test:integration
- corepack yarn test:integration
down:
finally:
+6 -5
View File
@@ -9,16 +9,16 @@
"private": true,
"scripts": {
"build": "tsc --project test/tsconfig.json && tsc > /dev/null 2>&1",
"postbuild": "yarn describe-version",
"postbuild": "corepack yarn describe-version",
"describe-version": "(git describe > version.txt.tmp && mv version.txt.tmp version.txt) || true && rm -f version.txt.tmp",
"remove-tests-from-lib": "rm -rf lib/test/ && cp -r lib/src/* lib/ && rm -rf lib/src/",
"lint": "eslint -c .eslintrc.js src/**/*.ts test/**/*.ts src/**/*.tsx",
"start:dev": "yarn build && node --async-stack-traces lib/index.js",
"start:dev": "corepack yarn build && node --async-stack-traces lib/index.js",
"test": "ts-mocha --project ./tsconfig.json test/commands/**/*.ts",
"test:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --forbid-only --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json \"test/integration/**/*Test.ts\"",
"test:integration:single": "NODE_ENV=harness npx ts-mocha --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json",
"test:integration:single": "NODE_ENV=harness corepack npx ts-mocha --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json",
"test:appservice:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --forbid-only --timeout 300000 --project ./tsconfig.json \"test/appservice/integration/**/*Test.ts\"",
"test:appservice:integration:single": "NODE_ENV=harness npx ts-mocha --timeout 300000 --project ./tsconfig.json",
"test:appservice:integration:single": "NODE_ENV=harness corepack npx ts-mocha --timeout 300000 --project ./tsconfig.json",
"test:manual": "NODE_ENV=harness ts-node test/integration/manualLaunchScript.ts",
"version": "sed -i '/# version automated/s/[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][^\"]*/'$npm_package_version'/' synapse_antispam/setup.py && git add synapse_antispam/setup.py && cat synapse_antispam/setup.py"
},
@@ -77,5 +77,6 @@
},
"engines": {
"node": ">=18.0.0"
}
},
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
}