|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: ci |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the "main" branch |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - '**' |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - 'master' |
| 14 | + |
| 15 | + # Allows you to run this workflow manually from the Actions tab |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 19 | +jobs: |
| 20 | + build-test: |
| 21 | + # The type of runner that the job will run on |
| 22 | + runs-on: ubuntu-latest |
| 23 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 24 | + steps: |
| 25 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 26 | + - uses: actions/checkout@v3 |
| 27 | + - name: Setup Node.js environment |
| 28 | + uses: actions/setup-node@v3 |
| 29 | + with: |
| 30 | + node-version: 18 |
| 31 | + - name: Install dependencies |
| 32 | + run: | |
| 33 | + npm install |
| 34 | + - name: Run tests |
| 35 | + run: | |
| 36 | + npm test |
| 37 | + - name: Run Snyk to check for vulnerabilities |
| 38 | + uses: snyk/actions/node@master |
| 39 | + env: |
| 40 | + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} |
| 41 | + with: |
| 42 | + args: --severity-threshold=high |
| 43 | + build-test-monitor: |
| 44 | + if: github.ref == 'refs/heads/master' |
| 45 | + runs-on: ubuntu-latest |
| 46 | + needs: build-test |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v3 |
| 49 | + - name: Setup Node.js environment |
| 50 | + uses: actions/setup-node@v3 |
| 51 | + with: |
| 52 | + node-version: 18 |
| 53 | + - name: Install dependencies |
| 54 | + run: | |
| 55 | + npm install semantic-release @semantic-release/exec pkg --save-dev |
| 56 | + npm install |
| 57 | + - name: Run Snyk to check for vulnerabilities |
| 58 | + uses: snyk/actions/node@master |
| 59 | + env: |
| 60 | + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} |
| 61 | + with: |
| 62 | + args: --org=cse-snyk-labs |
| 63 | + command: monitor |
0 commit comments