From 541859ea754984d14db3bc2ab8c5a20d5f78eaf6 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.yaml | 30 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 27 +++++++++++++-------------- 2 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 .github/actions/shared-setup.yaml diff --git a/.github/actions/shared-setup.yaml b/.github/actions/shared-setup.yaml new file mode 100644 index 00000000..e9a0f63a --- /dev/null +++ b/.github/actions/shared-setup.yaml @@ -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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7642b6b8..a8b0aa14 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,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