feat(config): add Zooz ZAC38 Range Extender #14838
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Release | |
# Run this job on all pushes to master, for pull requests | |
# as well as tags with a semantic version | |
on: | |
push: | |
branches: | |
# This avoids having duplicate builds in non-forked PRs | |
- "master" | |
tags: | |
# normal versions | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
# pre-releases | |
- "v[0-9]+.[0-9]+.[0-9]+-**" | |
pull_request: {} | |
merge_group: | |
types: [checks_requested] | |
# Cancel previous PR/branch runs when a new commit is pushed | |
concurrency: | |
group: 'test-and-release-${{ github.ref }}' | |
cancel-in-progress: true | |
env: | |
TURBO_API: "http://127.0.0.1:9080" | |
# The token and team are required by the TurboRepo server, just set them to anything | |
TURBO_TOKEN: foo | |
TURBO_TEAM: me | |
# Additional CLI flags for turbo commands | |
TURBO_FLAGS: "" # "--concurrency=2" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compile TypeScript code | |
run: | | |
# yarn clean $TURBO_FLAGS | |
yarn build $TURBO_FLAGS | |
- name: Save Turbo Cache between jobs | |
uses: ./.github/actions/build-cache-upload | |
# =================== | |
# Makes sure that the published packages can be require'd without issues in a production environment | |
test-packages: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore Turbo Cache from previous jobs | |
uses: ./.github/actions/build-cache-download | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compile TypeScript code | |
run: yarn build $TURBO_FLAGS | |
# Test that the generated packages are ok | |
# I'd love to use yalc or something for this, but it doesn't use yarn pack to pack the tarballs | |
# so we need to fake the install | |
- name: Import main entry points for each package | |
run: | | |
TMP_DIR=$(mktemp -d) | |
echo "Re-creating a production environment..." | |
yarn monopack --target "$TMP_DIR/.tarballs" --no-version | |
cd $TMP_DIR | |
npm init -y | |
npm i .tarballs/zwave-js.tgz | |
echo "Testing entry points..." | |
# Now all entrypoints should work | |
node -e 'require("zwave-js")' | |
node -e 'require("@zwave-js/cc")' | |
node -e 'require("@zwave-js/config")' | |
node -e 'require("@zwave-js/core")' | |
node -e 'require("@zwave-js/host")' | |
node -e 'require("@zwave-js/nvmedit")' | |
node -e 'require("@zwave-js/serial")' | |
node -e 'require("@zwave-js/shared")' | |
node -e 'require("@zwave-js/testing")' | |
node -e 'require("zwave-js/safe")' | |
node -e 'require("@zwave-js/cc/safe")' | |
node -e 'require("@zwave-js/config/safe")' | |
node -e 'require("@zwave-js/core/safe")' | |
node -e 'require("@zwave-js/host/safe")' | |
node -e 'require("@zwave-js/nvmedit/safe")' | |
node -e 'require("@zwave-js/serial/safe")' | |
node -e 'require("@zwave-js/shared/safe")' | |
# =================== | |
lint: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore Turbo Cache from previous jobs | |
uses: ./.github/actions/build-cache-download | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run linters | |
run: yarn run lint $TURBO_FLAGS | |
- name: Prepare lint auto-fix patch | |
if: | | |
failure() && | |
github.event_name == 'pull_request' | |
id: lint | |
run: | | |
# Run all lint commands and abort if one has unfixable errors | |
yarn run lint:ts:fix $TURBO_FLAGS | |
yarn run lint:prettier:fix $TURBO_FLAGS | |
yarn run lint:configjson:fix $TURBO_FLAGS | |
git diff --name-only || true | |
if ! git diff --quiet ; then | |
echo "has changes" | |
git diff > fix.patch | |
echo "changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "unchanged" | |
echo "changed=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Upload Patch | |
if: | | |
failure() && | |
github.event_name == 'pull_request' && | |
steps.lint.outputs.changed == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: lint-fix | |
path: fix.patch | |
# =================== | |
lint-zwave: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore Turbo Cache from previous jobs | |
uses: ./.github/actions/build-cache-download | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Lint config files and Z-Wave specifics | |
run: yarn run lint:zwave $TURBO_FLAGS | |
# =================== | |
# Runs unit tests on all supported node versions and OSes | |
unit-tests: | |
needs: [build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [14, 16, 18, 20] | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore Turbo Cache from previous jobs | |
uses: ./.github/actions/build-cache-download | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run component tests | |
run: yarn run test:ci $TURBO_FLAGS | |
env: | |
CI: true | |
# # =================== | |
# # This job checks if a PR changes the public API surface | |
# api-surface: | |
# name: Check public API surface | |
# # Only run for PRs | |
# if: github.event_name == 'pull_request' | |
# needs: [build] | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# node-version: [18] # This should be LTS | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v3 | |
# - name: Restore Turbo Cache from previous jobs | |
# uses: ./.github/actions/build-cache-download | |
# - name: Prepare testing environment | |
# uses: ./.github/actions/prepare-env | |
# with: | |
# node-version: ${{ matrix.node-version }} | |
# githubToken: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Generate API report | |
# run: yarn run extract-api $TURBO_FLAGS | |
# - name: Show changes | |
# if: failure() | |
# run: | | |
# cat packages/*/.tmp/api.md | |
# - name: Comment on PR | |
# if: failure() | |
# run: | | |
# echo "The public API surface has changed!" >> $GITHUB_STEP_SUMMARY | |
# echo "Please run" >> $GITHUB_STEP_SUMMARY | |
# echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
# echo "yarn accept-api" >> $GITHUB_STEP_SUMMARY | |
# echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
# echo "and review the changes, then commit them if desired." >> $GITHUB_STEP_SUMMARY | |
# echo "" >> $GITHUB_STEP_SUMMARY | |
# =================== | |
gh-cc-table: | |
name: Update CC implementation status | |
# Only run for master branch and don't run in forks | |
if: github.repository == 'zwave-js/node-zwave-js' && github.ref == 'refs/heads/master' && github.event_name == 'push' | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore Turbo Cache from previous jobs | |
uses: ./.github/actions/build-cache-download | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compile TypeScript code | |
run: yarn build $TURBO_FLAGS | |
- name: Update CC table # (maybe) | |
uses: ./.github/actions/gh-cc-table | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
env: | |
CI: true | |
# =================== | |
generate-overview: | |
name: Update toLogEntry overview | |
# Only run for master branch and don't run in forks | |
if: github.repository == 'zwave-js/node-zwave-js' && github.ref == 'refs/heads/master' && github.event_name == 'push' | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore Turbo Cache from previous jobs | |
uses: ./.github/actions/build-cache-download | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compile TypeScript code | |
run: yarn build $TURBO_FLAGS | |
- name: Update overview | |
uses: ./.github/actions/toLogEntry | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
env: | |
CI: true | |
# # Generate coverage reports when the unit tests have succeeded | |
# coverage: | |
# # Trigger this step only on pushes, because the job often fails for pull requests | |
# if: | | |
# contains(github.event.head_commit.message, '[skip ci]') == false && | |
# github.event_name == 'push' | |
# needs: [unit-tests] | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# node-version: [18] # This should be LTS | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v3 | |
# - name: Use Node.js ${{ matrix.node-version }} | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: ${{ matrix.node-version }} | |
# cache: 'yarn' | |
# - name: Install dependencies | |
# run: yarn install --immutable | |
# # Compilation is necessary, or the tests won't run | |
# - name: Compile TypeScript code | |
# run: yarn run build | |
# - name: Generate coverage | |
# run: yarn run coverage:ci | |
# env: | |
# CI: true | |
# - name: Upload to Coveralls | |
# uses: coverallsapp/github-action@master | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# =================== | |
# Deploys the final package to NPM | |
deploy: | |
# Trigger this step only when a commit on any branch is tagged with a version number | |
if: | | |
github.actor == 'AlCalzone' && | |
github.event_name == 'push' && | |
startsWith(github.ref, 'refs/tags/v') | |
needs: [lint, lint-zwave, unit-tests, test-packages] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] # This should be LTS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Restore Turbo Cache from previous jobs | |
uses: ./.github/actions/build-cache-download | |
- name: Prepare testing environment | |
uses: ./.github/actions/prepare-env | |
with: | |
node-version: ${{ matrix.node-version }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Compile TypeScript code | |
run: yarn build $TURBO_FLAGS | |
- name: Extract the version and commit body from the tag | |
id: extract_release | |
# The body may be multiline, therefore we need to escape some characters | |
run: | | |
VERSION="${{ github.ref }}" | |
VERSION=${VERSION##*/v} | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
EOF=$(od -An -N6 -x /dev/urandom | tr -d ' ') | |
BODY=$(git show -s --format=%b) | |
echo "BODY<<$EOF" >> $GITHUB_OUTPUT | |
echo "$BODY" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
if [[ $VERSION == *"-"* ]] ; then | |
echo "TAG=--tag next" >> $GITHUB_OUTPUT | |
fi | |
- name: Publish packages to npm | |
env: | |
TAG: ${{ steps.extract_release.outputs.TAG }} | |
run: | | |
yarn config set npmAuthToken "${{ secrets.NPM_TOKEN }}" | |
yarn npm whoami | |
yarn workspaces foreach -vti --no-private npm publish --tolerate-republish $TAG | |
- name: Create Github Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
name: Release v${{ steps.extract_release.outputs.VERSION }} | |
draft: false | |
# Prerelease versions create prereleases on Github | |
prerelease: ${{ contains(steps.extract_release.outputs.VERSION, '-') }} | |
body: ${{ steps.extract_release.outputs.BODY }} | |
- name: Notify Sentry.io about the release | |
run: | | |
npm i -g @sentry/cli | |
export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | |
export SENTRY_URL=https://sentry.iobroker.net | |
export SENTRY_ORG=iobroker | |
export SENTRY_PROJECT=zwave-js | |
export SENTRY_VERSION=zwave-js@${{ steps.extract_release.outputs.VERSION }} | |
sentry-cli releases new $SENTRY_VERSION | |
# Commits disabled until the Github integration can be enabled | |
sentry-cli releases set-commits $SENTRY_VERSION --auto | |
sentry-cli releases files $SENTRY_VERSION upload-sourcemaps ./packages/*/build | |
sentry-cli releases finalize $SENTRY_VERSION |