chore(deps): update dependency standard to v17 #7153
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
name: Node.js CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * 0' # weekly | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
name: Node.js ${{ matrix.node-version }} | |
strategy: | |
matrix: | |
node-version: [20.x, 22.x] | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PORT: 3306 | |
DB_USER: root | |
DB_PASSWORD: root | |
ENCRYPTION_KEY: b097b390a68441cc3bb151dd0171f25c3aabc688c50eeb26dc5e13254b333911 | |
SESSION_KEY: a73545a5f08d2906e39a4438014200303f9269f3ade9227525ffb141294f1b62 | |
DB_CONNECTION_LIMIT: 5 | |
SERVER_FOOTER_NAME: BanManagement | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
- run: npm ci | |
- name: Set up MySQL | |
run: | | |
sudo systemctl start mysql.service | |
sleep 5 && mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';" -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} | |
- run: npm run lint | |
# Temporary work around jest memory leaks https://github.com/facebook/jest/issues/11956 | |
- run: | | |
shopt -s globstar | |
set -e | |
for x in server/test/*.test.js; do (node --expose-gc ./node_modules/.bin/jest "$x" && sh -c 'mv coverage/coverage-final.json "coverage/$(basename "$1" .js).json"' sh "$x") || exit 1; done | |
for x in cli/test/*.test.js; do (node --expose-gc ./node_modules/.bin/jest "$x" && sh -c 'mv coverage/coverage-final.json "coverage/$(basename "$1" .js).json"' sh "$x") || exit 1; done | |
npx nyc merge coverage coverage-final.json | |
rm -rf coverage | |
mkdir coverage | |
mv coverage-final.json coverage/coverage-final.json | |
npx nyc report -t coverage --reporter=lcov --report-dir=coverage | |
env: | |
DB_PASSWORD: | |
LOG_LEVEL: warn | |
PORT: 3001 | |
- name: Cypress run | |
uses: cypress-io/github-action@v2 | |
env: | |
DB_PASSWORD: | |
DB_NAME: bm_e2e_tests | |
LOG_LEVEL: warn | |
PORT: 3000 | |
NODE_ENV: production | |
ADMIN_USERNAME: '[email protected]' | |
ADMIN_PASSWORD: 'P%@#fjdVJ3Y%pdGR' | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
CONTACT_EMAIL: '[email protected]' | |
NOTIFICATION_VAPID_PUBLIC_KEY: ${{ secrets.NOTIFICATION_VAPID_PUBLIC_KEY }} | |
NOTIFICATION_VAPID_PRIVATE_KEY: ${{ secrets.NOTIFICATION_VAPID_PRIVATE_KEY }} | |
with: | |
install: false | |
build: npm run e2e:build | |
start: npm start | |
wait-on: 'http://127.0.0.1:3000' | |
record: true | |
- name: Coveralls Parallel | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
flag-name: run-${{ matrix.test_number }} | |
parallel: true | |
build_docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: docker build . # TODO cache | |
finish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.github_token }} | |
parallel-finished: true |