From fe396434be99f2716c0b5a8aab9ae2f928d87bd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Guillot?= Date: Tue, 6 Feb 2024 16:20:08 +0100 Subject: [PATCH] Split Pipeline jobs --- .github/actions/shared-setup/action.yaml | 26 +++++++++++++++++++ .github/workflows/ci.yml | 32 +++++++++++++++--------- 2 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 .github/actions/shared-setup/action.yaml diff --git a/.github/actions/shared-setup/action.yaml b/.github/actions/shared-setup/action.yaml new file mode 100644 index 00000000..fae37c6b --- /dev/null +++ b/.github/actions/shared-setup/action.yaml @@ -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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7642b6b8..505e2944 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,6 @@ name: CI on: push: branches: - # Change this if your primary branch is not main - main pull_request: @@ -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