Support for Homebridge v2 #1894
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: Verify | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- "releases?/**" | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
pull_request: | |
types: [opened, assigned, synchronize, reopened] | |
jobs: | |
build: | |
name: Verify | |
runs-on: ubuntu-latest | |
env: | |
node-version-analysis: 20.x | |
strategy: | |
matrix: | |
# the Node.js versions to build on | |
node-version: [18.x, 20.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
env: | |
CI: true | |
- name: Test | |
run: npm run test | |
- name: Export PR info | |
if: github.event_name == 'pull_request' && matrix.node-version == env.node-version-analysis | |
run: | | |
mkdir -p ./pr | |
echo ${{ github.event.number }} > ./pr/number | |
echo ${{ github.head_ref }} > ./pr/head_ref | |
echo ${{ github.sha }} > ./pr/head_sha | |
echo ${{ github.base_ref }} > ./pr/base_ref | |
- name: Archive reports and info (for PR) | |
if: github.event_name == 'pull_request' && matrix.node-version == env.node-version-analysis | |
uses: actions/upload-artifact@v4 | |
with: | |
name: reports | |
retention-days: 7 | |
path: | | |
pr/ | |
coverage/lcov.info | |
coverage/clover.xml | |
reports/tests.xml | |
- name: SonarCloud (on push) | |
uses: sonarsource/sonarcloud-github-action@v2 | |
if: github.event_name == 'push' && matrix.node-version == env.node-version-analysis | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Code Coverage (on push) | |
uses: codecov/codecov-action@v4 | |
if: github.event_name == 'push' && matrix.node-version == env.node-version-analysis | |
with: | |
files: ./coverage/clover.xml | |
flags: tests | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} |