Skip to content

Commit

Permalink
Merge branch 'tf/split-build-and-test' into tf/yarn-caching
Browse files Browse the repository at this point in the history
* tf/split-build-and-test:
  chore: remove reference to `result` directory
  chore!: Change `noir-lang/noir-source-resolver` to `noir-lang/source-resolver` (#2718)
  chore: clippy fixes (#2719)
  chore: fix version querying
  chore: nits
  chore(ci): fix playwright caching
  chore: pass full `package.json` into build artifact
  chore: clean up straggler `packageManager`
  chore: remove `packageManager" fields from workspace packages
  chore: refresh lockfile
  Update .github/workflows/abi_wasm.yml
  chore: split build and tests jobs in `abi_wasm.yml`
  chore: Integrate noir.js into workspace and CI release workflow (#2705)
  feat: Add initial version of noir.js (#2681)
  chore: switch `release-source-resolver.yml` to use yarn (#2704)
  chore: move stranded test to correct directory (#2701)
  chore(ci): deny wildcard dependencies (#2702)
  chore: fix `noirc_abi_wasm` publish for release-please (#2699)
  • Loading branch information
TomAFrench committed Sep 15, 2023
2 parents e8ed744 + 88ec481 commit 376499a
Show file tree
Hide file tree
Showing 50 changed files with 380 additions and 219 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/abi_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

jobs:
noirc-abi-wasm-build:
build:
runs-on: ubuntu-latest
env:
CACHED_PATH: /tmp/nix-cache
Expand Down Expand Up @@ -77,6 +77,20 @@ jobs:
runs-on: ubuntu-latest

steps:
test:
runs-on: ubuntu-latest
needs: [build]

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Download wasm package artifact
uses: actions/download-artifact@v3
with:
name: noirc_abi_wasm
path: ./tooling/noirc_abi_wasm

- name: Checkout sources
uses: actions/checkout@v3

Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/noir-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release and Publish Noir Js

on:
workflow_dispatch:

jobs:
release-noir-js:
name: Release and Publish Noir Js
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: yarn install --immutable

- name: Install jq
run: sudo apt-get install jq

- name: Install cargo and wasm-bindgen
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo install -f wasm-bindgen-cli --version 0.2.86
- name: Install toml2json
run: |
source $HOME/.cargo/env
cargo install toml2json
- name: Install wasm-opt
run: |
npm i wasm-opt -g
- name: Install wasm32-unknown-unknwown target
run: |
rustup target add wasm32-unknown-unknown
- name: Build noirc_abi
run: yarn workspace @noir-lang/noirc_abi build

- name: Build noir_js
run: yarn workspace @noir-lang/noir_js build

- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Publish to NPM
working-directory: ./tooling/noir_js
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17 changes: 11 additions & 6 deletions .github/workflows/publish-abi_wasm.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Publish ABI Wasm

on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
noir-ref:
description: The noir reference to checkout
required: true

jobs:
noirc-abi-wasm-build:
Expand All @@ -15,6 +16,9 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
repository: "noir-lang/noir"
ref: ${{ inputs.noir-ref }}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -39,8 +43,9 @@ jobs:
mkdir temp_publish_dir
cp -r ${{ env.BUILD_OUTPUT_PATH }}/* temp_publish_dir/
- name: Publish to NPM
- name: Publish to npm
working-directory: ./temp_publish_dir
run: npm publish
run: |
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35 changes: 3 additions & 32 deletions .github/workflows/release-source-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Release and Publish Source Resolver

on:
workflow_dispatch:
inputs:
version:
description: "Version number"
required: false

jobs:
release-source-resolver:
Expand All @@ -15,39 +11,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Bump version
working-directory: ./compiler/source-resolver
id: bump_version
run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
NEW_VERSION=$(npm version patch --no-git-tag-version)
else
NEW_VERSION=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version)
fi
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Install dependencies
working-directory: ./compiler/source-resolver
run: npm install
run: yarn install --immutable

- name: Build noir-source-resolver
working-directory: ./compiler/source-resolver
run: npm run build
run: yarn workspace @noir-lang/source-resolver build

- name: Publish to NPM
working-directory: ./compiler/source-resolver
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Configure git
run: |
git config user.name kevaundray
git config user.email kevtheappdev@gmail.com
- name: Commit updates
run: |
git add compiler/source-resolver/package-lock.json
git add compiler/source-resolver/package.json
git commit -m "chore: Update source-resolver to ${{ env.NEW_VERSION }}"
git push
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,43 @@ jobs:
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}
inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}" }'

publish-noir-js:
name: Publish noir_js package
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Dispatch to noir_wasm
uses: benc-uk/workflow-dispatch@v1
with:
workflow: noir-js.yml
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}

publish-source-resolver:
name: Publish source resolver package
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Dispatch to source resolver
uses: benc-uk/workflow-dispatch@v1
with:
workflow: release-source-resolver.yml
ref: master
token: ${{ secrets.NOIR_REPO_TOKEN }}

dispatch-publish-abi-wasm:
name: Dispatch to publish-abi_wasm workflow
needs: [release-please]
if: ${{ needs.release-please.outputs.tag-name }}
runs-on: ubuntu-latest
steps:
- name: Trigger publish-abi_wasm.yml workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: publish-abi_wasm.yml
repo: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}" }'
6 changes: 3 additions & 3 deletions .github/workflows/test-source-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Build noir-source-resolver
run: yarn workspace @noir-lang/noir-source-resolver build
- name: Build @noir-lang/source-resolver
run: yarn workspace @noir-lang/source-resolver build

- name: Run tests
run: yarn workspace @noir-lang/noir-source-resolver test
run: yarn workspace @noir-lang/source-resolver test
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
run: |
cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm
cp -r ./compiler/wasm/downloaded/web ./compiler/wasm
yarn workspace @noir-lang/noir-source-resolver build
yarn workspace @noir-lang/source-resolver build
- name: Run node tests
run: yarn workspace @noir-lang/noir_wasm test:node
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ compiler/source-resolver/node_modules
compiler/source-resolver/lib
compiler/source-resolver/lib-node

# Noir.js
tooling/noir_js/lib

# Nix stuff
**/outputs
result
Expand Down
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compiler/fm/src/file_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
use wasm_bindgen::{prelude::*, JsValue};

#[wasm_bindgen(module = "@noir-lang/noir-source-resolver")]
#[wasm_bindgen(module = "@noir-lang/source-resolver")]
extern "C" {

#[wasm_bindgen(catch)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"dependencies": {
"@aztec/bb.js": "^0.5.1",
"@noir-lang/acvm_js": "^0.26.0",
"@noir-lang/noir-source-resolver": "workspace:*",
"@noir-lang/noir_wasm": "workspace:*",
"@noir-lang/noirc_abi": "workspace:*",
"@noir-lang/source-resolver": "workspace:*",
"@web/dev-server-esbuild": "^0.3.6",
"@web/test-runner": "^0.15.3",
"@web/test-runner-playwright": "^0.10.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from '@esm-bundle/chai';
import { initialiseResolver } from "@noir-lang/noir-source-resolver";
import { initializeResolver } from "@noir-lang/source-resolver";
import newCompiler, {
compile,
init_log_level as compilerLogLevel
Expand Down Expand Up @@ -66,7 +66,7 @@ test_cases.forEach((testInfo) => {

expect(noir_source).to.be.a.string;

initialiseResolver((id: String) => {
initializeResolver((id: String) => {
console.log("Resolving:", id);
return noir_source;
});
Expand Down
9 changes: 4 additions & 5 deletions compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,13 @@ impl Context {
let predicate_index =
self.acir_context.mul_var(index_var, self.current_side_effects_enabled_var)?;
let new_value = if let Some(store) = store_value {
let store_var = Some(self.convert_value(store, dfg).into_var()?);
let store_var = self.convert_value(store, dfg).into_var()?;
if self.acir_context.is_constant_one(&self.current_side_effects_enabled_var) {
store_var
Some(store_var)
} else {
let dummy = self.array_get(instruction, array, predicate_index, dfg)?;
let true_pred = self
.acir_context
.mul_var(store_var.unwrap(), self.current_side_effects_enabled_var)?;
let true_pred =
self.acir_context.mul_var(store_var, self.current_side_effects_enabled_var)?;
let one = self.acir_context.add_constant(FieldElement::one());
let not_pred =
self.acir_context.sub_var(one, self.current_side_effects_enabled_var)?;
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/ir/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<T> std::hash::Hash for Id<T> {

impl<T> PartialOrd for Id<T> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.index.partial_cmp(&other.index)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/opt/constant_folding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl Context {
fn resolve_instruction(
instruction_id: InstructionId,
dfg: &DataFlowGraph,
constrained_values: &mut HashMap<ValueId, ValueId>,
constrained_values: &HashMap<ValueId, ValueId>,
) -> Instruction {
let instruction = dfg[instruction_id].clone();

Expand Down
4 changes: 1 addition & 3 deletions compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,7 @@ impl<'a> FunctionContext<'a> {
) -> Values {
match expr {
// If we're constraining an equality to be true then constrain the two sides directly.
Expression::Binary(Binary { lhs, operator, rhs, .. })
if operator == &BinaryOpKind::Equal =>
{
Expression::Binary(Binary { lhs, operator: BinaryOpKind::Equal, rhs, .. }) => {
let lhs = self.codegen_non_tuple_expression(lhs);
let rhs = self.codegen_non_tuple_expression(rhs);
self.builder.set_location(location).insert_constrain(lhs, rhs, assert_message);
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/ast/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl PartialEq<Ident> for Ident {

impl PartialOrd for Ident {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.0.contents.partial_cmp(&other.0.contents)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,13 @@ fn take_errors_filter_self_not_resolved(resolver: Resolver<'_>) -> Vec<ResolverE
resolver
.take_errors()
.iter()
.cloned()
.filter(|resolution_error| match resolution_error {
ResolverError::PathResolutionError(PathResolutionError::Unresolved(ident)) => {
&ident.0.contents != "Self"
}
_ => true,
})
.cloned()
.collect()
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<'a> ModCollector<'a> {
};

// Parse the AST for the module we just found and then recursively look for it's defs
let ast = parse_file(&mut context.file_manager, child_file_id, errors);
let ast = parse_file(&context.file_manager, child_file_id, errors);

// Add module into def collector and get a ModuleId
if let Some(child_mod_id) =
Expand Down
Loading

0 comments on commit 376499a

Please sign in to comment.