From 483a45a4d667e868c4b730e28a8fb97e7efecccb Mon Sep 17 00:00:00 2001 From: DutchmanNL Date: Fri, 3 Nov 2023 16:13:55 +0100 Subject: [PATCH] add automated testing capability for branches without deploy --- .github/workflows/test.yml | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d719315 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,77 @@ +name: Test and Release + +# Run this job on all pushes and pull requests +# as well as tags with a semantic version +on: + push: + branches: + - "*" + tags: + # normal versions + - "v[0-9]+.[0-9]+.[0-9]+" + # pre-releases + - "v[0-9]+.[0-9]+.[0-9]+-**" + pull_request: {} + +jobs: + # Performs quick checks before the expensive test runs + check-and-lint: + if: contains(github.event.head_commit.message, '[skip ci]') == false + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Dependencies + run: npm ci + + - name: Lint source code + run: npm run lint + - name: Test package files + run: npm run test:package + + # Runs adapter tests on all supported node versions and OSes + adapter-tests: + if: contains(github.event.head_commit.message, '[skip ci]') == false + + needs: [check-and-lint] + + runs-on: ${{ matrix.os }} + strategy: + matrix: + node-version: [16.x, 18.x, 20.x] + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Dependencies + run: npm ci + + - name: Run unit tests + run: npm run test:unit + +# - name: Run integration tests (unix only) +# if: startsWith(runner.OS, 'windows') == false +# run: DEBUG=testing:* npm run test:integration +# +# - name: Run integration tests (windows only) +# if: startsWith(runner.OS, 'windows') +# run: set DEBUG=testing:* & npm run test:integration \ No newline at end of file