Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Nov 13, 2023
0 parents commit 9371926
Show file tree
Hide file tree
Showing 67 changed files with 13,215 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*]
indent_style = tab

[*.{cs,js,ts,json}]
indent_size = 4
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: './node_modules/@sofie-automation/code-standard-preset/eslint/main',
env: {
node: true,
jest: true,
},
ignorePatterns: ['**/dist/**/*', '**/__tests__/**/*', '**/__mocks__/**/*', '**/examples/**/*', '**/scripts/**/*'],
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
104 changes: 104 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Lint and Test

# Controls when the action will run.
on:
push:
branches:
- '**'
tags:
- 'v**'
pull_request:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache node_modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Prepare Environment
run: |
yarn
yarn build
env:
CI: true
- name: Run Linting
run: |
yarn lint
env:
CI: true

# GitHub Action to automate the identification of common misspellings in text files.
# https://github.com/codespell-project/actions-codespell
# https://github.com/codespell-project/codespell
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: codespell-project/actions-codespell@master
with:
check_filenames: true
skip: "./.git,./yarn.lock"
ignore_words_list: ans

test:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['14', '16']
os: [ubuntu-latest] # [windows-latest, macOS-latest]
timeout-minutes: 10
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Prepare Environment
if: matrix.node_version != 10
run: |
yarn
yarn build
env:
CI: true
- name: Prepare Environment (Node 10)
if: matrix.node_version == 10
run: |
sudo apt-get update
sudo apt-get install libudev-dev
# yarn --prod
yarn --ignore-engines
yarn build
env:
CI: true

- name: Run unit tests
run: |
yarn test
env:
CI: true
32 changes: 32 additions & 0 deletions .github/workflows/publish-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish the WebHID demo to pages

# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
publish-demo:
name: Publish demo to Github Pages
runs-on: ubuntu-latest
continue-on-error: false
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- name: Use Node.js 14.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Prepare build
run: |
yarn install
yarn build
env:
CI: true
- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./packages/webhid-demo/dist
75 changes: 75 additions & 0 deletions .github/workflows/publish-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Publish nightly to NPM

# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
publish:
name: Publish to NPM (nightly)
runs-on: ubuntu-latest
continue-on-error: false
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Check if token is set
id: check-npm-token
run: |
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then
echo "env NPM_TOKEN not set!"
else
echo ::set-output name=is-ok::"1"
fi
- name: Prepare Environment
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
yarn
env:
CI: true
- name: Get the Prerelease tag
id: prerelease-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@2b0614b1338c8f19dd9d3ea433ca9bc0cc7057ba
with:
remove-version-tag-prefix: false
- name: Bump version to nightly
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
COMMIT_TIMESTAMP=$(git log -1 --pretty=format:%ct HEAD)
COMMIT_DATE=$(date -d @$COMMIT_TIMESTAMP +%Y%m%d-%H%M%S)
GIT_HASH=$(git rev-parse --short HEAD)
PRERELEASE_TAG=0.0.0-nightly-$(echo "${{ steps.prerelease-tag.outputs.tag }}" | sed -r 's/[^a-z0-9]+/-/gi')
yarn lerna:version $PRERELEASE_TAG-$COMMIT_DATE-$GIT_HASH --force-publish=* --no-changelog --no-push --no-git-tag-version --yes
env:
CI: true
- name: Build
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
yarn build
env:
CI: true
- name: Set .npmrc file
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
npm whoami
- name: Git commit
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
git config --global user.email "ci@github.com"
git config --global user.name "Github CI"
git add -A
git commit -m "Make lerna happy"
env:
CI: true
- name: Publish nightly to NPM
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: yarn lerna:publish from-package --dist-tag nightly --no-verify-access --yes
env:
CI: true
101 changes: 101 additions & 0 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Publish Pre-release-version to NPM

# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['14', '16']
os: [ubuntu-latest] # [windows-latest, macOS-latest]
timeout-minutes: 10
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Prepare Environment
if: matrix.node_version != 10
run: |
yarn
yarn build
env:
CI: true
- name: Prepare Environment (Node 10)
if: matrix.node_version == 10
run: |
sudo apt-get update
sudo apt-get install libudev-dev
# yarn --prod
yarn --ignore-engines
yarn build
env:
CI: true

- name: Run unit tests
run: |
yarn test
env:
CI: true

publish:
name: Publish to NPM (pre-release)
runs-on: ubuntu-latest
continue-on-error: false
timeout-minutes: 15

needs:
- test

steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Check if token is set
id: check-npm-token
run: |
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then
echo "env NPM_TOKEN not set!"
else
echo ::set-output name=is-ok::"1"
fi
- name: Prepare Environment
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
yarn
env:
CI: true
- name: Build
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
yarn build
env:
CI: true
- name: Set .npmrc file
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
npm whoami
- name: Publish prerelease to NPM
if: ${{ steps.check-npm-token.outputs.is-ok }}
run: yarn lerna:publish from-package --dist-tag prerelease --no-verify-access --yes
env:
CI: true
Loading

0 comments on commit 9371926

Please sign in to comment.