From 8a91e1a2edfeeaaded4f6be20adbefb0e04a0577 Mon Sep 17 00:00:00 2001 From: Daniel Emery Date: Fri, 22 Sep 2023 19:39:58 +0200 Subject: [PATCH] #43 Split build and test jobs and tidy --- .github/workflows/build-and-test.yaml | 62 +++++++++++++++++++++++++++ .github/workflows/test.yaml | 42 ------------------ 2 files changed, 62 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/build-and-test.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 0000000..bc105d5 --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,62 @@ +name: Build and test + +on: + push: + branches: ['main'] + pull_request: + branches: ['main'] + +permissions: + contents: read + +env: + NODE_VERSION: 18.17.1 + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure node + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install packages + run: npm ci + + - name: Build + run: npm run build + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: | + dist + prisma + Dockerfile + .dockerignore + package*.json + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure node + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install packages + run: npm ci + + - name: Lint + run: npm run lint + + - name: Run unit tests + run: npm t diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 36e0cb7..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,42 +0,0 @@ -name: Test - -on: - push: - branches: ['main'] - pull_request: - branches: ['main'] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - container: - image: cimg/node:18.17.1 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install packages - run: npm ci - - - name: Lint - run: npm run lint - - - name: Run unit tests - run: npm t - - - name: Build - run: npm run build - - - name: Upload Build Artifacts - uses: actions/upload-artifact@v2 - with: - name: build-artifacts - path: | - dist - prisma - Dockerfile - .dockerignore - package*.json