|
| 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 | + strategy: |
| 21 | + matrix: |
| 22 | + node-version: [10, 12, 14, 16, 17, 18] |
| 23 | + db-image: |
| 24 | + - elasticsearch:7.17.3 |
| 25 | + - elasticsearch:8.2.0 |
| 26 | + - opensearchproject/opensearch:1.3.2 |
| 27 | + fail-fast: false |
| 28 | + services: |
| 29 | + db: |
| 30 | + image: ${{ matrix.db-image }} |
| 31 | + ports: ["9200:9200"] |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + - name: Use Node.js ${{ matrix.node-version }} |
| 35 | + uses: actions/setup-node@v3 |
| 36 | + with: |
| 37 | + node-version: ${{ matrix.node-version }} |
| 38 | + - name: Bootstrap project |
| 39 | + run: npm ci --ignore-scripts |
| 40 | + - name: Run tests |
| 41 | + run: npm test |
| 42 | + - name: Publish coverage report to Coveralls |
| 43 | + uses: coverallsapp/github-action@master |
| 44 | + with: |
| 45 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + flag-name: run-es@${{ matrix.db-version }}-node@${{ matrix.node-version }} |
| 47 | + parallel: true |
| 48 | + |
| 49 | + posttest: |
| 50 | + name: Post-Test |
| 51 | + needs: test |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: Coveralls finished |
| 55 | + uses: coverallsapp/github-action@master |
| 56 | + with: |
| 57 | + github-token: ${{ secrets.github_token }} |
| 58 | + parallel-finished: true |
| 59 | + |
| 60 | + code-lint: |
| 61 | + name: Code Lint |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v3 |
| 65 | + - name: Use Node.js 16 |
| 66 | + uses: actions/setup-node@v3 |
| 67 | + with: |
| 68 | + node-version: 16 |
| 69 | + - name: Bootstrap project |
| 70 | + run: npm ci --ignore-scripts |
| 71 | + - name: Verify code linting |
| 72 | + run: npm run lint |
| 73 | + |
| 74 | + commit-lint: |
| 75 | + name: Commit Lint |
| 76 | + runs-on: ubuntu-latest |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v3 |
| 79 | + with: |
| 80 | + fetch-depth: 0 |
| 81 | + - name: Use Node.js 16 |
| 82 | + uses: actions/setup-node@v3 |
| 83 | + with: |
| 84 | + node-version: 16 |
| 85 | + - name: Bootstrap project |
| 86 | + run: npm ci --ignore-scripts |
| 87 | + - name: Verify commit linting |
| 88 | + run: | |
| 89 | + npm exec \ |
| 90 | + --no-install \ |
| 91 | + --package=@commitlint/cli \ |
| 92 | + -- \ |
| 93 | + commitlint \ |
| 94 | + --verbose \ |
| 95 | + --from=origin/master \ |
| 96 | + --to=HEAD |
| 97 | +
|
| 98 | + codeql: |
| 99 | + name: CodeQL |
| 100 | + runs-on: ubuntu-latest |
| 101 | + permissions: |
| 102 | + # See: https://github.com/github/codeql-action/blob/008b2cc71c4cf3401f45919d8eede44a65b4a322/README.md#usage |
| 103 | + security-events: write |
| 104 | + steps: |
| 105 | + - name: Checkout repository |
| 106 | + uses: actions/checkout@v3 |
| 107 | + |
| 108 | + - name: Initialize CodeQL |
| 109 | + uses: github/codeql-action/init@v1 |
| 110 | + with: |
| 111 | + languages: 'javascript' |
| 112 | + config-file: ./.github/codeql/codeql-config.yml |
| 113 | + |
| 114 | + - name: Perform CodeQL Analysis |
| 115 | + uses: github/codeql-action/analyze@v1 |
0 commit comments