Skip to content

Commit

Permalink
chore: Extract lint, test and build to another workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
manferlo81 committed Nov 11, 2024
1 parent b84a9a3 commit 3ae7b9f
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 49 deletions.
63 changes: 14 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,21 @@ on:
tags:
- v*.*.*

jobs:
job_lint:
name: Lint

runs-on: ubuntu-latest

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

- name: Lint
run: npm run lint

job_test_and_build:
strategy:
matrix:
os:
- name: Ubuntu
image: ubuntu-latest
node-version:
- 18.x
- 20.x

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

runs-on: ${{ matrix.os.image }}
needs: job_lint

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

- name: Test
run: npm test
env:
SKIP_COVERAGE: true
pull_request:
branches:
- main

- name: Build
run: npm run build
jobs:
job_lint_test_build:
name: Lint, Test and Build
uses: './.github/workflows/lint-test-build.yml'

job_upload_coverage:
name: Upload Coverage

runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_type == 'branch'
needs: job_test_and_build
needs: job_lint_test_build

steps:
- run: echo "not implemented yet..."
Expand All @@ -68,16 +31,18 @@ jobs:

runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: job_test_and_build
needs: job_lint_test_build

permissions:
contents: write

steps:
- name: Checkout, Setup Node.js v20.x 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: 20.x
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x

- name: Build
run: npm run build
Expand All @@ -95,7 +60,7 @@ jobs:

runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: job_test_and_build
needs: job_lint_test_build

steps:
- run: echo "not implemented yet..."
56 changes: 56 additions & 0 deletions .github/workflows/lint-test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Lint, Test and Build

on:
workflow_call:

jobs:
job_lint:
name: Lint

runs-on: ubuntu-latest

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

- name: Lint
run: npm run lint

job_test_and_build:
strategy:
matrix:
os:
- name: Window
image: windows-latest
- name: Ubuntu
image: ubuntu-latest
- name: macOS
image: macos-latest
node-version:
- 18.x
- 20.x
- 21.x
- 22.x

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

runs-on: ${{ matrix.os.image }}
needs: job_lint

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

- name: Test
run: npm test
env:
SKIP_COVERAGE: true

- name: Build
run: npm run build

0 comments on commit 3ae7b9f

Please sign in to comment.