|
| 1 | +# This action runs lint checks and tests against the code. |
| 2 | +name: Check and Test |
| 3 | + |
| 4 | +# Controls when the action will run. |
| 5 | +on: |
| 6 | + # Triggers the workflow on pushes to master and pull requests for any branch |
| 7 | + push: |
| 8 | + branches: [master] |
| 9 | + pull_request: |
| 10 | + |
| 11 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 12 | +jobs: |
| 13 | + check-and-test: |
| 14 | + name: Check and Test |
| 15 | + # The type of runner that the job will run on |
| 16 | + runs-on: ubuntu-20.04 |
| 17 | + |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + mongodb_version: [stable, unstable] |
| 21 | + |
| 22 | + env: |
| 23 | + MONGODB_VERSION: ${{ matrix.mongodb_version }} |
| 24 | + MONGODB_TOPOLOGY: standalone |
| 25 | + |
| 26 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 27 | + steps: |
| 28 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: Setup Node.js environment |
| 32 | + |
| 33 | + with: |
| 34 | + # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0 |
| 35 | + node-version: 12.4.0 |
| 36 | + |
| 37 | + - name: Cache node modules |
| 38 | + uses: actions/cache@v2 |
| 39 | + env: |
| 40 | + cache-name: cache-node-modules |
| 41 | + with: |
| 42 | + # npm cache files are stored in `~/.npm` on Linux/macOS |
| 43 | + path: ~/.npm |
| 44 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 47 | + ${{ runner.os }}-build- |
| 48 | + ${{ runner.os }}- |
| 49 | +
|
| 50 | + - name: Install Dependencies |
| 51 | + run: npm ci |
| 52 | + |
| 53 | + - name: Run Tests with Coverage |
| 54 | + run: npm run cover |
| 55 | + |
| 56 | + - name: Run Karma Tests |
| 57 | + run: npm run test:karma |
| 58 | + |
| 59 | + - name: Create Production Build |
| 60 | + run: npm run compile |
| 61 | + |
| 62 | + - name: Run Checks |
| 63 | + run: npm run check |
0 commit comments