|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + schedule: |
| 11 | + - cron: '0 2 * * 1' # At 02:00 on Monday |
| 12 | + |
| 13 | +permissions: {} |
| 14 | + |
| 15 | +jobs: |
| 16 | + test: |
| 17 | + name: Test |
| 18 | + runs-on: ubuntu-latest |
| 19 | + timeout-minutes: 15 |
| 20 | + # services: |
| 21 | + # mssql: |
| 22 | + # image: mcr.microsoft.com/mssql/server:2019-latest |
| 23 | + # env: |
| 24 | + # ACCEPT_EULA: 'Y' |
| 25 | + # ports: |
| 26 | + # - 1433:1433 |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + node-version: [10, 12, 14, 16, 17] |
| 30 | + # mongodb-version: [4.4] |
| 31 | + fail-fast: false |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v2 |
| 34 | + - name: Use Node.js ${{ matrix.node-version }} |
| 35 | + uses: actions/setup-node@v1 |
| 36 | + with: |
| 37 | + node-version: ${{ matrix.node-version }} |
| 38 | + - uses: Yuri6037/[email protected] |
| 39 | + - name: Setup database |
| 40 | + run: faketty ./setup.sh |
| 41 | + - name: Bootstrap project |
| 42 | + run: npm ci --ignore-scripts |
| 43 | + - name: Update NPM (Node.js v10) |
| 44 | + if: matrix.node-version == 10 |
| 45 | + run: npm install --global npm@7 |
| 46 | + - name: Update NPM |
| 47 | + if: matrix.node-version != 10 |
| 48 | + run: npm install --global npm@8 |
| 49 | + - name: Run tests |
| 50 | + run: npm test --ignore-scripts |
| 51 | + - name: Publish coverage report to Coveralls |
| 52 | + uses: coverallsapp/github-action@master |
| 53 | + with: |
| 54 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }} |
| 56 | + path-to-lcov: ${{ github.workspace }}/coverage/lcov.info |
| 57 | + parallel: true |
| 58 | + |
| 59 | + posttest: |
| 60 | + name: Post-Test |
| 61 | + needs: test |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - name: Coveralls finished |
| 65 | + uses: coverallsapp/github-action@master |
| 66 | + with: |
| 67 | + github-token: ${{ secrets.github_token }} |
| 68 | + parallel-finished: true |
| 69 | + |
| 70 | + code-lint: |
| 71 | + name: Code Lint |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v2 |
| 75 | + - name: Use Node.js 16 |
| 76 | + uses: actions/setup-node@v2 |
| 77 | + with: |
| 78 | + node-version: 16 |
| 79 | + - name: Bootstrap project |
| 80 | + run: npm ci --ignore-scripts |
| 81 | + - name: Verify code linting |
| 82 | + run: npm run lint |
| 83 | + |
| 84 | + commit-lint: |
| 85 | + name: Commit Lint |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v2 |
| 89 | + with: |
| 90 | + fetch-depth: 0 |
| 91 | + - name: Use Node.js 16 |
| 92 | + uses: actions/setup-node@v2 |
| 93 | + with: |
| 94 | + node-version: 16 |
| 95 | + - name: Bootstrap project |
| 96 | + run: npm ci --ignore-scripts |
| 97 | + - name: Verify commit linting |
| 98 | + run: npx --no-install commitlint --from origin/master --to HEAD --verbose |
| 99 | + |
| 100 | + codeql: |
| 101 | + name: CodeQL |
| 102 | + runs-on: ubuntu-latest |
| 103 | + permissions: |
| 104 | + # See: https://github.com/github/codeql-action/blob/008b2cc71c4cf3401f45919d8eede44a65b4a322/README.md#usage |
| 105 | + security-events: write |
| 106 | + steps: |
| 107 | + - name: Checkout repository |
| 108 | + uses: actions/checkout@v2 |
| 109 | + |
| 110 | + - name: Initialize CodeQL |
| 111 | + uses: github/codeql-action/init@v1 |
| 112 | + with: |
| 113 | + languages: 'javascript' |
| 114 | + config-file: ./.github/codeql/codeql-config.yml |
| 115 | + |
| 116 | + - name: Perform CodeQL Analysis |
| 117 | + uses: github/codeql-action/analyze@v1 |
0 commit comments