Skip to content

Commit

Permalink
chore: Cleanup workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
manferlo81 committed Nov 13, 2024
1 parent 8f0de16 commit 252c00f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:

workflow_dispatch:

env:
DEFAULT_NODE_VERSION: 20

jobs:
job_lint_and_test:
name: Lint, Test and Build
Expand All @@ -29,15 +26,17 @@ jobs:
needs: job_lint_and_test

steps:
- name: Checkout, Setup Node.js v${{ env.DEFAULT_NODE_VERSION }} and Install dependencies
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x

- name: Run tests
run: npm test
env:
CI: true
COVERAGE: CI

- name: Upload coverage
uses: codecov/codecov-action@v4
Expand All @@ -56,10 +55,12 @@ jobs:
contents: write

steps:
- name: Checkout, Setup Node.js v${{ env.DEFAULT_NODE_VERSION }} and Install dependencies
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x

- name: Build
run: npm run build
Expand All @@ -80,11 +81,13 @@ jobs:
needs: job_lint_and_test

steps:
- name: Checkout, Setup Node.js v${{ env.DEFAULT_NODE_VERSION }} and Install dependencies
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
env:
NODE_VERSION: 20.x

- name: Build
run: npm run build
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/lint-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Lint, Test and Build
on:
workflow_call:

env:
DEFAULT_NODE_VERSION: 20


jobs:
job_lint:
Expand All @@ -13,10 +12,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout, Setup Node.js v${{ env.DEFAULT_NODE_VERSION }} and Install dependencies
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x

- name: Lint code
run: npm run lint
Expand All @@ -29,13 +30,13 @@ jobs:
machine: windows-latest
- name: Ubuntu
machine: ubuntu-latest
- name: MacOS
- name: macOS
machine: macos-latest
node-version:
- 18
- 20
- 21
- 22
- 18.x
- 20.x
- 21.x
- 22.x

name: Test and Build (${{ matrix.os.name }}, NodeJS v${{ matrix.node-version }})

Expand All @@ -51,7 +52,7 @@ jobs:
- name: Run tests
run: npm test
env:
SKIP_COVERAGE: true
COVERAGE: SKIP

- name: Build
run: npm run build
6 changes: 4 additions & 2 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
const { COVERAGE } = process.env;

/** @type { import("jest").Config } */
const config = {
cacheDirectory: 'node_modules/.cache/jest',
preset: 'ts-jest',

collectCoverage: !process.env.SKIP_COVERAGE,
collectCoverage: COVERAGE !== 'SKIP',
collectCoverageFrom: [
'src/**/*.ts',
],
coverageDirectory: 'coverage',
coverageReporters: process.env.CI
coverageReporters: COVERAGE === 'CI'
? ['json', 'clover', 'cobertura']
: ['html', 'text'],

Expand Down

0 comments on commit 252c00f

Please sign in to comment.