From a1af672c7c8738eb9ba02f8d680e2159712b0096 Mon Sep 17 00:00:00 2001 From: mikiher Date: Fri, 15 Mar 2024 08:50:51 +0200 Subject: [PATCH 1/2] Add unit test workflow --- .github/workflows/unit-tests.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 00000000..4c88c16e --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,30 @@ +name: Unit Tests + +on: + workflow_dispatch: + inputs: + branch: + description: 'Branch name' + required: true + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event_name != 'workflow_dispatch' && github.ref_name || inputs.branch}} + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test From 0c612b48368f15e4a65e9ad27017dd375d5adc32 Mon Sep 17 00:00:00 2001 From: mikiher Date: Fri, 15 Mar 2024 09:51:40 +0200 Subject: [PATCH 2/2] Update unit test workflow to include push event --- .github/workflows/unit-tests.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 4c88c16e..24f6398c 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,22 +1,23 @@ -name: Unit Tests +name: Run Unit Tests on: workflow_dispatch: inputs: - branch: - description: 'Branch name' + ref: + description: 'Branch/Tag/SHA to test' required: true pull_request: + push: jobs: - build: + run-unit-tests: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: - ref: ${{ github.event_name != 'workflow_dispatch' && github.ref_name || inputs.branch}} + ref: ${{ github.event_name != 'workflow_dispatch' && github.ref_name || inputs.ref}} - name: Set up Node.js uses: actions/setup-node@v4