Skip to content

Commit

Permalink
Resolution of hb-service update-node and restore issues (#1490)
Browse files Browse the repository at this point in the history
  • Loading branch information
NorthernMan54 committed May 11, 2023
1 parent 8e1dc55 commit 2373453
Show file tree
Hide file tree
Showing 33 changed files with 1,613 additions and 1,188 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
"ui/",
'ui/**/*',
'dist/**/*',
'.eslintrc.js'
],
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
Expand All @@ -20,7 +21,6 @@ module.exports = {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'quotes': ['error', 'single'],
'comma-dangle': ['error', 'only-multiline'],
Expand Down
21 changes: 21 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The GitHub release configuration file: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes

changelog:
categories:
- title: Breaking Changes 🛠
labels:
- 'breaking change'
- title: Featured Changes ✨
labels:
- 'feature'
- 'enhancement'
- title: Bug Fixes 🐛
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: Other Changes
labels:
- "chore"
- "housekeeping"
- "*"
38 changes: 38 additions & 0 deletions .github/workflows/attach-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Attach Artifacts

on:
release:
types: [published]

jobs:
build:
name: Attach Artifact
runs-on: ubuntu-latest

steps:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 16.x

# Sanity check to ensure that release tags don't start with a 'v' version prefix but adhere to the X.Y.Z format
- name: Check for Tag name Format
if: startWith(${{github.event.release.tag_name}}, 'v')
run: |
echo "Tag name must not start with 'v' Prefix"
exit 1
- name: Install package
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ github.event.release.tag_name }}
- name: Create Bundle
run: |
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz > SHASUMS256.txt
- name: Attach Bundle
uses: AButler/upload-release-assets@v2.0
with:
files: 'homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.release.tag_name }}
36 changes: 36 additions & 0 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Node-CI Beta

on:
push:
branches: [beta-*.*.*, beta]
workflow_dispatch:

jobs:
build_and_test:
uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@main
with:
enable_coverage: true
install_cmd: npm ci && cd ui && npm ci
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

lint:
needs: build_and_test
uses: homebridge/.github/.github/workflows/eslint.yml@main
with:
install_cmd: npm ci && cd ui && npm ci

publish:
needs: lint

if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }}

uses: homebridge/.github/.github/workflows/npm-publish.yml@main
with:
tag: 'test'
dynamically_adjust_version: true
npm_version_command: 'pre'
pre_id: 'test'
install_cmd: npm ci && cd ui && npm ci
secrets:
npm_auth_token: ${{ secrets.npm_token }}
91 changes: 91 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Node Build

on:
push:
branches: [master]
pull_request:
workflow_dispatch:

jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]

uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@main
with:
enable_coverage: true
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

test_hb_service:
needs: build_and_test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [16.x, 17.x, 18.x]
include:
- os: macos-latest
node-version: 16.x
- os: macos-latest
node-version: 18.x
- os: windows-2019
node-version: 16.x
- os: windows-2019
node-version: 18.x
- os: windows-latest
node-version: 16.x
- os: windows-latest
node-version: 18.x

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build:server
- run: npm run lint:server
- run: npm run test

# remove dev deps
- run: npm clean-install --production

# test hb-service
- run: node dist/bin/hb-service.js -v
- if: runner.os == 'Linux'
name: 'Run hb-service install (Linux)'
run: |
sudo npm link
sudo npm install -g homebridge
sudo hb-service install --user homebridge --group `id -gn`
sleep 30
- if: runner.os == 'macOS'
name: 'Run hb-service install (macOS)'
run: |
sudo npm link
sudo npm install -g homebridge
sudo hb-service install
sleep 30
- if: runner.os == 'Windows'
name: 'Run hb-service install (Windows)'
run: |
npm link
npm install -g homebridge
hb-service install
Start-Sleep -s 30
- name: 'Test hb-service install'
run: node dist/bin/hb-service.js status --port 8581
- name: 'View Errors'
if: ${{ failure() }}
run: |
node dist/bin/hb-service.js view
exit 1
lint:
needs: build_and_test
uses: homebridge/.github/.github/workflows/eslint.yml@main
13 changes: 13 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "CodeQL"

on:
push:
branches: [ master, beta* ]
pull_request:
branches: [ master, beta* ]
schedule:
- cron: '17 9 * * 2'

jobs:
analyze:
uses: homebridge/.github/.github/workflows/codeql-analysis.yml@main
12 changes: 12 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: PR Labeler

on:
pull_request: # required for auto labeler
types: [opened, reopened, synchronize]
workflow_dispatch:

jobs:
stale:
uses: homebridge/.github/.github/workflows/pr-labeler.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
58 changes: 0 additions & 58 deletions .github/workflows/publish.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Node Release

on:
push:
tags:
- '*.*.*'
workflow_dispatch:

jobs:
build_and_test:
uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@main
with:
enable_coverage: true
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

publish:
needs: build_and_test

if: ${{ github.repository == 'homebridge/homebridge-config-ui-x' }}

uses: homebridge/.github/.github/workflows/npm-publish.yml@main
with:
install_cmd: npm ci && cd ui && npm ci
secrets:
npm_auth_token: ${{ secrets.npm_token }}
22 changes: 7 additions & 15 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
name: 'Stale Bot'
name: Stale workflow

on:
schedule:
- cron: '30 1 * * *'
workflow_dispatch:
schedule:
- cron: '45 11 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: stale
exempt-issue-labels: pinned,security
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
days-before-issue-stale: 30
days-before-issue-close: 5
days-before-pr-close: -1
days-before-pr-stale: -1
uses: homebridge/.github/.github/workflows/stale.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 2373453

Please sign in to comment.