Skip to content

Commit

Permalink
Split Pipeline jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
clementguillot committed Feb 6, 2024
1 parent f1c3488 commit 541859e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
30 changes: 30 additions & 0 deletions .github/actions/shared-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Shared Setup'
description: 'Shared setup steps for CI jobs'

inputs:
task-type:
description: 'Task type (build, test, lint)'
required: true

runs:
using: 'composite'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: graalvm/setup-graalvm@v1
with:
java-version: '21.0.2'
distribution: 'graalvm-community'

- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'

- run: npm ci

- uses: nrwl/nx-set-shas@v4

- run: npx nx affected -t=${{ inputs.task-type }}
27 changes: 13 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: CI
on:
push:
branches:
# Change this if your primary branch is not main
- main
pull_request:

Expand All @@ -12,21 +11,21 @@ permissions:
contents: read

jobs:
main:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./github/actions/shared-setup
with:
fetch-depth: 0
- uses: graalvm/setup-graalvm@v1
task-type: build
test:
runs-on: ubuntu-latest
steps:
- uses: ./github/actions/shared-setup
with:
java-version: '21.0.2'
distribution: 'graalvm-community'
# Cache node_modules
- uses: actions/setup-node@v3
task-type: test
lint:
runs-on: ubuntu-latest
steps:
- uses: ./github/actions/shared-setup
with:
node-version: 20
cache: 'npm'
- run: npm ci
- uses: nrwl/nx-set-shas@v4
- run: npx nx affected -t=lint,test,build
task-type: lint

0 comments on commit 541859e

Please sign in to comment.