From 5b47a42fb931aa87068c2a4e9d137bdfb00464b6 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 14 Nov 2023 18:52:58 +0000 Subject: [PATCH 01/26] feat: add npm package to homestar runtime --- .gitignore | 3 + homestar-runtime/npm/base/index.js | 42 ++++ homestar-runtime/npm/base/package-lock.json | 263 ++++++++++++++++++++ homestar-runtime/npm/base/package.json | 26 ++ homestar-runtime/npm/package.json.tmpl | 6 + homestar-runtime/npm/readme.md | 59 +++++ 6 files changed, 399 insertions(+) create mode 100644 homestar-runtime/npm/base/index.js create mode 100644 homestar-runtime/npm/base/package-lock.json create mode 100644 homestar-runtime/npm/base/package.json create mode 100644 homestar-runtime/npm/package.json.tmpl create mode 100644 homestar-runtime/npm/readme.md diff --git a/.gitignore b/.gitignore index 8e6e9508..2279e665 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,6 @@ examples/**/tmp/* # nix build results /result + +# npm packages +homestar-runtime/npm/binaries \ No newline at end of file diff --git a/homestar-runtime/npm/base/index.js b/homestar-runtime/npm/base/index.js new file mode 100644 index 00000000..65abe3ff --- /dev/null +++ b/homestar-runtime/npm/base/index.js @@ -0,0 +1,42 @@ +#!/usr/bin/env node + +import { execa } from 'execa' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) + +/** + * Returns the executable path which is located inside `node_modules` + * The naming convention is app-${os}-${arch} + * If the platform is `win32` or `cygwin`, executable will include a `.exe` extension. + * @see https://nodejs.org/api/os.html#osarch + * @see https://nodejs.org/api/os.html#osplatform + * @example "x/xx/node_modules/app-darwin-arm64" + */ +function getExePath() { + const arch = process.arch + let os = process.platform + let extension = '' + if (['win32', 'cygwin'].includes(process.platform)) { + os = 'windows' + extension = '.exe' + } + + try { + // Since the binary will be located inside `node_modules`, we can simply call `require.resolve` + return require.resolve(`homestar-${os}-${arch}/bin/homestar${extension}`) + } catch (e) { + throw new Error( + `Couldn't find application binary inside node_modules for ${os}-${arch}` + ) + } +} + +/** + * Runs the application with args using nodejs spawn + */ +function run() { + const args = process.argv.slice(2) + execa(getExePath(), args, { stdio: 'inherit' }) +} + +run() diff --git a/homestar-runtime/npm/base/package-lock.json b/homestar-runtime/npm/base/package-lock.json new file mode 100644 index 00000000..d7c133b7 --- /dev/null +++ b/homestar-runtime/npm/base/package-lock.json @@ -0,0 +1,263 @@ +{ + "name": "homestar-runtime", + "version": "0.0.7", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "homestar-runtime", + "version": "0.0.7", + "license": "MIT", + "dependencies": { + "execa": "^8.0.1" + }, + "bin": { + "homestar": "index.js" + }, + "optionalDependencies": { + "homestar-darwin-arm64": "*", + "homestar-darwin-x64": "*", + "homestar-linux-arm64": "*", + "homestar-linux-x64": "*", + "homestar-windows-arm64": "*", + "homestar-windows-x64": "*" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/homestar-darwin-arm64": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/homestar-darwin-arm64/-/homestar-darwin-arm64-0.0.1.tgz", + "integrity": "sha512-ftcZyXJalctBtj3jhTepLVE6LjNaB/k2KB9zAAZjQi6neAKs+MMTqaRt8TV3/X16hOryOeyjDPCshgbGnqpBJw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/homestar-darwin-x64": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/homestar-darwin-x64/-/homestar-darwin-x64-0.0.1.tgz", + "integrity": "sha512-DT4H2XnKD6bwjY/3ooYRwfqnP8maKlLp53ZOkeSPIWT8HDf7DI/6WJxeZZy8AGkMox5SU0xP64CrIQ3W/D57NA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/homestar-linux-arm64": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/homestar-linux-arm64/-/homestar-linux-arm64-0.0.1.tgz", + "integrity": "sha512-IKDrLIvZWmp1ZrcYyySV1xp7wOYOCHPELeuiOEd0a3YuHssURXS4CdibUGKXGnTnxv7w7bjNla5HAVyOnC/dNA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/homestar-linux-x64": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/homestar-linux-x64/-/homestar-linux-x64-0.0.1.tgz", + "integrity": "sha512-LuY2HA3SM1B5B4LFpyb+eAKHFaKlEJ0vtkr/aFJCR9d0SA/omf3ZpqmeT4zDrCNgCnqT81rvVDjBOP094890zw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + } + } +} diff --git a/homestar-runtime/npm/base/package.json b/homestar-runtime/npm/base/package.json new file mode 100644 index 00000000..20804566 --- /dev/null +++ b/homestar-runtime/npm/base/package.json @@ -0,0 +1,26 @@ +{ + "name": "homestar-runtime", + "version": "0.0.8", + "description": "", + "bin": { + "homestar": "index.js" + }, + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "MIT", + "optionalDependencies": { + "homestar-darwin-arm64": "*", + "homestar-darwin-x64": "*", + "homestar-linux-arm64": "*", + "homestar-linux-x64": "*", + "homestar-windows-arm64": "*", + "homestar-windows-x64": "*" + }, + "dependencies": { + "execa": "^8.0.1" + } +} diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package.json.tmpl new file mode 100644 index 00000000..2a0464c0 --- /dev/null +++ b/homestar-runtime/npm/package.json.tmpl @@ -0,0 +1,6 @@ +{ + "name": "${node_pkg}", + "version": "${node_version}", + "os": ["${node_os}"], + "cpu": ["${node_arch}"] +} \ No newline at end of file diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md new file mode 100644 index 00000000..d7168d6f --- /dev/null +++ b/homestar-runtime/npm/readme.md @@ -0,0 +1,59 @@ +# Homestar NPM packages + +## Usage + +```bash + +rustup target add aarch64-unknown-linux-gnu +rustup target add x86_64-unknown-linux-musl + + +export node_version=0.0.1 +export bin="homestar" + + +## darwin arm64 +cargo build -p homestar-runtime --locked --release --target aarch64-apple-darwin +export node_os=darwin +export node_arch=arm64 +export node_pkg="${bin}-${node_os}-${node_arch}" +mkdir -p "binaries/${node_pkg}/bin" +envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" +cp "../../target/aarch64-apple-darwin/release/${bin}" "binaries/${node_pkg}/bin" + +## darwin x64 +cross build -p homestar-runtime --locked --release --target x86_64-apple-darwin +export node_os=darwin +export node_arch=x64 +export node_pkg="${bin}-${node_os}-${node_arch}" +mkdir -p "binaries/${node_pkg}/bin" +envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" +cp "../../target/x86_64-apple-darwin/release/${bin}" "binaries/${node_pkg}/bin" + +## linux arm64 +cross build -p homestar-runtime --locked --release --target aarch64-unknown-linux-gnu +export node_os=linux +export node_arch=arm64 +export node_pkg="${bin}-${node_os}-${node_arch}" +mkdir -p "binaries/${node_pkg}/bin" +envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" +cp "../../target/aarch64-unknown-linux-gnu/release/${bin}" "binaries/${node_pkg}/bin" + +## linux x64 +cross build -p homestar-runtime --locked --release --target x86_64-unknown-linux-musl +export node_os=linux +export node_arch=x64 +export node_pkg="${bin}-${node_os}-${node_arch}" +mkdir -p "binaries/${node_pkg}/bin" +envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" +cp "../../target/x86_64-unknown-linux-musl/release/${bin}" "binaries/${node_pkg}/bin" + +# publish the package +cd "${node_pkg}" +npm publish --access public +``` + +## TODO + +- [ ] move this to CI +- [ ] add windows From 94475869943f23784ca90659a78cb2996372f9c9 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 14 Nov 2023 19:33:11 +0000 Subject: [PATCH 02/26] chore: ansi-logs --- homestar-runtime/npm/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index d7168d6f..88168fa7 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -57,3 +57,4 @@ npm publish --access public - [ ] move this to CI - [ ] add windows +- [ ] --features ansi-logs From 844aa51d2ff77eb18473b93154cc6800421cf43e Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 14 Nov 2023 20:14:07 +0000 Subject: [PATCH 03/26] chore: colors --- homestar-runtime/npm/readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index 88168fa7..c5156996 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -8,12 +8,12 @@ rustup target add aarch64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl -export node_version=0.0.1 +export node_version=0.0.2 export bin="homestar" ## darwin arm64 -cargo build -p homestar-runtime --locked --release --target aarch64-apple-darwin +cargo build -p homestar-runtime --features ansi-logs --locked --release --target aarch64-apple-darwin export node_os=darwin export node_arch=arm64 export node_pkg="${bin}-${node_os}-${node_arch}" @@ -22,7 +22,7 @@ envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" cp "../../target/aarch64-apple-darwin/release/${bin}" "binaries/${node_pkg}/bin" ## darwin x64 -cross build -p homestar-runtime --locked --release --target x86_64-apple-darwin +cross build -p homestar-runtime --features ansi-logs --locked --release --target x86_64-apple-darwin export node_os=darwin export node_arch=x64 export node_pkg="${bin}-${node_os}-${node_arch}" @@ -31,7 +31,7 @@ envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" cp "../../target/x86_64-apple-darwin/release/${bin}" "binaries/${node_pkg}/bin" ## linux arm64 -cross build -p homestar-runtime --locked --release --target aarch64-unknown-linux-gnu +cross build -p homestar-runtime --features ansi-logs --locked --release --target aarch64-unknown-linux-gnu export node_os=linux export node_arch=arm64 export node_pkg="${bin}-${node_os}-${node_arch}" @@ -40,7 +40,7 @@ envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" cp "../../target/aarch64-unknown-linux-gnu/release/${bin}" "binaries/${node_pkg}/bin" ## linux x64 -cross build -p homestar-runtime --locked --release --target x86_64-unknown-linux-musl +cross build -p homestar-runtime --features ansi-logs --locked --release --target x86_64-unknown-linux-musl export node_os=linux export node_arch=x64 export node_pkg="${bin}-${node_os}-${node_arch}" From c52b169cdf4b50478724eb5bb98c68ef5cbc83cb Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 15 Nov 2023 10:45:24 +0000 Subject: [PATCH 04/26] chore: change to musl --- homestar-runtime/npm/readme.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index c5156996..ebc0c9af 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -4,7 +4,7 @@ ```bash -rustup target add aarch64-unknown-linux-gnu +rustup target add aarch64-unknown-linux-musl rustup target add x86_64-unknown-linux-musl @@ -31,13 +31,13 @@ envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" cp "../../target/x86_64-apple-darwin/release/${bin}" "binaries/${node_pkg}/bin" ## linux arm64 -cross build -p homestar-runtime --features ansi-logs --locked --release --target aarch64-unknown-linux-gnu +cross build -p homestar-runtime --features ansi-logs --locked --release --target aarch64-unknown-linux-musl export node_os=linux export node_arch=arm64 export node_pkg="${bin}-${node_os}-${node_arch}" mkdir -p "binaries/${node_pkg}/bin" envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" -cp "../../target/aarch64-unknown-linux-gnu/release/${bin}" "binaries/${node_pkg}/bin" +cp "../../target/aarch64-unknown-linux-musl/release/${bin}" "binaries/${node_pkg}/bin" ## linux x64 cross build -p homestar-runtime --features ansi-logs --locked --release --target x86_64-unknown-linux-musl @@ -57,4 +57,3 @@ npm publish --access public - [ ] move this to CI - [ ] add windows -- [ ] --features ansi-logs From afa567a5dc6c8f8f4609139a1d8d33e3ec4e4a42 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 15 Nov 2023 12:36:25 +0000 Subject: [PATCH 05/26] chore: test ci --- .github/workflows/builds.yml | 27 +++++++++++++++++++++++++++ Cross.toml | 4 ++-- homestar-runtime/npm/readme.md | 8 ++++---- homestar-runtime/npm/version | 1 + 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 homestar-runtime/npm/version diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index ae1ee665..46c213f6 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -30,14 +30,19 @@ jobs: include: - target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-musl + npm: linux-arm64 - target: aarch64-apple-darwin os: macos-latest + npm: darwin-arm64 - target: x86_64-unknown-linux-gnu - target: x86_64-unknown-linux-musl + npm: linux-x64 - target: x86_64-apple-darwin os: macos-latest + npm: darwin-x64 - target: x86_64-pc-windows-msvc os: windows-latest + npm: windows-x64 - target: x86_64-unknown-freebsd permissions: @@ -94,6 +99,28 @@ jobs: zip: windows include: LICENSE,README.md token: ${{ secrets.GITHUB_TOKEN }} + - name: NPM prerelease + if: matrix.npm + shell: bash + run: | + cd homestar-runtime/npm + bin="homestar" + if [[ ${{ matrix.npm }} == "windows-x64" ]]; then + bin="homestar.exe" + fi + node_os=$(echo "${{ matrix.npm }}" | cut -d '-' -f1) + export node_os + node_arch=$(echo "${{ matrix.npm }}" | cut -d '-' -f2) + export node_arch + export node_version=$(cat version) + export node_pkg="${bin}-${node_os}-${node_arch}" + mkdir -p "${node_pkg}/bin" + envsubst < package.json.tmpl > "${node_pkg}/package.json" + cp "../target/${{ matrix.target }}/release/${bin}" "${node_pkg}/bin" + cd "${node_pkg}" + npm version prerelease --preid rc --no-git-tag-version + cat "package.json" + ls . build-packages: runs-on: ubuntu-latest diff --git a/Cross.toml b/Cross.toml index ff92d71f..78ef8d29 100644 --- a/Cross.toml +++ b/Cross.toml @@ -17,8 +17,8 @@ passthrough = [ [target.x86_64-unknown-linux-musl] image = "burntsushi/cross:x86_64-unknown-linux-musl" -[target.aarch64-unknown-linux-musl] -image = "burntsushi/cross:aarch64-unknown-linux-musl" +[target.aarch64-unknown-linux-gnu] +image = "burntsushi/cross:aarch64-unknown-linux-gnu" [target.x86_64-apple-darwin] image = "freeznet/x86_64-apple-darwin-cross:11.3" diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index ebc0c9af..5a8315ba 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -4,11 +4,11 @@ ```bash -rustup target add aarch64-unknown-linux-musl +rustup target add aarch64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl -export node_version=0.0.2 +export node_version=0.0.3 export bin="homestar" @@ -31,13 +31,13 @@ envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" cp "../../target/x86_64-apple-darwin/release/${bin}" "binaries/${node_pkg}/bin" ## linux arm64 -cross build -p homestar-runtime --features ansi-logs --locked --release --target aarch64-unknown-linux-musl +cross build -p homestar-runtime --features ansi-logs --locked --release --target aarch64-unknown-linux-gnu export node_os=linux export node_arch=arm64 export node_pkg="${bin}-${node_os}-${node_arch}" mkdir -p "binaries/${node_pkg}/bin" envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" -cp "../../target/aarch64-unknown-linux-musl/release/${bin}" "binaries/${node_pkg}/bin" +cp "../../target/aarch64-unknown-linux-gnu/release/${bin}" "binaries/${node_pkg}/bin" ## linux x64 cross build -p homestar-runtime --features ansi-logs --locked --release --target x86_64-unknown-linux-musl diff --git a/homestar-runtime/npm/version b/homestar-runtime/npm/version new file mode 100644 index 00000000..6812f812 --- /dev/null +++ b/homestar-runtime/npm/version @@ -0,0 +1 @@ +0.0.3 \ No newline at end of file From 1a8c39f3e0fc0edfb68f96e4ff82e7cee685a720 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 15 Nov 2023 12:46:10 +0000 Subject: [PATCH 06/26] chore: bin path --- .github/workflows/builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 46c213f6..5ca65b2b 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -116,7 +116,7 @@ jobs: export node_pkg="${bin}-${node_os}-${node_arch}" mkdir -p "${node_pkg}/bin" envsubst < package.json.tmpl > "${node_pkg}/package.json" - cp "../target/${{ matrix.target }}/release/${bin}" "${node_pkg}/bin" + cp "../../target/${{ matrix.target }}/release/${bin}" "${node_pkg}/bin" cd "${node_pkg}" npm version prerelease --preid rc --no-git-tag-version cat "package.json" From ac0dc0d6326e348dcdfb54009db9ebaf2a39a75b Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Thu, 16 Nov 2023 16:57:30 +0000 Subject: [PATCH 07/26] chore: tweak package.json --- homestar-runtime/npm/base/package.json | 4 ++-- homestar-runtime/npm/package.json.tmpl | 15 ++++++++++++--- homestar-runtime/npm/readme.md | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/homestar-runtime/npm/base/package.json b/homestar-runtime/npm/base/package.json index 20804566..d00cb08d 100644 --- a/homestar-runtime/npm/base/package.json +++ b/homestar-runtime/npm/base/package.json @@ -1,7 +1,8 @@ { "name": "homestar-runtime", "version": "0.0.8", - "description": "", + "description": "Homestar Runtime", + "author": "Hugo Dias (hugodias.me)", "bin": { "homestar": "index.js" }, @@ -10,7 +11,6 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], - "author": "", "license": "MIT", "optionalDependencies": { "homestar-darwin-arm64": "*", diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package.json.tmpl index 2a0464c0..d64f226a 100644 --- a/homestar-runtime/npm/package.json.tmpl +++ b/homestar-runtime/npm/package.json.tmpl @@ -1,6 +1,15 @@ { "name": "${node_pkg}", "version": "${node_version}", - "os": ["${node_os}"], - "cpu": ["${node_arch}"] -} \ No newline at end of file + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Hugo Dias (hugodias.me)", + "license": "MIT", + "os": [ + "${node_os}" + ], + "cpu": [ + "${node_arch}" + ] +} diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index 5a8315ba..615d1767 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -8,7 +8,7 @@ rustup target add aarch64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl -export node_version=0.0.3 +export node_version=0.0.4 export bin="homestar" From dac60557a9c2a724d1b7b75e7b0af035cd254dae Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 22 Nov 2023 15:08:44 +0000 Subject: [PATCH 08/26] chore: version --- homestar-runtime/npm/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index 615d1767..caa2e431 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -8,7 +8,7 @@ rustup target add aarch64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl -export node_version=0.0.4 +export node_version=0.0.5 export bin="homestar" From ab553c2d4a3a83bbfd108d0fbc7d830808f684a5 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 28 Nov 2023 21:26:01 +0000 Subject: [PATCH 09/26] chore: ci --- .github/workflows/builds.yml | 346 +++++++++++--------- homestar-runtime/npm/base/package-lock.json | 4 +- homestar-runtime/npm/readme.md | 7 +- 3 files changed, 203 insertions(+), 154 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 5ca65b2b..ccdc0ff2 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -15,8 +15,8 @@ on: types: [published] # for debugging - # pull_request: - # branches: [ '**' ] + pull_request: + branches: [ '**' ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -28,22 +28,22 @@ jobs: fail-fast: false matrix: include: - - target: aarch64-unknown-linux-gnu + # - target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-musl npm: linux-arm64 - - target: aarch64-apple-darwin - os: macos-latest - npm: darwin-arm64 - - target: x86_64-unknown-linux-gnu - - target: x86_64-unknown-linux-musl - npm: linux-x64 - - target: x86_64-apple-darwin - os: macos-latest - npm: darwin-x64 - - target: x86_64-pc-windows-msvc - os: windows-latest - npm: windows-x64 - - target: x86_64-unknown-freebsd + # - target: aarch64-apple-darwin + # os: macos-latest + # npm: darwin-arm64 + # - target: x86_64-unknown-linux-gnu + # - target: x86_64-unknown-linux-musl + # npm: linux-x64 + # - target: x86_64-apple-darwin + # os: macos-latest + # npm: darwin-x64 + # - target: x86_64-pc-windows-msvc + # os: windows-latest + # npm: windows-x64 + # - target: x86_64-unknown-freebsd permissions: contents: write @@ -99,154 +99,200 @@ jobs: zip: windows include: LICENSE,README.md token: ${{ secrets.GITHUB_TOKEN }} - - name: NPM prerelease - if: matrix.npm - shell: bash - run: | - cd homestar-runtime/npm - bin="homestar" - if [[ ${{ matrix.npm }} == "windows-x64" ]]; then - bin="homestar.exe" - fi - node_os=$(echo "${{ matrix.npm }}" | cut -d '-' -f1) - export node_os - node_arch=$(echo "${{ matrix.npm }}" | cut -d '-' -f2) - export node_arch - export node_version=$(cat version) - export node_pkg="${bin}-${node_os}-${node_arch}" - mkdir -p "${node_pkg}/bin" - envsubst < package.json.tmpl > "${node_pkg}/package.json" - cp "../../target/${{ matrix.target }}/release/${bin}" "${node_pkg}/bin" - cd "${node_pkg}" - npm version prerelease --preid rc --no-git-tag-version - cat "package.json" - ls . - build-packages: + npm-publish: + needs: binary-builds runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - - target: x86_64-unknown-linux-gnu - - target: x86_64-unknown-linux-musl + - target: aarch64-unknown-linux-musl + os: linux + arch: arm64 + bin: homestar + # - target: x86_64-unknown-linux-musl + # os: linux + # arch: x64 + # - target: aarch64-apple-darwin + # os: darwin + # arch: arm64 + # - target: x86_64-apple-darwin + # npm: darwin-x64 + # os: darwin + # arch: x64 + # - target: x86_64-pc-windows-msvc + # os: windows + # arch: x64 steps: - name: Checkout uses: actions/checkout@v4 - - - name: Install musl-tools - run: sudo apt update && sudo apt install -y musl-dev musl-tools - if: matrix.target == 'x86_64-unknown-linux-musl' - - - name: Install Rust toolchain + - name: Install Rust Toolchain id: toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - targets: ${{ matrix.target }} - - - name: Override rust-toolchain.toml - run: rustup override set ${{steps.toolchain.outputs.name}} - - - name: Install cargo-deb - uses: taiki-e/cache-cargo-install-action@v1 - with: - tool: cargo-deb - - - name: Install cargo-generate-rpm - uses: taiki-e/cache-cargo-install-action@v1 - with: - tool: cargo-generate-rpm - + uses: dtolnay/rust-toolchain@stable - name: Cache Project uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - shared-key: check-${{ matrix.target }}-ubuntu-latest - - - name: Create .deb - run: cargo deb -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.deb - - - name: Create .rpm - run: cargo generate-rpm -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.rpm - - - name: Upload Release Artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.target }} - path: | - *.deb - *.rpm - if-no-files-found: error - - - name: Publish Package in Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'published' + shared-key: check-${{ matrix.target }}-${{ matrix.os }} + - name: cargo get + run: cargo install cargo-get + - uses: actions/setup-go@v4 with: - files: | - *.deb - *.rpm - - docker-build: - runs-on: ubuntu-latest - - env: - DOCKER_BUILDKIT: '1' - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - - permissions: - contents: read - id-token: write - packages: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Cleanup + go-version: 'stable' + - run: go install github.com/a8m/envsubst/cmd/envsubst@latest + - name: prerelease + shell: bash + env: + node_os: ${{ matrix.os }} + node_arch: ${{ matrix.arch }} + node_bin: ${{ matrix.bin }} + node_pkg: ${{ matrix.bin }}-${{ matrix.os }}-${{ matrix.arch }} run: | - # Workaround to provide additional free space for testing. - # https://github.com/actions/virtual-environments/issues/2840 - rm -rf /opt/hostedtoolcache - rm -rf /usr/share/dotnet - rm -rf /opt/ghc - rm -rf "$AGENT_TOOLSDIRECTORY" - sudo apt-get clean - sudo rm -rf /usr/share/dotnet - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup QEMU - uses: docker/setup-qemu-action@v3 - - - name: Setup Buildx - uses: docker/setup-buildx-action@v3 - - - name: Metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=semver,pattern=v{{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest - type=sha - - - name: Docker Build & Push - uses: docker/build-push-action@v5 + export node_version=$(cargo get workspace.package.version) + cd homestar-runtime/npm + echo "node_bin=${bin}" >> "$GITHUB_ENV" + echo "node_pkg=${node_pkg}" >> "$GITHUB_ENV" + mkdir -p "${node_pkg}/bin" + envsubst < package.json.tmpl > "${node_pkg}/package.json" + cd "${node_pkg}" + - name: test + run: echo "$node_pkg" + - name: donwload artifact + uses: actions/download-artifact@v2 with: - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - cache-to: type=inline - file: docker/Dockerfile - context: . - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + name: ${{ matrix.target }} + path: homestar-runtime/npm/$node_pkg/bin + - name: Display structure of downloaded files + run: ls -R + + + + # build-packages: + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # include: + # - target: x86_64-unknown-linux-gnu + # - target: x86_64-unknown-linux-musl + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Install musl-tools + # run: sudo apt update && sudo apt install -y musl-dev musl-tools + # if: matrix.target == 'x86_64-unknown-linux-musl' + + # - name: Install Rust toolchain + # id: toolchain + # uses: dtolnay/rust-toolchain@master + # with: + # toolchain: stable + # targets: ${{ matrix.target }} + + # - name: Override rust-toolchain.toml + # run: rustup override set ${{steps.toolchain.outputs.name}} + + # - name: Install cargo-deb + # uses: taiki-e/cache-cargo-install-action@v1 + # with: + # tool: cargo-deb + + # - name: Install cargo-generate-rpm + # uses: taiki-e/cache-cargo-install-action@v1 + # with: + # tool: cargo-generate-rpm + + # - name: Cache Project + # uses: Swatinem/rust-cache@v2 + # with: + # cache-on-failure: true + # shared-key: check-${{ matrix.target }}-ubuntu-latest + + # - name: Create .deb + # run: cargo deb -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.deb + + # - name: Create .rpm + # run: cargo generate-rpm -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.rpm + + # - name: Upload Release Artifacts + # uses: actions/upload-artifact@v3 + # with: + # name: ${{ matrix.target }} + # path: | + # *.deb + # *.rpm + # if-no-files-found: error + + # - name: Publish Package in Release + # uses: softprops/action-gh-release@v1 + # if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'published' + # with: + # files: | + # *.deb + # *.rpm + + # docker-build: + # runs-on: ubuntu-latest + + # env: + # DOCKER_BUILDKIT: '1' + # REGISTRY: ghcr.io + # IMAGE_NAME: ${{ github.repository }} + + # permissions: + # contents: read + # id-token: write + # packages: write + + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Cleanup + # run: | + # # Workaround to provide additional free space for testing. + # # https://github.com/actions/virtual-environments/issues/2840 + # rm -rf /opt/hostedtoolcache + # rm -rf /usr/share/dotnet + # rm -rf /opt/ghc + # rm -rf "$AGENT_TOOLSDIRECTORY" + # sudo apt-get clean + # sudo rm -rf /usr/share/dotnet + + # - name: Login to GitHub Container Registry + # uses: docker/login-action@v3 + # with: + # registry: ${{ env.REGISTRY }} + # username: ${{ github.repository_owner }} + # password: ${{ secrets.GITHUB_TOKEN }} + + # - name: Setup QEMU + # uses: docker/setup-qemu-action@v3 + + # - name: Setup Buildx + # uses: docker/setup-buildx-action@v3 + + # - name: Metadata + # id: meta + # uses: docker/metadata-action@v5 + # with: + # images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + # tags: | + # type=semver,pattern=v{{version}} + # type=semver,pattern={{major}}.{{minor}} + # type=raw,value=latest + # type=sha + + # - name: Docker Build & Push + # uses: docker/build-push-action@v5 + # with: + # cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + # cache-to: type=inline + # file: docker/Dockerfile + # context: . + # platforms: linux/amd64,linux/arm64 + # push: true + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} diff --git a/homestar-runtime/npm/base/package-lock.json b/homestar-runtime/npm/base/package-lock.json index d7c133b7..dcf9b431 100644 --- a/homestar-runtime/npm/base/package-lock.json +++ b/homestar-runtime/npm/base/package-lock.json @@ -1,12 +1,12 @@ { "name": "homestar-runtime", - "version": "0.0.7", + "version": "0.0.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "homestar-runtime", - "version": "0.0.7", + "version": "0.0.8", "license": "MIT", "dependencies": { "execa": "^8.0.1" diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index caa2e431..da6302c0 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -6,9 +6,11 @@ rustup target add aarch64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl +cargo install cargo-get +cargo get workspace.package.version -export node_version=0.0.5 +export node_version=$(cargo get package.version) export bin="homestar" @@ -50,7 +52,8 @@ cp "../../target/x86_64-unknown-linux-musl/release/${bin}" "binaries/${node_pkg} # publish the package cd "${node_pkg}" -npm publish --access public +npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false +npm publish --access public --tag rc ``` ## TODO From 574a8e5c523509461ba3c5f28b1395683a3ddba7 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 28 Nov 2023 21:41:08 +0000 Subject: [PATCH 10/26] chore: ci --- .github/workflows/builds.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index ccdc0ff2..7b01e6a6 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -155,16 +155,15 @@ jobs: echo "node_pkg=${node_pkg}" >> "$GITHUB_ENV" mkdir -p "${node_pkg}/bin" envsubst < package.json.tmpl > "${node_pkg}/package.json" - cd "${node_pkg}" - - name: test - run: echo "$node_pkg" - name: donwload artifact uses: actions/download-artifact@v2 with: name: ${{ matrix.target }} - path: homestar-runtime/npm/$node_pkg/bin + path: "homestar-runtime/npm/$node_pkg/bin" - name: Display structure of downloaded files - run: ls -R + run: | + cd "homestar-runtime/npm/$node_pkg" + ls -R From 4d73c250a02573161fc86734b63f974b14cb81c4 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 28 Nov 2023 21:49:19 +0000 Subject: [PATCH 11/26] chore: ci --- .github/workflows/builds.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 7b01e6a6..b0c839dd 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -137,10 +137,6 @@ jobs: shared-key: check-${{ matrix.target }}-${{ matrix.os }} - name: cargo get run: cargo install cargo-get - - uses: actions/setup-go@v4 - with: - go-version: 'stable' - - run: go install github.com/a8m/envsubst/cmd/envsubst@latest - name: prerelease shell: bash env: @@ -159,10 +155,10 @@ jobs: uses: actions/download-artifact@v2 with: name: ${{ matrix.target }} - path: "homestar-runtime/npm/$node_pkg/bin" + path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" - name: Display structure of downloaded files run: | - cd "homestar-runtime/npm/$node_pkg" + cd "homestar-runtime/npm/${{ env.node_pkg }}" ls -R From 8659d2c1e0a985aa3c001354fec7da291a3221ad Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 28 Nov 2023 21:51:20 +0000 Subject: [PATCH 12/26] chore: ci2 --- .github/workflows/builds.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index b0c839dd..1f100d17 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -18,9 +18,9 @@ on: pull_request: branches: [ '**' ] -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true +# concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: true jobs: binary-builds: @@ -156,7 +156,7 @@ jobs: with: name: ${{ matrix.target }} path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" - - name: Display structure of downloaded files + - name: ls run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" ls -R From eb224114e65bc510a5c1a7dc3baa7c8068cae552 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 28 Nov 2023 22:02:09 +0000 Subject: [PATCH 13/26] chore: ci3 --- .github/workflows/builds.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 1f100d17..debe7330 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -127,14 +127,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Install Rust Toolchain - id: toolchain - uses: dtolnay/rust-toolchain@stable - - name: Cache Project - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - shared-key: check-${{ matrix.target }}-${{ matrix.os }} - name: cargo get run: cargo install cargo-get - name: prerelease @@ -146,9 +138,8 @@ jobs: node_pkg: ${{ matrix.bin }}-${{ matrix.os }}-${{ matrix.arch }} run: | export node_version=$(cargo get workspace.package.version) - cd homestar-runtime/npm - echo "node_bin=${bin}" >> "$GITHUB_ENV" echo "node_pkg=${node_pkg}" >> "$GITHUB_ENV" + cd homestar-runtime/npm mkdir -p "${node_pkg}/bin" envsubst < package.json.tmpl > "${node_pkg}/package.json" - name: donwload artifact @@ -159,6 +150,8 @@ jobs: - name: ls run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" + npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false + cat package.json ls -R From 0b7f632f19521ebb248ad1b4b2a3bad7f8e16b3b Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Tue, 28 Nov 2023 22:11:25 +0000 Subject: [PATCH 14/26] chore: ci4 --- .github/workflows/builds.yml | 320 ++++++++++++++++++----------------- 1 file changed, 162 insertions(+), 158 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index debe7330..c62d44b9 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -28,22 +28,22 @@ jobs: fail-fast: false matrix: include: - # - target: aarch64-unknown-linux-gnu + - target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-musl npm: linux-arm64 - # - target: aarch64-apple-darwin - # os: macos-latest - # npm: darwin-arm64 - # - target: x86_64-unknown-linux-gnu - # - target: x86_64-unknown-linux-musl - # npm: linux-x64 - # - target: x86_64-apple-darwin - # os: macos-latest - # npm: darwin-x64 - # - target: x86_64-pc-windows-msvc - # os: windows-latest - # npm: windows-x64 - # - target: x86_64-unknown-freebsd + - target: aarch64-apple-darwin + os: macos-latest + npm: darwin-arm64 + - target: x86_64-unknown-linux-gnu + - target: x86_64-unknown-linux-musl + npm: linux-x64 + - target: x86_64-apple-darwin + os: macos-latest + npm: darwin-x64 + - target: x86_64-pc-windows-msvc + os: windows-latest + npm: windows-x64 + - target: x86_64-unknown-freebsd permissions: contents: write @@ -111,25 +111,29 @@ jobs: os: linux arch: arm64 bin: homestar - # - target: x86_64-unknown-linux-musl - # os: linux - # arch: x64 - # - target: aarch64-apple-darwin - # os: darwin - # arch: arm64 - # - target: x86_64-apple-darwin - # npm: darwin-x64 - # os: darwin - # arch: x64 - # - target: x86_64-pc-windows-msvc - # os: windows - # arch: x64 + - target: x86_64-unknown-linux-musl + os: linux + arch: x64 + bin: homestar + - target: aarch64-apple-darwin + os: darwin + arch: arm64 + bin: homestar + - target: x86_64-apple-darwin + npm: darwin-x64 + os: darwin + arch: x64 + bin: homestar + - target: x86_64-pc-windows-msvc + os: windows + arch: x64 + bin: homestar.exe steps: - name: Checkout uses: actions/checkout@v4 - name: cargo get run: cargo install cargo-get - - name: prerelease + - name: prepare os/arch packages shell: bash env: node_os: ${{ matrix.os }} @@ -142,12 +146,12 @@ jobs: cd homestar-runtime/npm mkdir -p "${node_pkg}/bin" envsubst < package.json.tmpl > "${node_pkg}/package.json" - - name: donwload artifact + - name: download build artifacts uses: actions/download-artifact@v2 with: name: ${{ matrix.target }} path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" - - name: ls + - name: publish rc or production run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false @@ -156,131 +160,131 @@ jobs: - # build-packages: - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # include: - # - target: x86_64-unknown-linux-gnu - # - target: x86_64-unknown-linux-musl - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - - # - name: Install musl-tools - # run: sudo apt update && sudo apt install -y musl-dev musl-tools - # if: matrix.target == 'x86_64-unknown-linux-musl' - - # - name: Install Rust toolchain - # id: toolchain - # uses: dtolnay/rust-toolchain@master - # with: - # toolchain: stable - # targets: ${{ matrix.target }} - - # - name: Override rust-toolchain.toml - # run: rustup override set ${{steps.toolchain.outputs.name}} - - # - name: Install cargo-deb - # uses: taiki-e/cache-cargo-install-action@v1 - # with: - # tool: cargo-deb - - # - name: Install cargo-generate-rpm - # uses: taiki-e/cache-cargo-install-action@v1 - # with: - # tool: cargo-generate-rpm - - # - name: Cache Project - # uses: Swatinem/rust-cache@v2 - # with: - # cache-on-failure: true - # shared-key: check-${{ matrix.target }}-ubuntu-latest - - # - name: Create .deb - # run: cargo deb -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.deb - - # - name: Create .rpm - # run: cargo generate-rpm -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.rpm - - # - name: Upload Release Artifacts - # uses: actions/upload-artifact@v3 - # with: - # name: ${{ matrix.target }} - # path: | - # *.deb - # *.rpm - # if-no-files-found: error - - # - name: Publish Package in Release - # uses: softprops/action-gh-release@v1 - # if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'published' - # with: - # files: | - # *.deb - # *.rpm - - # docker-build: - # runs-on: ubuntu-latest - - # env: - # DOCKER_BUILDKIT: '1' - # REGISTRY: ghcr.io - # IMAGE_NAME: ${{ github.repository }} - - # permissions: - # contents: read - # id-token: write - # packages: write - - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - - # - name: Cleanup - # run: | - # # Workaround to provide additional free space for testing. - # # https://github.com/actions/virtual-environments/issues/2840 - # rm -rf /opt/hostedtoolcache - # rm -rf /usr/share/dotnet - # rm -rf /opt/ghc - # rm -rf "$AGENT_TOOLSDIRECTORY" - # sudo apt-get clean - # sudo rm -rf /usr/share/dotnet - - # - name: Login to GitHub Container Registry - # uses: docker/login-action@v3 - # with: - # registry: ${{ env.REGISTRY }} - # username: ${{ github.repository_owner }} - # password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Setup QEMU - # uses: docker/setup-qemu-action@v3 - - # - name: Setup Buildx - # uses: docker/setup-buildx-action@v3 - - # - name: Metadata - # id: meta - # uses: docker/metadata-action@v5 - # with: - # images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # tags: | - # type=semver,pattern=v{{version}} - # type=semver,pattern={{major}}.{{minor}} - # type=raw,value=latest - # type=sha - - # - name: Docker Build & Push - # uses: docker/build-push-action@v5 - # with: - # cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - # cache-to: type=inline - # file: docker/Dockerfile - # context: . - # platforms: linux/amd64,linux/arm64 - # push: true - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} + build-packages: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-gnu + - target: x86_64-unknown-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install musl-tools + run: sudo apt update && sudo apt install -y musl-dev musl-tools + if: matrix.target == 'x86_64-unknown-linux-musl' + + - name: Install Rust toolchain + id: toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: ${{ matrix.target }} + + - name: Override rust-toolchain.toml + run: rustup override set ${{steps.toolchain.outputs.name}} + + - name: Install cargo-deb + uses: taiki-e/cache-cargo-install-action@v1 + with: + tool: cargo-deb + + - name: Install cargo-generate-rpm + uses: taiki-e/cache-cargo-install-action@v1 + with: + tool: cargo-generate-rpm + + - name: Cache Project + uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + shared-key: check-${{ matrix.target }}-ubuntu-latest + + - name: Create .deb + run: cargo deb -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.deb + + - name: Create .rpm + run: cargo generate-rpm -p homestar-runtime --target ${{ matrix.target }} --variant ${{ matrix.target }} --output homestar.rpm + + - name: Upload Release Artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.target }} + path: | + *.deb + *.rpm + if-no-files-found: error + + - name: Publish Package in Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'release' && github.event.action == 'published' + with: + files: | + *.deb + *.rpm + + docker-build: + runs-on: ubuntu-latest + + env: + DOCKER_BUILDKIT: '1' + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + + permissions: + contents: read + id-token: write + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cleanup + run: | + # Workaround to provide additional free space for testing. + # https://github.com/actions/virtual-environments/issues/2840 + rm -rf /opt/hostedtoolcache + rm -rf /usr/share/dotnet + rm -rf /opt/ghc + rm -rf "$AGENT_TOOLSDIRECTORY" + sudo apt-get clean + sudo rm -rf /usr/share/dotnet + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Setup Buildx + uses: docker/setup-buildx-action@v3 + + - name: Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern=v{{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest + type=sha + + - name: Docker Build & Push + uses: docker/build-push-action@v5 + with: + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + cache-to: type=inline + file: docker/Dockerfile + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 73bc75c9d97a8e5ed800f317c7c5ca6593115f97 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 12:28:24 +0000 Subject: [PATCH 15/26] chore: tweak ci --- .github/workflows/builds.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index c62d44b9..afd17ad6 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -110,48 +110,41 @@ jobs: - target: aarch64-unknown-linux-musl os: linux arch: arm64 - bin: homestar - target: x86_64-unknown-linux-musl os: linux arch: x64 - bin: homestar - target: aarch64-apple-darwin os: darwin arch: arm64 - bin: homestar - target: x86_64-apple-darwin - npm: darwin-x64 os: darwin arch: x64 - bin: homestar - target: x86_64-pc-windows-msvc os: windows arch: x64 - bin: homestar.exe steps: - name: Checkout uses: actions/checkout@v4 - - name: cargo get + - name: Install cargo get run: cargo install cargo-get - - name: prepare os/arch packages + - name: Prepare os/arch packages shell: bash env: node_os: ${{ matrix.os }} node_arch: ${{ matrix.arch }} - node_bin: ${{ matrix.bin }} - node_pkg: ${{ matrix.bin }}-${{ matrix.os }}-${{ matrix.arch }} + node_pkg: homestar-${{ matrix.os }}-${{ matrix.arch }} run: | export node_version=$(cargo get workspace.package.version) echo "node_pkg=${node_pkg}" >> "$GITHUB_ENV" cd homestar-runtime/npm mkdir -p "${node_pkg}/bin" envsubst < package.json.tmpl > "${node_pkg}/package.json" - - name: download build artifacts + - name: Download build artifacts uses: actions/download-artifact@v2 with: name: ${{ matrix.target }} path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" - - name: publish rc or production + - name: Publish rc or production run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false From c362a79b407453ee004264758dd871bc81302262 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 13:24:02 +0000 Subject: [PATCH 16/26] chore: try publish rc --- .github/workflows/builds.yml | 25 +++++++++++++++++++------ homestar-runtime/npm/package.json.tmpl | 7 ++++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index afd17ad6..5a247f4c 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -123,8 +123,11 @@ jobs: os: windows arch: x64 steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: 'https://registry.npmjs.org' - name: Install cargo get run: cargo install cargo-get - name: Prepare os/arch packages @@ -140,16 +143,26 @@ jobs: mkdir -p "${node_pkg}/bin" envsubst < package.json.tmpl > "${node_pkg}/package.json" - name: Download build artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: ${{ matrix.target }} path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" - - name: Publish rc or production + - run: echo ${{ github.event_name }} + - name: Publish production + if: github.event_name == 'release' && github.event.action == 'published' + run: | + cd "homestar-runtime/npm/${{ env.node_pkg }}" + pnpm -r publish --access=public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + - name: Publish RC + if: github.event_name == 'workflow_dispatch' || github.event.action == 'pull_request' run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false - cat package.json - ls -R + npm publish --access public --tag rc + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package.json.tmpl index d64f226a..7ed68f38 100644 --- a/homestar-runtime/npm/package.json.tmpl +++ b/homestar-runtime/npm/package.json.tmpl @@ -4,8 +4,13 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "Hugo Dias (hugodias.me)", + "author": "Hugo Dias + (hugodias.me)", "license": "MIT", + "files": [ + "homestar". + "homestar.exe" + ], "os": [ "${node_os}" ], From 665e4344cc1c533699927f2b96826d7d9b97e45c Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 13:25:05 +0000 Subject: [PATCH 17/26] chore: fix RC condition --- .github/workflows/builds.yml | 2 +- homestar-runtime/npm/version | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 homestar-runtime/npm/version diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 5a247f4c..8b1e56ef 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -156,7 +156,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Publish RC - if: github.event_name == 'workflow_dispatch' || github.event.action == 'pull_request' + if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false diff --git a/homestar-runtime/npm/version b/homestar-runtime/npm/version deleted file mode 100644 index 6812f812..00000000 --- a/homestar-runtime/npm/version +++ /dev/null @@ -1 +0,0 @@ -0.0.3 \ No newline at end of file From eab5b563adb35b3dfc8c65891d42a94f60b79c86 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 13:45:27 +0000 Subject: [PATCH 18/26] chore: debug package.json --- .github/workflows/builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 8b1e56ef..c14235c2 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -147,7 +147,6 @@ jobs: with: name: ${{ matrix.target }} path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" - - run: echo ${{ github.event_name }} - name: Publish production if: github.event_name == 'release' && github.event.action == 'published' run: | @@ -160,6 +159,7 @@ jobs: run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false + cat package.json npm publish --access public --tag rc env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} From d18d7a2b1f949ebc84441f6c828db8b5d9a96e1f Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 14:03:23 +0000 Subject: [PATCH 19/26] chore: debug package.json 2 --- .github/workflows/builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index c14235c2..fccf8aa1 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -158,8 +158,8 @@ jobs: if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" - npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false cat package.json + npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false npm publish --access public --tag rc env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} From 1da9c0050a0bff7b90c9c66ef4a5712ef663fa79 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 14:36:08 +0000 Subject: [PATCH 20/26] chore: fix template --- homestar-runtime/npm/package.json.tmpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package.json.tmpl index 7ed68f38..81901686 100644 --- a/homestar-runtime/npm/package.json.tmpl +++ b/homestar-runtime/npm/package.json.tmpl @@ -4,8 +4,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "Hugo Dias - (hugodias.me)", + "author": "Hugo Dias (hugodias.me)", "license": "MIT", "files": [ "homestar". From e1643dfa461999c1bf86b1e62cd0749494f03d9d Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 15:11:06 +0000 Subject: [PATCH 21/26] chore: fix template again --- homestar-runtime/npm/package.json.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package.json.tmpl index 81901686..d8e1036f 100644 --- a/homestar-runtime/npm/package.json.tmpl +++ b/homestar-runtime/npm/package.json.tmpl @@ -7,7 +7,7 @@ "author": "Hugo Dias (hugodias.me)", "license": "MIT", "files": [ - "homestar". + "homestar", "homestar.exe" ], "os": [ From b4407efed91c8e29301b7c8278fb7c1fb255d56d Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 16:32:17 +0000 Subject: [PATCH 22/26] chore: debug windows --- .github/workflows/builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index fccf8aa1..8248709e 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -158,7 +158,7 @@ jobs: if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" - cat package.json + ls -R npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false npm publish --access public --tag rc env: From 6eec9b0d983211de82a86f4cdbb8dad5e85858ff Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 16:53:05 +0000 Subject: [PATCH 23/26] chore: publish all the files --- homestar-runtime/npm/package.json.tmpl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package.json.tmpl index d8e1036f..d64f226a 100644 --- a/homestar-runtime/npm/package.json.tmpl +++ b/homestar-runtime/npm/package.json.tmpl @@ -6,10 +6,6 @@ }, "author": "Hugo Dias (hugodias.me)", "license": "MIT", - "files": [ - "homestar", - "homestar.exe" - ], "os": [ "${node_os}" ], From fc819f6e9c7fb88104f0cdad73287a1e975f5a15 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 17:15:08 +0000 Subject: [PATCH 24/26] chore: review, metadata and readme --- .github/workflows/builds.yml | 19 +++++++---------- homestar-runtime/npm/base/package.json | 18 +++++++++++++--- homestar-runtime/npm/package.json.tmpl | 9 +++++++- homestar-runtime/npm/readme.md | 29 +++++++++++++++++++------- 4 files changed, 52 insertions(+), 23 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 8248709e..df2fcbd0 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -15,12 +15,12 @@ on: types: [published] # for debugging - pull_request: - branches: [ '**' ] + # pull_request: + # branches: ['**'] -# concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: binary-builds: @@ -146,26 +146,23 @@ jobs: uses: actions/download-artifact@v3 with: name: ${{ matrix.target }} - path: "homestar-runtime/npm/${{ env.node_pkg }}/bin" + path: 'homestar-runtime/npm/${{ env.node_pkg }}/bin' - name: Publish production if: github.event_name == 'release' && github.event.action == 'published' run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" - pnpm -r publish --access=public + npm publish --access=public env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - name: Publish RC - if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' + if: github.event_name == 'workflow_dispatch' run: | cd "homestar-runtime/npm/${{ env.node_pkg }}" - ls -R npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false npm publish --access public --tag rc env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - build-packages: runs-on: ubuntu-latest strategy: diff --git a/homestar-runtime/npm/base/package.json b/homestar-runtime/npm/base/package.json index d00cb08d..d5a6669a 100644 --- a/homestar-runtime/npm/base/package.json +++ b/homestar-runtime/npm/base/package.json @@ -1,8 +1,21 @@ { "name": "homestar-runtime", "version": "0.0.8", - "description": "Homestar Runtime", + "description": "The IPVM reference implementation", "author": "Hugo Dias (hugodias.me)", + "homepage": "https://github.com/ipvm-wg/homestar/tree/main/homestar-runtime", + "repository": { + "url": "ipvm-wg/homestar", + "directory": "homestar-runtime" + }, + "keywords": [ + "homestar", + "wasm", + "wit", + "webassembly", + "workflows", + "scheduling" + ], "bin": { "homestar": "index.js" }, @@ -10,8 +23,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "keywords": [], - "license": "MIT", + "license": "Apache-2.0", "optionalDependencies": { "homestar-darwin-arm64": "*", "homestar-darwin-x64": "*", diff --git a/homestar-runtime/npm/package.json.tmpl b/homestar-runtime/npm/package.json.tmpl index d64f226a..90d0dc29 100644 --- a/homestar-runtime/npm/package.json.tmpl +++ b/homestar-runtime/npm/package.json.tmpl @@ -1,11 +1,18 @@ { "name": "${node_pkg}", "version": "${node_version}", + "description": "The IPVM reference implementation", + "homepage": "https://github.com/ipvm-wg/homestar/tree/main/homestar-runtime", + "repository": { + "url": "ipvm-wg/homestar", + "directory": "homestar-runtime" + }, + "keywords": ["homestar", "wasm", "wit", "webassembly", "workflows", "scheduling"], "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Hugo Dias (hugodias.me)", - "license": "MIT", + "license": "Apache-2.0", "os": [ "${node_os}" ], diff --git a/homestar-runtime/npm/readme.md b/homestar-runtime/npm/readme.md index da6302c0..cd51c934 100644 --- a/homestar-runtime/npm/readme.md +++ b/homestar-runtime/npm/readme.md @@ -1,16 +1,34 @@ # Homestar NPM packages +## Packages + +- [homestar-runtime](https://www.npmjs.com/package/homestar-runtime) - This is the main package that installs the os specific binary package and runs it. +- [homestar-darwin-arm64](https://www.npmjs.com/package/homestar-darwin-arm64) +- [homestar-darwin-x64](https://www.npmjs.com/package/homestar-darwin-x64) +- [homestar-linux-arm64](https://www.npmjs.com/package/homestar-linux-arm64) +- [homestar-linux-x64](https://www.npmjs.com/package/homestar-linux-x64) +- [homestar-windows-x64](https://www.npmjs.com/package/homestar-windows-x64) + ## Usage +```bash +npx homestar-runtime --help + +# Global install +npm install -g homestar-runtime +homestar start -c config.toml +``` + +## Manual publishing + ```bash rustup target add aarch64-unknown-linux-gnu rustup target add x86_64-unknown-linux-musl cargo install cargo-get -cargo get workspace.package.version -export node_version=$(cargo get package.version) +export node_version=$(cargo get workspace.package.version) export bin="homestar" @@ -50,13 +68,8 @@ mkdir -p "binaries/${node_pkg}/bin" envsubst < package.json.tmpl > "binaries/${node_pkg}/package.json" cp "../../target/x86_64-unknown-linux-musl/release/${bin}" "binaries/${node_pkg}/bin" -# publish the package +# publish the RC package cd "${node_pkg}" npm version $(cargo get package.version)-rc.$(date +%s) --git-tag-version false npm publish --access public --tag rc ``` - -## TODO - -- [ ] move this to CI -- [ ] add windows From 88ec5713851d2da6cd0708cfd69283b2a444732f Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 17:38:17 +0000 Subject: [PATCH 25/26] chore: add npm to root readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 345c2fdb..c452bed1 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ different platforms. - [homebrew][homebrew]: `brew install fission-codes/fission/homestar` This includes `ipfs` in the install by default. +- [npm](https://www.npmjs.com/package/homestar-runtime): `npm install homestar-runtime -g` Wraps the `homestar-runtime` binary in a node script. ## Running Examples From c9b0086730ad6d5c5ab5a0bdc2b8a4d2cee4a800 Mon Sep 17 00:00:00 2001 From: Hugo Dias Date: Wed, 29 Nov 2023 17:53:01 +0000 Subject: [PATCH 26/26] chore: remove todo --- .github/workflows/builds.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index df2fcbd0..e22ad4e9 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -1,7 +1,6 @@ name: ⚃ Builds # TODO: brew formula (Macs), cargo-wix (Windows Installs), cargo-aur (Arch) -# TODO: bring back release hook (vs on PR) on: workflow_dispatch: