-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
249 changed files
with
10,340 additions
and
39,235 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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."); | ||
} | ||
}); | ||
}); | ||
} | ||
}); |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: false |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} |
Oops, something went wrong.