Skip to content

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
s1hofmann committed Feb 19, 2024
2 parents 2bfc98a + 32b29fb commit 0f3c066
Show file tree
Hide file tree
Showing 249 changed files with 10,340 additions and 39,235 deletions.
26 changes: 0 additions & 26 deletions .build/build.sh

This file was deleted.

46 changes: 46 additions & 0 deletions .build/bump_version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const { exec } = require("child_process");
const { readFile, writeFile } = require("fs");
const { join } = require("path");

const args = process.argv.slice(2);
const version = args[0];
const allPackages = args.includes("--all");

if (version == null || version === "") {
throw new Error("Version is required");
}

exec("pnpm m ls --json --depth=-1", (_, stdout) => {
const modules = JSON.parse(stdout).filter(
(module) => {
return allPackages ? true : module.private !== true;
}
);

for (const module of modules) {
const filePath = join(module.path, "package.json");

readFile(filePath, "utf8", (err, data) => {
if (err) {
throw new Error(err);
}
// Parse JSON
const obj = JSON.parse(data);

// Change a property
obj.version = version;

// Convert object back to JSON
const json = JSON.stringify(obj, null, 2);

// Write JSON file
writeFile(filePath, json, "utf8", (err) => {
if (err) {
throw new Error(err);
} else {
console.log("File successfully updated.");
}
});
});
}
});
2 changes: 1 addition & 1 deletion .build/pre-release.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ patchVersion=$(npm --no-git-tag version patch)
nextVersion=${patchVersion}-next."$(date +%Y%m%d%H%M%S)"
echo "${nextVersion:1}"

npm version --no-git-tag -f "${nextVersion:1}"
node ./.build/bump_version.js "${nextVersion:1}"
16 changes: 0 additions & 16 deletions .build/run_linux.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .build/run_osx.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .build/setup_linux.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .build/setup_osx.sh

This file was deleted.

Empty file removed .github/CONTRIBUTING.md
Empty file.
6 changes: 5 additions & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ about: Create a bug report to help us enhance our images
- [ ] Docker container
- [ ] Dev/Host system

**node version**:

**OS type and version**:

**Detailed error description**

**Steps to reproduce error**
**Full code sample to reproduce**

**Additional content**

Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ about: File a request to resolve open questions
- [ ] Docker container
- [ ] Dev/Host system

**node version**:

**OS type and version**:

**Full code sample related to question**

**Detailed question**
80 changes: 35 additions & 45 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,74 @@ on:
# paths-ignore:
# - '**/*.md'
pull_request:
workflow_dispatch:

jobs:
sonar:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Set up Git repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16
- name: Setup Docker
run: |
docker pull s1hofmann/nut-ci:latest
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
node-version: 18
registry-url: https://registry.npmjs.org/
token: ${{ secrets.NPM_TOKEN }}
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Install
run: npm ci
run: |
pnpm whoami
pnpm i
- name: Compile
run: npm run compile
- name: Init window e2e test subpackage
run: npm --prefix e2e/window-test ci
run: pnpm -r run compile
- name: Clean coverage report
run: npm run coverage:clean
run: pnpm run coverage:clean
- name: Generate coverage report
uses: GabrielBB/xvfb-action@v1
env:
NODE_OPTIONS: "--max-old-space-size=8192"
with:
run: npm run coverage -- --coverageDirectory=coverage/unit
- name: Run Docker E2E tests
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} 14"
- name: Run Electron e2e test subpackage
uses: GabrielBB/xvfb-action@v1
with:
run: npm --prefix e2e/electron-test cit
- name: Merge coverage reports
run: |
npm run coverage:merge
npm run coverage:merge-report
run: pnpm run coverage
- name: Send results to SonarCloud
uses: SonarSource/[email protected]
uses: SonarSource/[email protected]
with:
projectBaseDir: core/nut.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

test:
needs:
- sonar
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
strategy:
matrix:
os: [windows-latest, macos-latest]
node: [16]
os: [ windows-latest, macos-latest ]
node: [ 18 ]
runs-on: ${{matrix.os}}
steps:
- name: Set up Git repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node}}
- name: Setup Docker
if: ${{matrix.os == 'ubuntu-latest'}}
run: |
docker pull s1hofmann/nut-ci:latest
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
registry-url: https://registry.npmjs.org/
token: ${{ secrets.NPM_TOKEN }}
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Install
run: npm ci
run: pnpm i
- name: Compile
run: npm run compile
- name: Init window e2e test subpackage
run: npm --prefix e2e/window-test ci
run: pnpm run compile
- name: Generate coverage report
uses: GabrielBB/xvfb-action@v1
with:
run: npm run coverage -- --coverageDirectory=coverage/unit
- name: Run Docker E2E tests
if: ${{matrix.os == 'ubuntu-latest'}}
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} ${{matrix.node}}"
- name: Run Electron e2e test subpackage
uses: GabrielBB/xvfb-action@v1
with:
run: npm --prefix e2e/electron-test cit
run: |
pnpm run coverage
64 changes: 34 additions & 30 deletions .github/workflows/snapshot_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,76 @@ on:
repository_dispatch:
types:
- snapshot-release
workflow_dispatch:

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [16]
node: [18]
runs-on: ${{matrix.os}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Set up Git repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{matrix.node}}
- name: Setup Docker
if: ${{matrix.os == 'ubuntu-latest'}}
run: |
docker pull s1hofmann/nut-ci:latest
docker run -it -d --name nut-ci --shm-size 8gb --user $(id -u):$(id -g) -v ${PWD}:${PWD}:rw s1hofmann/nut-ci:latest bash
registry-url: https://registry.npmjs.org/
token: ${{ secrets.NPM_TOKEN }}
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Install
run: npm ci
run: |
pnpm whoami
pnpm i
- name: Install @nut-tree/libnut@next
run: npm i @nut-tree/libnut@next
run: |
pnpm --filter @nut-tree/libnut i @nut-tree/libnut-darwin@next @nut-tree/libnut-linux@next @nut-tree/libnut-win32@next
- name: Compile
run: npm run compile
- name: Init window e2e test subpackage
run: npm --prefix e2e/window-test ci
run: pnpm run compile
- name: Run tests
uses: GabrielBB/xvfb-action@v1
with:
run: npm test
- name: Run Docker E2E tests
if: ${{matrix.os == 'ubuntu-latest'}}
run: docker exec nut-ci bash -c "bash $PWD/.build/build.sh ${PWD} ${{matrix.node}}"
- name: Run Electron e2e test subpackage
uses: GabrielBB/xvfb-action@v1
with:
run: npm --prefix e2e/electron-test cit
run: pnpm run coverage

deploy:
needs:
- test
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Set up Git repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
node-version: 18
registry-url: https://registry.npmjs.org/
token: ${{ secrets.NPM_TOKEN }}
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Install
run: npm ci
run: |
pnpm whoami
pnpm i
- name: Install @nut-tree/libnut@next
run: npm i @nut-tree/libnut@next
run: |
pnpm --filter @nut-tree/libnut i @nut-tree/libnut-darwin@next @nut-tree/libnut-linux@next @nut-tree/libnut-win32@next
- name: Create snapshot release
run: bash ./.build/pre-release.sh
- name: Publish snapshot release to npm
run: npm run publish-next
run: pnpm run publish:next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
registry-url: "https://npm.pkg.github.com"
- name: Publish snapshot release to GPR
run: npm run publish-next
run: npm run publish:next
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 0f3c066

Please sign in to comment.