Skip to content
This repository was archived by the owner on Mar 17, 2024. It is now read-only.

Commit 626d1c6

Browse files
committed
Initial commit
0 parents  commit 626d1c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+7357
-0
lines changed

.build/build.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
export NVM_DIR="$HOME/.nvm"
5+
[[ -s "$NVM_DIR/nvm.sh" ]] && \. "$NVM_DIR/nvm.sh"
6+
7+
if [[ $# -lt 1 ]]; then
8+
echo "No working directory provided, using default"
9+
targetDir=$PWD
10+
else
11+
targetDir=$1
12+
fi
13+
if [[ $# -lt 2 ]]; then
14+
echo "No node version provided, using default"
15+
nodeVersion="lts/dubnium"
16+
else
17+
nodeVersion=$2
18+
fi
19+
20+
echo "Entering working directory $targetDir"
21+
cd $targetDir
22+
echo "Installing node version $nodeVersion"
23+
nvm install $nodeVersion
24+
25+
npm ci
26+
E2E_TEST=1 npm test

.build/pre-release.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
patchVersion=$(npm --no-git-tag version patch)
5+
nextVersion=${patchVersion}-next."$(date +%Y%m%d%H%M%S)"
6+
echo "${nextVersion:1}"
7+
8+
npm version --no-git-tag -f "${nextVersion:1}"

.build/run_linux.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo $PWD
5+
6+
npm ci
7+
echo "npm run compile"
8+
npm run compile
9+
echo "init e2e test subpackage"
10+
npm --prefix e2e/tests ci
11+
echo "npm run coverage"
12+
npm run coverage:clean
13+
npm run coverage -- --coverageDirectory=coverage/unit
14+
docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} ${TRAVIS_NODE_VERSION}"
15+
npm run coverage:merge
16+
npm run coverage:merge-report

.build/run_osx.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo $PWD
5+
6+
npm ci
7+
npm run compile
8+
npm --prefix e2e/tests ci
9+
npm test

.build/setup_linux.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
5+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
6+
sudo apt-get update
7+
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
8+
docker pull s1hofmann/nut-ci:latest
9+
docker run -it -d --name nut-ci --shm-size 4gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash

.build/setup_osx.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
set -e

.github/CONTRIBUTING.md

Whitespace-only changes.

.github/FUNDING.YML

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# These are supported funding model platforms
2+
3+
github: s1hofmann
4+
patreon: s1hofmann

.github/workflows/ci.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Run CI
2+
on:
3+
push:
4+
branches-ignore:
5+
- develop
6+
- release/**
7+
pull_request:
8+
9+
jobs:
10+
sonar:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set up Git repository
14+
uses: actions/checkout@v2
15+
- name: Set up node
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: 14
19+
- name: Setup Docker
20+
run: |
21+
docker pull s1hofmann/nut-ci:latest
22+
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
23+
- name: Install
24+
run: npm ci
25+
- name: Compile
26+
run: npm run compile
27+
- name: Generate coverage report
28+
uses: GabrielBB/xvfb-action@v1
29+
with:
30+
run: npm test
31+
- name: Run Docker E2E tests
32+
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} 14"
33+
34+
test:
35+
needs:
36+
- sonar
37+
strategy:
38+
matrix:
39+
os: [ ubuntu-latest, windows-latest, macos-latest ]
40+
node: [ 12, 14, 16 ]
41+
exclude:
42+
- os: ubuntu-latest
43+
node: 14
44+
runs-on: ${{matrix.os}}
45+
steps:
46+
- name: Set up Git repository
47+
uses: actions/checkout@v2
48+
- name: Set up node
49+
uses: actions/setup-node@v2
50+
with:
51+
node-version: ${{matrix.node}}
52+
- name: Setup Docker
53+
if: ${{matrix.os == 'ubuntu-latest'}}
54+
run: |
55+
docker pull s1hofmann/nut-ci:latest
56+
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
57+
- name: Install
58+
run: npm ci
59+
- name: Compile
60+
run: npm run compile
61+
- name: Init window e2e test subpackage
62+
run: npm --prefix e2e/window-test ci
63+
- name: Generate coverage report
64+
uses: GabrielBB/xvfb-action@v1
65+
with:
66+
run: npm run coverage -- --coverageDirectory=coverage/unit
67+
- name: Run Docker E2E tests
68+
if: ${{matrix.os == 'ubuntu-latest'}}
69+
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} ${{matrix.node}}"
70+
- name: Run Electron e2e test subpackage
71+
uses: GabrielBB/xvfb-action@v1
72+
with:
73+
run: npm --prefix e2e/electron-test cit
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Create snapshot release
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
repository_dispatch:
7+
types:
8+
- snapshot-release
9+
10+
jobs:
11+
test:
12+
strategy:
13+
matrix:
14+
os: [ ubuntu-latest, windows-latest, macos-latest ]
15+
node: [ 12, 14, 16 ]
16+
runs-on: ${{matrix.os}}
17+
steps:
18+
- name: Set up Git repository
19+
uses: actions/checkout@v2
20+
- name: Set up node
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: ${{matrix.node}}
24+
- name: Setup Docker
25+
if: ${{matrix.os == 'ubuntu-latest'}}
26+
run: |
27+
docker pull s1hofmann/nut-ci:latest
28+
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
29+
- name: Install
30+
run: npm ci
31+
- name: Compile
32+
run: npm run compile
33+
- name: Run tests
34+
uses: GabrielBB/xvfb-action@v1
35+
with:
36+
run: npm test
37+
- name: Run Docker E2E tests
38+
if: ${{matrix.os == 'ubuntu-latest'}}
39+
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} ${{matrix.node}}"
40+
41+
42+
deploy:
43+
needs:
44+
- test
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Set up Git repository
48+
uses: actions/checkout@v2
49+
- name: Set up node
50+
uses: actions/setup-node@v2
51+
with:
52+
node-version: 14
53+
- name: Install
54+
run: npm ci
55+
- name: Install @nut-tree/libnut@next
56+
run: npm i @nut-tree/libnut@next
57+
- name: Create snapshot release
58+
run: bash ./.build/pre-release.sh
59+
- name: Publish snapshot release to npm
60+
run: npm run publish-next
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/tagged_release.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Create tagged release
2+
on:
3+
push:
4+
tags:
5+
- v*.*.*
6+
7+
jobs:
8+
test:
9+
strategy:
10+
matrix:
11+
os: [ ubuntu-latest, windows-latest, macos-latest ]
12+
node: [ 12, 14, 16 ]
13+
runs-on: ${{matrix.os}}
14+
steps:
15+
- name: Set up Git repository
16+
uses: actions/checkout@v2
17+
- name: Set up node
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{matrix.node}}
21+
- name: Setup Docker
22+
if: ${{matrix.os == 'ubuntu-latest'}}
23+
run: |
24+
docker pull s1hofmann/nut-ci:latest
25+
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
26+
- name: Install
27+
run: npm ci
28+
- name: Compile
29+
run: npm run compile
30+
- name: Init window e2e test subpackage
31+
run: npm --prefix e2e/window-test ci
32+
- name: Generate coverage report
33+
uses: GabrielBB/xvfb-action@v1
34+
with:
35+
run: npm test
36+
- name: Run Docker E2E tests
37+
if: ${{matrix.os == 'ubuntu-latest'}}
38+
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} ${{matrix.node}}"
39+
- name: Run Electron e2e test subpackage
40+
uses: GabrielBB/xvfb-action@v1
41+
with:
42+
run: npm --prefix e2e/electron-test cit
43+
44+
deploy:
45+
needs:
46+
- test
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Set up Git repository
50+
uses: actions/checkout@v2
51+
- name: Set up node
52+
uses: actions/setup-node@v2
53+
with:
54+
node-version: 14
55+
registry-url: 'https://registry.npmjs.org'
56+
- name: Install
57+
run: npm ci
58+
- name: Run typedoc
59+
run: npm run typedoc
60+
- name: Publish typedocs to GitHub Pages
61+
uses: peaceiris/[email protected]
62+
with:
63+
deploy_key: ${{ secrets.API_DOC_DEPLOY_KEY }}
64+
external_repository: nut-tree/apidoc
65+
publish_dir: ./docs
66+
- name: Publish tagged release to npm
67+
run: npm publish
68+
env:
69+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
70+
- uses: actions/setup-node@v2
71+
with:
72+
registry-url: 'https://npm.pkg.github.com'
73+
- name: Publish tagged release to GPR
74+
run: npm publish
75+
env:
76+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)