Use local version for unpublished Cargo projects
This commit is contained in:
parent
a15c0e76f9
commit
0579fccfb1
|
@ -30,11 +30,9 @@ jobs:
|
|||
uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: 14.x
|
||||
- name: Build generated code
|
||||
working-directory: ./gen
|
||||
run: |
|
||||
npm install
|
||||
bash ./gen.sh
|
||||
- name: Run prebuild steps
|
||||
shell: bash
|
||||
run: bash ./prebuild.sh
|
||||
- name: Set up Node.js for benching
|
||||
uses: actions/setup-node@master
|
||||
with:
|
||||
|
|
|
@ -53,6 +53,9 @@ jobs:
|
|||
- name: Set up GCC (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: .\.github\workflows\gcc.ps1
|
||||
- name: Run prebuild steps
|
||||
shell: bash
|
||||
run: bash ./prebuild.sh
|
||||
- name: Build CLI
|
||||
working-directory: ./cli
|
||||
run: cargo build --release -vvv
|
||||
|
|
|
@ -43,6 +43,9 @@ jobs:
|
|||
- name: Set up GCC (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: .\.github\workflows\gcc.ps1
|
||||
- name: Run prebuild steps
|
||||
shell: bash
|
||||
run: bash ./prebuild.sh
|
||||
- name: Build Java native library
|
||||
run: cargo build --release
|
||||
working-directory: ./java
|
||||
|
|
|
@ -50,11 +50,15 @@ jobs:
|
|||
- name: Set up GCC (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: .\.github\workflows\gcc.ps1
|
||||
- name: Run prebuild steps
|
||||
shell: bash
|
||||
run: bash ./prebuild.sh
|
||||
- name: Build native module
|
||||
working-directory: ./nodejs
|
||||
shell: bash
|
||||
run: |
|
||||
npm install
|
||||
node node_modules/neon-cli/bin/cli.js build --release
|
||||
npm run build-binary
|
||||
- name: Install B2 CLI (macOS, Linux)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
|
@ -69,7 +73,7 @@ jobs:
|
|||
run: |
|
||||
binary_name="$(node -e 'console.log([process.platform, process.arch, process.versions.modules].join("__"))')"
|
||||
b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
|
||||
b2 upload-file ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./nodejs/native/index.node "hyperbuild/bin/nodejs/${{ steps.version.outputs.VERSION }}/$binary_name.node"
|
||||
b2 upload-file ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./nodejs/dist/native.node "hyperbuild/bin/nodejs/${{ steps.version.outputs.VERSION }}/$binary_name.node"
|
||||
package:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
@ -91,8 +95,7 @@ jobs:
|
|||
//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}
|
||||
EOF
|
||||
npm install
|
||||
rm -rf dist
|
||||
node node_modules/typescript/bin/tsc
|
||||
npm run build
|
||||
cp ../README.md .
|
||||
if [[ "${{ steps.version.outputs.VERSION }}" != "0.0.0" ]]; then
|
||||
npm publish
|
||||
|
|
|
@ -62,6 +62,9 @@ jobs:
|
|||
- name: Set up GCC (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: .\.github\workflows\gcc.ps1
|
||||
- name: Run prebuild steps
|
||||
shell: bash
|
||||
run: bash ./prebuild.sh
|
||||
- name: Build native module
|
||||
working-directory: ./python
|
||||
run: cargo build --release
|
||||
|
|
|
@ -83,6 +83,9 @@ jobs:
|
|||
- name: Set up GCC (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: .\.github\workflows\gcc.ps1
|
||||
- name: Run prebuild steps
|
||||
shell: bash
|
||||
run: bash ./prebuild.sh
|
||||
- name: Build Ruby native library
|
||||
shell: bash -l {0}
|
||||
run: cargo build --release
|
||||
|
|
|
@ -28,8 +28,6 @@ Speed and effectiveness of Node.js version compared to [html-minfier](https://gi
|
|||
|
||||
Precompiled binaries are available for x86-64 macOS and Linux.
|
||||
|
||||
Building from source currently requires the Go compiler to be installed as well, to build the [JS minifier](https://github.com/evanw/esbuild).
|
||||
|
||||
##### Get
|
||||
|
||||
[macOS](https://wilsonl.in/hyperbuild/bin/0.2.3-macos-x86_64) |
|
||||
|
@ -52,9 +50,13 @@ hyperbuild --src /path/to/src.html --out /path/to/output.min.html
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
hyperbuild = "0.2.3"
|
||||
hyperbuild = { version = "0.2.3", features = ["js-esbuild"] }
|
||||
```
|
||||
|
||||
Building with the `js-esbuild` feature requires the Go compiler to be installed as well, to build the [JS minifier](https://github.com/evanw/esbuild).
|
||||
|
||||
If the `js-esbuild` feature is not enabled, `cfg.minify_js` will have no effect.
|
||||
|
||||
##### Use
|
||||
|
||||
```rust
|
||||
|
|
|
@ -4,7 +4,10 @@ set -e
|
|||
|
||||
pushd "$(dirname "$0")"
|
||||
|
||||
bash ../nodejs/build.sh
|
||||
pushd ../nodejs
|
||||
npm run build
|
||||
npm run build-binary
|
||||
popd
|
||||
|
||||
pushd hyperbuild-bench
|
||||
cargo build --release
|
||||
|
|
|
@ -6,5 +6,5 @@ authors = ["Wilson Lin <code@wilsonl.in>"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
hyperbuild = "0.2.3"
|
||||
hyperbuild = { path = "..", features = ["js-esbuild"] }
|
||||
structopt = "0.3.5"
|
||||
|
|
|
@ -6,7 +6,7 @@ authors = ["Wilson Lin <code@wilsonl.in>"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
hyperbuild = "0.2.3"
|
||||
hyperbuild = { path = "..", features = ["js-esbuild"] }
|
||||
jni = "0.14.0"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Builds native module for current platform and Node.js version.
|
||||
|
||||
set -e
|
||||
|
||||
pushd "$(dirname "$0")"
|
||||
|
||||
npm install
|
||||
|
||||
rm -rf dist
|
||||
npx tsc
|
||||
|
||||
npx neon build --release
|
||||
mv native/index.node "dist/native.node"
|
||||
|
||||
popd
|
|
@ -16,5 +16,5 @@ crate-type = ["cdylib"]
|
|||
neon-build = "0.4.0"
|
||||
|
||||
[dependencies]
|
||||
hyperbuild = { path = "../.." }
|
||||
hyperbuild = { path = "../..", features = ["js-esbuild"] }
|
||||
neon = "0.4.0"
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"install.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run clean && tsc",
|
||||
"build-binary": "neon build --release && mv native/index.node dist/native.node",
|
||||
"clean": "rm -rf dist",
|
||||
"postinstall": "node install.js"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Actions to take before initial or release build of main Rust library.
|
||||
|
||||
set -e
|
||||
|
||||
pushd "$(dirname "$0")"
|
||||
|
||||
# Generate crate::gen::* code.
|
||||
pushd gen
|
||||
npm i
|
||||
bash gen.sh
|
||||
popd
|
||||
|
||||
popd
|
|
@ -10,7 +10,7 @@ name = "hyperbuild_python_lib"
|
|||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
hyperbuild = "0.2.3"
|
||||
hyperbuild = { path = "..", features = ["js-esbuild"] }
|
||||
[dependencies.pyo3]
|
||||
version = "0.11.1"
|
||||
features = ["extension-module"]
|
||||
|
|
|
@ -10,5 +10,5 @@ name = "hyperbuild_ruby_lib"
|
|||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
hyperbuild = "0.2.3"
|
||||
hyperbuild = { path = "..", features = ["js-esbuild"] }
|
||||
rutie = "0.7.0"
|
||||
|
|
38
version
38
version
|
@ -66,7 +66,7 @@ const replaceInFile = (path, pattern, replacement) => writeFileSync(path, readFi
|
|||
if (cmd('git', 'status', '--porcelain', {throwOnStderr: true, captureStdio: true}).stdout) {
|
||||
throw new Error('Working directory not clean');
|
||||
}
|
||||
cmd('bash', './gen.sh', {workingDir: join(__dirname, 'gen')});
|
||||
cmd('bash', './prebuild.sh');
|
||||
// This will also build.
|
||||
cmd('cargo', 'test');
|
||||
|
||||
|
@ -74,24 +74,8 @@ for (const f of ['Cargo.toml', 'cli/Cargo.toml', 'nodejs/native/Cargo.toml', 'ja
|
|||
replaceInFile(f, /^version = "\d+\.\d+\.\d+"\s*$/m, `version = "${NEW_VERSION}"`);
|
||||
}
|
||||
|
||||
for (const f of ['python/setup.py']) {
|
||||
replaceInFile(f, /^(\s*version=)"\d+\.\d+\.\d+",\s*$/m, `$1"${NEW_VERSION}",`);
|
||||
}
|
||||
|
||||
for (const f of ['README.md', 'cli/Cargo.toml', 'nodejs/native/Cargo.toml', 'java/Cargo.toml', 'python/Cargo.toml', 'ruby/Cargo.toml']) {
|
||||
replaceInFile(f, /^hyperbuild = "\d+\.\d+\.\d+"\s*$/m, `hyperbuild = "${NEW_VERSION}"`);
|
||||
}
|
||||
|
||||
for (const f of ['nodejs/package.json']) {
|
||||
replaceInFile(f, /^(\s*"version": )"\d+\.\d+\.\d+",\s*$/m, `$1"${NEW_VERSION}",`);
|
||||
}
|
||||
|
||||
for (const f of ['ruby/hyperbuild.gemspec']) {
|
||||
replaceInFile(f, /^(\s*spec\.version\s*=\s*)"\d+\.\d+\.\d+"\s*$/m, `$1"${NEW_VERSION}"`);
|
||||
}
|
||||
|
||||
for (const f of ['java/pom.xml', 'README.md']) {
|
||||
replaceInFile(f, /(<artifactId>hyperbuild<\/artifactId>\s*<version>)\d+\.\d+\.\d+(<\/version>)/, `$1${NEW_VERSION}$2`);
|
||||
for (const f of ['README.md']) {
|
||||
replaceInFile(f, /^(hyperbuild = \{ version = )"\d+\.\d+\.\d+"/m, `$1"${NEW_VERSION}"`);
|
||||
}
|
||||
|
||||
for (const f of ['README.md']) {
|
||||
|
@ -102,6 +86,22 @@ for (const f of ['README.md', 'bench/README.md']) {
|
|||
replaceInFile(f, /(wilsonl\.in\/hyperbuild\/bench\/)\d+\.\d+\.\d+/g, `$1${NEW_VERSION}`);
|
||||
}
|
||||
|
||||
for (const f of ['java/pom.xml', 'README.md']) {
|
||||
replaceInFile(f, /(<artifactId>hyperbuild<\/artifactId>\s*<version>)\d+\.\d+\.\d+(<\/version>)/, `$1${NEW_VERSION}$2`);
|
||||
}
|
||||
|
||||
for (const f of ['nodejs/package.json']) {
|
||||
replaceInFile(f, /^(\s*"version": )"\d+\.\d+\.\d+",\s*$/m, `$1"${NEW_VERSION}",`);
|
||||
}
|
||||
|
||||
for (const f of ['python/setup.py']) {
|
||||
replaceInFile(f, /^(\s*version=)"\d+\.\d+\.\d+",\s*$/m, `$1"${NEW_VERSION}",`);
|
||||
}
|
||||
|
||||
for (const f of ['ruby/hyperbuild.gemspec']) {
|
||||
replaceInFile(f, /^(\s*spec\.version\s*=\s*)"\d+\.\d+\.\d+"\s*$/m, `$1"${NEW_VERSION}"`);
|
||||
}
|
||||
|
||||
cmd('cargo', 'generate-lockfile');
|
||||
cmd('git', 'add', '-A');
|
||||
cmd('git', 'commit', '-m', NEW_VERSION);
|
||||
|
|
Loading…
Reference in New Issue