Merge pull request #3838 from greenbone/add-processing-task-status #2485
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
name: Build and test JavaScript | |
on: | |
push: | |
branches: [ main, stable, oldstable ] | |
pull_request: | |
branches: [ main, stable, oldstable ] | |
jobs: | |
testing: | |
env: | |
REPORT_DIR: reports | |
name: Testing and upload coverage | |
runs-on: 'ubuntu-latest' | |
strategy: | |
matrix: | |
# 14.x is recommended by https://nodejs.org/en/ | |
node-version: [14.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# See: https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
- name: Get Yarn cache directory | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Use Yarn cache | |
uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} | |
# `--prefer-offline` gives cache priority | |
- name: Install dependencies | |
run: yarn install --prefer-offline | |
- name: Run JavaScript tests | |
env: | |
JEST_JUNIT_OUTPUT_DIR: ${{ env.REPORT_DIR }} | |
run: yarn test:coverage --reporters=default --reporters=jest-junit | |
- name: Load Lint Results | |
uses: actions/download-artifact@v3 | |
with: | |
name: linting-report | |
path: ${{ env.REPORT_DIR }} | |
- name: Submit test coverage to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false | |
linting: | |
env: | |
REPORT_FILE: linting-report.xml | |
name: Linting | |
runs-on: 'ubuntu-latest' | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# See: https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
- name: Get Yarn cache directory | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Use Yarn cache | |
uses: actions/cache@v3 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} | |
# `--prefer-offline` gives cache priority | |
- name: Install dependencies | |
run: yarn install --prefer-offline | |
- name: Lint JavaScript files | |
run: yarn lint --format junit -o ${{ env.REPORT_FILE }} | |
- name: Store Lint Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linting-report | |
path: ${{ env.REPORT_FILE }} |