diff --git a/circuits/cpp/barretenberg/.github/workflows/bbjs-testing.yml b/circuits/cpp/barretenberg/.github/workflows/bbjs-testing.yml new file mode 100644 index 00000000000..fe480bcb8a2 --- /dev/null +++ b/circuits/cpp/barretenberg/.github/workflows/bbjs-testing.yml @@ -0,0 +1,81 @@ +name: Test bb.js + +on: + push: + branches: + - "**" + +jobs: + build: + timeout-minutes: 60 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "18" + registry-url: "https://registry.npmjs.org" + + - name: Install bleeding edge cmake + run: | + sudo apt -y remove --purge cmake + sudo snap install cmake --classic + + - name: Create Build Environment + run: | + sudo apt-get update + sudo apt-get -y install ninja-build yarn + + - name: Install yarn + run: | + curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - + echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list + sudo apt -y update && sudo apt -y install yarn + + - name: Install WASI-SDK + run: | + cd cpp + ./scripts/install-wasi-sdk.sh + + - name: Compile Typescript + run: | + cd ts + yarn install && yarn && yarn build + + - name: Pack the library for npm + run: | + cd ts + npm pack + echo "TARBALL_NAME=$(ls *.tgz)" >> $GITHUB_ENV + + - name: Checkout nextjs-bbjs-demo repository + uses: actions/checkout@v3 + with: + repository: noir-lang/nextjs-bbjs-demo + path: nextjs-bbjs-demo + + - name: Update package.json to point to local tarball dependency + run: | + jq ".dependencies[\"@aztec/bb.js\"] = \"file:../ts/${TARBALL_NAME}\"" nextjs-bbjs-demo/package.json > nextjs-bbjs-demo/package.temp.json + mv nextjs-bbjs-demo/package.temp.json nextjs-bbjs-demo/package.json + cat nextjs-bbjs-demo/package.json + + - name: Install dependencies in nextjs-bbjs-demo + run: | + cd nextjs-bbjs-demo + npm install + + - name: Output bb.js package contents + run: | + cd nextjs-bbjs-demo/node_modules/@aztec/bb.js + + - name: Run dev and test scripts concurrently + run: | + cd nextjs-bbjs-demo + npm run dev + sleep 30 + npm run test