Skip to content

Commit

Permalink
[OGUI-1570] Update QC GH workflows to run lint first and only after c…
Browse files Browse the repository at this point in the history
…overage and tests (#2655)

* splits the run of lint and test together
* splits the test command and coverage as it was by mistake running the tests twice
* ensures first `lint-check` is ran and passes. Only after, the test and coverage jobs are triggered. This will ensure less resources are used by GH Actions if lint fails
  • Loading branch information
graduta authored Nov 14, 2024
1 parent c6ff6d5 commit cd86bd3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
39 changes: 26 additions & 13 deletions .github/workflows/qc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,44 @@ on:
- 'dev'

jobs:
lint-check:
name: Check eslint rules on ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: (cd QualityControl; npm ci )
- run: (cd QualityControl; npm run lint )
test:
name: Tests on ubuntu-latest
name: Tests on ubuntu-latest only if lint-check passes
runs-on: ubuntu-latest
needs: lint-check
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: (cd QualityControl; npm ci )
- run: (cd QualityControl; npm run test )
coverage:
name: Tests and generate lcov reoprt coverage on ubuntu-latest
runs-on: ubuntu-latest
needs: lint-check
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: (cd QualityControl; npm ci )
- run: (cd QualityControl; npm run coverage )
- run: (cd QualityControl; npm run coverage-lcov )
- name: Send codecov report for QualityControl
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: qualitycontrol
fail_ci_if_error: true
#coverage: Job is currently disabled due to known issue with node-gyp on GH runners
# name: Tests & coverage on macOS-latest
# runs-on: macOS-latest
# steps:
# - uses: actions/checkout@v4
# - name: Setup node
# uses: actions/setup-node@v4
# with:
# node-version: '20.x'
# - run: (cd QualityControl; npm ci )
# - run: (cd QualityControl; npm run test)
8 changes: 4 additions & 4 deletions QualityControl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"scripts": {
"start": "node index.js",
"dev": "nodemon --watch index.js --watch lib --watch config.js index.js",
"eslint": "./node_modules/.bin/eslint --config eslint.config.js lib public",
"coverage": "npm run test && node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage.lcov test/test-index.js",
"node-test": "node --test test/test-index.js",
"test": "npm run eslint && npm run node-test"
"lint": "./node_modules/.bin/eslint --config eslint.config.js lib public",
"coverage-lcov": "node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage.lcov test/test-index.js",
"coverage-local": "node --test --experimental-test-coverage --test-reporter=spec test/test-index.js",
"test": "node --test test/test-index.js"
},
"files": [
"common/",
Expand Down

0 comments on commit cd86bd3

Please sign in to comment.