From 0fc8f20b8b87d033d27ce18db039399c17f81837 Mon Sep 17 00:00:00 2001 From: Koby Hall <102518238+kobyhallx@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:16:03 +0200 Subject: [PATCH] fix: minor problems with `aztec` publishing (#3095) Co-authored-by: Tom French --- .github/workflows/publish-es-packages.yml | 66 ++++++++----- acvm-repo/acvm_js/package.json | 6 +- compiler/source-resolver/package.json | 2 +- compiler/wasm/package.json | 7 +- package.json | 93 +++++++++---------- tooling/noir_js/package.json | 2 +- .../noir_js_backend_barretenberg/package.json | 2 +- tooling/noir_js_types/package.json | 2 +- tooling/noirc_abi_wasm/package.json | 6 +- 9 files changed, 106 insertions(+), 80 deletions(-) diff --git a/.github/workflows/publish-es-packages.yml b/.github/workflows/publish-es-packages.yml index c05e9fcacc9..14630434453 100644 --- a/.github/workflows/publish-es-packages.yml +++ b/.github/workflows/publish-es-packages.yml @@ -6,6 +6,7 @@ on: noir-ref: description: The noir reference to checkout required: false + default: 'master' npm-tag: description: Repository Tag to publish under required: false @@ -20,7 +21,7 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 with: - ref: ${{ inputs.noir-ref || 'master' }} + ref: ${{ inputs.noir-ref }} - name: Setup Nix uses: ./.github/actions/nix @@ -32,19 +33,26 @@ jobs: - name: Enable aztec features if: ${{ inputs.npm-tag == 'aztec' }} run: | - echo "\ndefault = [\"aztec\"]" >> compiler/noirc_frontend/Cargo.toml + echo $'\n'"default = [\"aztec\"]"$'\n' >> compiler/noirc_frontend/Cargo.toml - name: Build wasm package run: | nix build -L .#noir_wasm + - uses: actions/upload-artifact@v3 + with: + name: noir_wasm + path: | + result/noir_wasm/nodejs + result/noir_wasm/web + build-noirc_abi_wasm: runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v4 with: - ref: ${{ inputs.noir-ref || 'master' }} + ref: ${{ inputs.noir-ref }} - name: Setup Nix uses: ./.github/actions/nix @@ -52,18 +60,25 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} nix-cache-name: ${{ vars.NIX_CACHE_NAME }} cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - + - name: Build wasm package run: | nix build -L .#noirc_abi_wasm + - uses: actions/upload-artifact@v3 + with: + name: noirc_abi_wasm + path: | + result/noirc_abi_wasm/nodejs + result/noirc_abi_wasm/web + build-acvm_js: runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v4 with: - ref: ${{ inputs.noir-ref || 'master' }} + ref: ${{ inputs.noir-ref }} - name: Setup Nix uses: ./.github/actions/nix @@ -71,46 +86,51 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} nix-cache-name: ${{ vars.NIX_CACHE_NAME }} cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} - + - name: Build wasm package run: | nix build -L .#acvm_js + + - uses: actions/upload-artifact@v3 + with: + name: acvm_js + path: | + result/acvm_js/nodejs + result/acvm_js/web publish-es-packages: runs-on: ubuntu-latest needs: [build-acvm_js, build-noirc_abi_wasm, build-noir_wasm] steps: + - name: Checkout sources uses: actions/checkout@v4 with: - ref: ${{ inputs.noir-ref || 'master' }} + ref: ${{ inputs.noir-ref }} - - name: Setup Nix - uses: ./.github/actions/nix + - uses: actions/download-artifact@v3 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - nix-cache-name: ${{ vars.NIX_CACHE_NAME }} - cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + name: acvm_js + path: acvm-repo/acvm_js + - uses: actions/download-artifact@v3 + with: + name: noir_wasm + path: compiler/wasm + - uses: actions/download-artifact@v3 + with: + name: noirc_abi_wasm + path: tooling/noirc_abi_wasm - name: Install Yarn dependencies run: yarn install - - name: Enable aztec features - if: ${{ inputs.npm-tag == 'aztec' }} - run: | - echo "\ndefault = [\"aztec\"]" >> compiler/noirc_frontend/Cargo.toml - - name: Build ES Packages - run: yarn prepare:publish + run: yarn build:js:only - name: Prepare nightly version if: ${{ inputs.npm-tag != 'latest' }} run: | - yarn nightly:version - - - name: Update Version as specific tag - run: | - jq '.version = .version + "-${{ inputs.npm-tag }}"' package.json > package-tmp.json && mv package-tmp.json package.json + yarn nightly:version -- .${{ inputs.npm-tag }} - name: Authenticate with npm run: "echo npmAuthToken: ${{ secrets.NPM_TOKEN }} > ~/.yarnrc.yml" diff --git a/acvm-repo/acvm_js/package.json b/acvm-repo/acvm_js/package.json index e7de149ec5c..6c20627400c 100644 --- a/acvm-repo/acvm_js/package.json +++ b/acvm-repo/acvm_js/package.json @@ -28,8 +28,10 @@ "test:browser": "web-test-runner", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", - "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", - "clean": "chmod u+w web nodejs || true && rm -rf web nodejs" + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "clean": "chmod u+w web nodejs || true && rm -rf web nodejs", + "build:nix": "nix build -L .#acvm_js", + "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/acvm_js/nodejs ./ && cp -rL ./result/acvm_js/web ./" }, "devDependencies": { "@esm-bundle/chai": "^4.3.4-fix.0", diff --git a/compiler/source-resolver/package.json b/compiler/source-resolver/package.json index 7a5f29f5584..7f9530324b6 100644 --- a/compiler/source-resolver/package.json +++ b/compiler/source-resolver/package.json @@ -24,7 +24,7 @@ "test": "ava", "generate-types": "tsc src/*.ts --declaration --emitDeclarationOnly --outDir types", "clean": "rm -rf ./lib ./lib-node", - "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" }, diff --git a/compiler/wasm/package.json b/compiler/wasm/package.json index 00dcb8f046a..2b47227c5f8 100644 --- a/compiler/wasm/package.json +++ b/compiler/wasm/package.json @@ -24,9 +24,12 @@ "test:node": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha", "test:browser": "web-test-runner", "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result", - "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", - "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", + "build:nix": "nix build -L .#noir_wasm", + "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noir_wasm/nodejs ./ && cp -rL ./result/noir_wasm/web ./" + }, "peerDependencies": { "@noir-lang/source-resolver": "workspace:*" diff --git a/package.json b/package.json index 64e0de0e4cc..a72d208f55b 100644 --- a/package.json +++ b/package.json @@ -1,49 +1,48 @@ { - "name": "@noir-lang/root", - "private": true, - "workspaces": [ - "compiler/wasm", - "compiler/source-resolver", - "compiler/integration-tests", - "tooling/noir_js_types", - "tooling/noirc_abi_wasm", - "tooling/noir_js", - "tooling/noir_js_backend_barretenberg", - "acvm-repo/acvm_js", - "release-tests" - ], - "scripts": { - "build": "yarn workspaces foreach --parallel --topological-dev --verbose run build", - "test": "yarn workspaces foreach run test", - "test:integration": "yarn workspace integration-tests test", - "clean:workspaces": "yarn workspaces foreach --exclude @noir-lang/root run clean", - "clean:root": "rm -rf ./result ./target", - "clean": "yarn clean:workspaces && yarn clean:root", - "lint": "yarn workspaces foreach --verbose run lint", - "build:with:nix": "nix build -L .#all_wasm", - "install:from:nix:noirc_abi_wasm": "cp -rL ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm && cp -rL ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm", - "install:from:nix:noir_wasm": "cp -rL ./result/noir_wasm/nodejs ./compiler/wasm && cp -rL ./result/noir_wasm/web ./compiler/wasm", - "install:from:nix:acvm_js": "cp -rL ./result/acvm_js/nodejs ./acvm-repo/acvm_js && cp -rL ./result/acvm_js/web ./acvm-repo/acvm_js", - "install:from:nix": "yarn build:with:nix && yarn install:from:nix:noirc_abi_wasm && yarn install:from:nix:noir_wasm && yarn install:from:nix:acvm_js", - "build:types": "yarn workspace @noir-lang/types run build", - "build:source-resolver": "yarn workspace @noir-lang/source-resolver run build", - "build:backend_barretenberg": "yarn workspace @noir-lang/backend_barretenberg run build", - "build:noir_js": "yarn workspace @noir-lang/noir_js run build", - "build:js:only": "yarn build:types && yarn build:source-resolver && yarn build:backend_barretenberg && yarn build:noir_js", - "prepare:publish": "yarn clean && yarn install:from:nix && yarn build:js:only", - "nightly:version": "yarn workspaces foreach run nightly:version", - "publish:all": "yarn install && yarn workspaces foreach run publish" - }, - "devDependencies": { - "@typescript-eslint/eslint-plugin": "^6.7.3", - "@typescript-eslint/parser": "^6.7.3", - "chai": "^4.3.7", - "eslint": "^8.50.0", - "eslint-plugin-prettier": "^5.0.0", - "mocha": "^10.2.0", - "prettier": "3.0.3", - "ts-node": "^10.9.1", - "typescript": "^5.0.4" - }, - "packageManager": "yarn@3.6.4" + "name": "@noir-lang/root", + "private": true, + "workspaces": [ + "compiler/wasm", + "compiler/source-resolver", + "compiler/integration-tests", + "tooling/noir_js_types", + "tooling/noirc_abi_wasm", + "tooling/noir_js", + "tooling/noir_js_backend_barretenberg", + "acvm-repo/acvm_js", + "release-tests" + ], + "scripts": { + "build": "yarn workspaces foreach --parallel --topological-dev --verbose run build", + "test": "yarn workspaces foreach run test", + "test:integration": "yarn workspace integration-tests test", + "clean:workspaces": "yarn workspaces foreach --exclude @noir-lang/root run clean", + "clean:root": "rm -rf ./result ./target", + "clean": "yarn clean:workspaces && yarn clean:root", + "lint": "yarn workspaces foreach --verbose run lint", + "install:acvm_js": "yarn workspace @noir-lang/acvm_js run install:from:nix", + "install:noir_wasm": "yarn workspace @noir-lang/noir_wasm run install:from:nix", + "install:noirc_abi_wasm": "yarn workspace @noir-lang/noirc_abi run install:from:nix", + "install:from:nix": "yarn install:acvm_js && yarn install:noir_wasm && yarn install:noirc_abi_wasm", + "build:types": "yarn workspace @noir-lang/types run build", + "build:source-resolver": "yarn workspace @noir-lang/source-resolver run build", + "build:backend_barretenberg": "yarn workspace @noir-lang/backend_barretenberg run build", + "build:noir_js": "yarn workspace @noir-lang/noir_js run build", + "build:js:only": "yarn build:types && yarn build:source-resolver && yarn build:backend_barretenberg && yarn build:noir_js", + "prepare:publish": "yarn clean && yarn install:from:nix && yarn build:js:only", + "nightly:version": "yarn workspaces foreach run nightly:version", + "publish:all": "yarn install && yarn workspaces foreach run publish" + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^6.7.3", + "@typescript-eslint/parser": "^6.7.3", + "chai": "^4.3.7", + "eslint": "^8.50.0", + "eslint-plugin-prettier": "^5.0.0", + "mocha": "^10.2.0", + "prettier": "3.0.3", + "ts-node": "^10.9.1", + "typescript": "^5.0.4" + }, + "packageManager": "yarn@3.6.4" } diff --git a/tooling/noir_js/package.json b/tooling/noir_js/package.json index b1e4ebb149c..3f17a1a44b2 100644 --- a/tooling/noir_js/package.json +++ b/tooling/noir_js/package.json @@ -34,7 +34,7 @@ "prettier": "prettier 'src/**/*.ts'", "prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", - "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", "clean": "rm -rf ./lib" }, diff --git a/tooling/noir_js_backend_barretenberg/package.json b/tooling/noir_js_backend_barretenberg/package.json index 9482f2bc581..afc0a75d19e 100644 --- a/tooling/noir_js_backend_barretenberg/package.json +++ b/tooling/noir_js_backend_barretenberg/package.json @@ -27,7 +27,7 @@ "clean": "rm -rf ./lib", "prettier": "prettier 'src/**/*.ts'", "prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'", - "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" }, diff --git a/tooling/noir_js_types/package.json b/tooling/noir_js_types/package.json index f4801a546c7..547a6f9faf4 100644 --- a/tooling/noir_js_types/package.json +++ b/tooling/noir_js_types/package.json @@ -17,7 +17,7 @@ "build:esm": "tsc", "build:cjs": "tsc --module CommonJS --outDir lib/cjs", "build": "yarn run build:cjs && yarn run build:esm", - "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" }, diff --git a/tooling/noirc_abi_wasm/package.json b/tooling/noirc_abi_wasm/package.json index a4e076dd0b6..7dc2858cd57 100644 --- a/tooling/noirc_abi_wasm/package.json +++ b/tooling/noirc_abi_wasm/package.json @@ -26,9 +26,11 @@ "test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha", "test:browser": "web-test-runner", "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result", - "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", - "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", + "build:nix": "nix build -L .#noirc_abi_wasm", + "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noirc_abi_wasm/nodejs ./ && cp -rL ./result/noirc_abi_wasm/web ./" }, "devDependencies": { "@esm-bundle/chai": "^4.3.4-fix.0",