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

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

Merged
merged 7 commits into from
Jul 4, 2024
Merged
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -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
17 changes: 9 additions & 8 deletions .github/workflows/mjolnir.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -23,5 +23,5 @@ repos:
hooks:
- id: yarn-lint
name: linter
entry: yarn lint --cache
entry: corepack yarn lint --cache --quiet
language: system
6 changes: 3 additions & 3 deletions mx-tester.yml
Original file line number Diff line number Diff line change
@@ -7,16 +7,16 @@ 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
- until curl localhost:9999 --stderr /dev/null > /dev/null; do echo "Waiting for Synapse..."; sleep 1s; done
- echo "Synapse is ready"

run:
- yarn test:integration
- corepack yarn test:integration

down:
finally:
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
Loading