From bb9c2e02689461e313a4bbd38fd0b33a2ecaee6c Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Thu, 14 Mar 2024 17:34:45 +0100 Subject: [PATCH] CI: Test reusable actions --- .github/workflows/CI.yml | 7 ++++++ .github/workflows/build.yml | 47 +++++++++++++++++-------------------- .github/workflows/tests.yml | 31 +++++++++++------------- 3 files changed, 43 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..8373557 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,7 @@ +on: [push, workflow_dispatch] + +jobs: + run-tests: + uses: ./.github/workflows/tests.yml + build: + uses: ./.github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d04c4e..067549b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,26 +1,23 @@ -name: 'Run tests' +name: 'Build' -on: [push, workflow_dispatch] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup node - uses: actions/setup-node@v4 - with: - # TODO: add version to a .nvmrc or at least a variable - node-version: 18.12.1 - cache: npm - - name: Install - run: npm ci - - name: Build - run: npm run build - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: lib-${{ github.sha }} - path: ./dist - if-no-files-found: error +runs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: +# TODO: add version to a .nvmrc or at least a variable + node-version: 18.12.1 + cache: npm + - name: Install + run: npm ci + - name: Build + run: npm run build + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: lib-${{ github.sha }} + path: ./dist + if-no-files-found: error diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c4b8e05..32bbc4a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,20 +1,17 @@ name: 'Run tests' -on: [push, workflow_dispatch] - -jobs: - run-tests: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup node - uses: actions/setup-node@v4 - with: +runs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: # TODO: add version to a .nvmrc or at least a variable - node-version: 18.12.1 - cache: npm - - name: Install - run: npm ci --prefer-offline - - name: Run tests - run: npm run test:unit + node-version: 18.12.1 + cache: npm + - name: Install + run: npm ci --prefer-offline + - name: Run tests + run: npm run test:unit