Fix #83 eslint 9.0 config #123
Workflow file for this run
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
# mongotools continuous integration | |
name: mongotools-ci | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the prod branch | |
push: | |
branches: [ npmjs ] | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
node-version: [16.x] | |
services: | |
mongodb: | |
image: mongo:4.2.11 | |
ports: | |
- 27017:27017 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
# npx force-resolutions : in case of Permission denied: run it locally to fix package-lock.json | |
run: | | |
echo "install" | |
npm run preinstall | |
npm install | |
echo "show outdated (if any)" | |
npm outdated --depth=3 || echo "you must think about update your dependencies :)" | |
- name: Setup mongo tools # add mongosh and mongodump/mongorestore | |
uses: boly38/action-mongo-tools@stable | |
- name: Setup mongo user | |
# doc: https://docs.mongodb.com/manual/reference/built-in-roles/ "Backup and Restoration Roles" | |
# doc: https://docs.mongodb.com/manual/reference/method/db.createUser/ | |
run: mongosh admin --eval 'db.createUser({user:"root",pwd:"mypass",roles:[{"role":"readWrite","db":"myDbForTest"}, "restore"]});' | |
- name: Run tests | |
env: | |
MT_MONGO_USER: root | |
MT_MONGO_PWD: mypass | |
run: npm run ci-test | |
- name: Report coverage | |
continue-on-error: true | |
uses: romeovs/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
lcov-file: ./coverage/lcov.info | |
- name: Npm audit | |
uses: oke-py/npm-audit-action@v2 | |
with: | |
audit_level: moderate | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
dedupe_issues: true | |
production_flag: true | |
- name: Publish NpmJS package | |
if: github.ref == 'refs/heads/npmjs' | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_DEPLOY_TOKEN }}" > .npmrc | |
npm whoami # rely on .npmrc | |
npm publish |