Skip to content

Commit

Permalink
test: rework CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Jun 15, 2021
1 parent 262beec commit 501c99e
Showing 1 changed file with 10 additions and 44 deletions.
54 changes: 10 additions & 44 deletions .github/workflows/test-and-release.yml
Expand Up @@ -174,56 +174,22 @@ jobs:
- name: Compile TypeScript code
run: yarn run build

# Test that the generated packages are ok
- if: matrix.node-version == '10.x'
name: Import main entry point (CommonJS)
run: node -e 'require("./packages/zwave-js")'

- if: matrix.node-version != '10.x'
name: Import main entry point (ESM)
run: node --input-type=module -e 'import "./packages/zwave-js"'

- name: Run component tests
run: yarn run test:ci
env:
CI: true

# ===================

# Test that the generated packages are ok
test-package:
if: contains(github.event.head_commit.message, '[skip ci]') == false

runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.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: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --prefer-offline --frozen-lockfile

# Do a full build so the package files are regenerated
- name: Compile TypeScript code
run: yarn run build

- name: Import main entry point
run: node -e 'require("./packages/zwave-js")'

# ===================

# Generate coverage reports when the unit tests have succeeded
coverage:
# Trigger this step only on pushes, because the job often fails for pull requests
Expand Down Expand Up @@ -287,7 +253,7 @@ jobs:
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
needs: [lint, lint-zwave, unit-tests, test-package]
needs: [lint, lint-zwave, unit-tests]

runs-on: ubuntu-latest
strategy:
Expand Down

0 comments on commit 501c99e

Please sign in to comment.