Skip to content

Commit

Permalink
Update toggle local scripts for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ytham committed Jan 17, 2024
1 parent fbd7e40 commit 8299fcf
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 19 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/halo2-browser-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Build halo2-wasm
working-directory: halo2-wasm
run: |
rustup toolchain install nightly-2023-08-12-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-08-12-x86_64-unknown-linux-gnu
cargo build --target=x86_64-unknown-linux-gnu --verbose
- name: Build halo2-lib-js
working-directory: halo2-lib-js
run: |
npm install
npm add @axiom-crypto/[email protected]
- name: Set all packages to local and build
working-directory: ./
run: ./scripts/toggleLocal.sh ci
# - name: Build halo2-wasm
# working-directory: halo2-wasm
# run: |
# rustup toolchain install nightly-2023-08-12-x86_64-unknown-linux-gnu
# rustup component add rust-src --toolchain nightly-2023-08-12-x86_64-unknown-linux-gnu
# cargo build --target=x86_64-unknown-linux-gnu --verbose
# - name: Build halo2-lib-js
# working-directory: halo2-lib-js
# run: |
# npm install
# npm add @axiom-crypto/[email protected]
- name: Test halo2-lib-js/halo2-wasm VK equivalence
working-directory: halo2-lib-js
run: npm run test:vk
Expand Down
8 changes: 7 additions & 1 deletion cli/scripts/toggleLocal.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
const fs = require('fs');
const packageJson = require('../package.json');

let ci = false;
if (process.argv[2] === "ci") {
ci = true;
}
const local = ci ? "file:" : "link:";

const main = () => {
const packageJsonCopy = { ...packageJson };
packageJsonCopy.dependencies['@axiom-crypto/halo2-wasm'] = 'link:../halo2-wasm/pkg';
packageJsonCopy.dependencies['@axiom-crypto/halo2-wasm'] = `${local}../halo2-wasm/pkg`;
fs.writeFileSync('./package.json', JSON.stringify(packageJsonCopy, null, 2));
}

Expand Down
8 changes: 7 additions & 1 deletion halo2-lib-js/scripts/toggleLocal.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
const fs = require('fs');
const packageJson = require('../package.json');

let ci = false;
if (process.argv[2] === "ci") {
ci = true;
}
const local = ci ? "file:" : "link:";

const main = () => {
const packageJsonCopy = { ...packageJson };
packageJsonCopy.dependencies['@axiom-crypto/halo2-wasm'] = 'link:../halo2-wasm/pkg';
packageJsonCopy.dependencies['@axiom-crypto/halo2-wasm'] = `${local}../halo2-wasm/pkg`;
fs.writeFileSync('./package.json', JSON.stringify(packageJsonCopy, null, 2));
}

Expand Down
10 changes: 8 additions & 2 deletions halo2-repl/scripts/toggleLocal.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
const fs = require('fs');
const packageJson = require('../package.json');

let ci = false;
if (process.argv[2] === "ci") {
ci = true;
}
const local = ci ? "file:" : "link:";

const main = () => {
const packageJsonCopy = { ...packageJson };
packageJsonCopy.dependencies['@axiom-crypto/halo2-wasm'] = 'link:../halo2-wasm/pkg';
packageJsonCopy.dependencies['@axiom-crypto/halo2-lib-js'] = 'link:../halo2-lib-js/dist';
packageJsonCopy.dependencies['@axiom-crypto/halo2-wasm'] = `${local}../halo2-wasm/pkg`;
packageJsonCopy.dependencies['@axiom-crypto/halo2-lib-js'] = `${local}../halo2-lib-js/dist`;
fs.writeFileSync('./package.json', JSON.stringify(packageJsonCopy, null, 2));
}

Expand Down
2 changes: 1 addition & 1 deletion halo2-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "halo2-wasm"
version = "0.2.12-alpha.0"
version = "0.2.13-rc2.0"
edition = "2021"

[lib]
Expand Down
13 changes: 10 additions & 3 deletions scripts/toggleLocal.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash

CI=""
if [ "$1" = "ci" ]; then
CI="ci"
fi
echo $CI

./scripts/build.sh
cd halo2-lib-js
node ./scripts/toggleLocal.js
node ./scripts/toggleLocal.js $CI
pnpm install
cd ../halo2-repl
node ./scripts/toggleLocal.js
node ./scripts/toggleLocal.js $CI
pnpm install
cd ../cli
node ./scripts/toggleLocal.js
node ./scripts/toggleLocal.js $CI
pnpm install

0 comments on commit 8299fcf

Please sign in to comment.