Skip to content

Commit

Permalink
ci: passing coverage from build step
Browse files Browse the repository at this point in the history
  • Loading branch information
rH4rtinger committed Oct 9, 2024
1 parent 380cfed commit 3307033
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,36 @@ jobs:
java-version: 21
distribution: temurin

- name: Restore cached node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ matrix.os }}-node-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
node_modules-${{ matrix.os }}-node-${{ matrix.node-version }}
- name: run e2e tests
run: xvfb-run -a npm run test:e2e -- --storage ./out/test-resources/${{ matrix.os }}/${{ matrix.node-version }}
if: runner.os == 'Linux'
if: runner.os == 'Linux' && matrix.node-version != '22.x'

- name: Install Mocha reporters
run: npm install -d mocha-multi-reporters mocha-junit-reporter mocha-sonarqube-reporter
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x'
- name: create mocha config
run: |
echo '{
"reporterEnabled": "spec, mocha-junit-reporter, mocha-sonarqube-reporter"
}' > config.json
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x'
- name: Run tests with coverage
run: xvfb-run -a npm test -- --coverage --coverage-output ./coverage --coverage-reporter lcovonly --reporter mocha-multi-reporters --reporter-options configFile=config.json
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x'

- name: Upload coverage as artifact
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/lcov.info

- name: npm e2e tests
run: npm run test:e2e -- --storage ./out/test-resources/${{ matrix.os }}/${{ matrix.node-version }}
Expand Down Expand Up @@ -115,15 +142,11 @@ jobs:
- name: Run ESLint
run: npm run lint -- --format json --output-file eslint-results.json || true

- name: Install Mocha reporters
run: npm install -d mocha-multi-reporters mocha-junit-reporter mocha-sonarqube-reporter
- name: create mocha config
run: |
echo '{
"reporterEnabled": "spec, mocha-junit-reporter, mocha-sonarqube-reporter"
}' > config.json
- name: Run tests with coverage
run: xvfb-run -a npm test -- --coverage --coverage-output ./coverage --coverage-reporter lcovonly --reporter mocha-multi-reporters --reporter-options configFile=config.json
- name: Download node_modules artifact
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage/lcov.info

- name: Analyze with SonarCloud
uses: SonarSource/sonarcloud-github-action@master
Expand Down

0 comments on commit 3307033

Please sign in to comment.