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 4e3b660
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 12 deletions.
26 changes: 26 additions & 0 deletions .github/actions/shared-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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: 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 }}
32 changes: 20 additions & 12 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,30 @@ permissions:
contents: read

jobs:
main:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: graalvm/setup-graalvm@v1
- uses: ./github/actions/shared-setup@v1
with:
java-version: '21.0.2'
distribution: 'graalvm-community'
# Cache node_modules
- uses: actions/setup-node@v3
task-type: build
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./github/actions/shared-setup@v1
with:
task-type: test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./github/actions/shared-setup@v1
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 4e3b660

Please sign in to comment.