-
Notifications
You must be signed in to change notification settings - Fork 45
BLO-131: Contracts & SDK v3 #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ce0dd06
a0b2822
569cd7a
2b6e8b8
0723ecf
4d82dda
82b18e5
dc7c7dc
3dde0df
b7feaeb
309d399
3d1004a
1e11e98
08700f1
2ee3fba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,90 +1,69 @@ | ||
| name: Publish to NPM | ||
| run-name: Publish release ${{ github.event.release.tag_name }} to NPM | ||
| name: Publish | ||
|
|
||
| on: | ||
| release: | ||
| types: [released] # A release was published, or a pre-release was changed to a release. https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads?actionType=released#release | ||
| types: [released] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| attestations: write | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Publish to NPM | ||
| name: Publish | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write # ! Required for GitHub Attestations, removing will create a Sev 0 incident ! | ||
| attestations: write # ! Required for GitHub Attestations, removing will create a Sev 0 incident ! | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Check Input | ||
| run: echo "Release Tag - ${{ github.event.release.tag_name }}" | ||
|
|
||
| - name: Validate Tag | ||
| run: | | ||
| if [[ "${{ github.event.release.tag_name }}" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "Tag ${{ github.event.release.tag_name }} is valid" | ||
| else | ||
| echo "Tag is invalid" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Clean Tag | ||
| id: clean-tag | ||
| run: | | ||
| echo "::set-output name=TAG::$(grep -Eo '[^v]?[0-9]+\.[0-9]+\.[0-9]+$' <<< '${{ github.event.release.tag_name }}')" | ||
|
|
||
| - name: Validated Tag | ||
| run: echo "package.json version - ${{ steps.clean-tag.outputs.TAG }}" | ||
| - name: Initialize submodules | ||
| run: git submodule update --init --recursive | ||
|
|
||
| - name: Setup node | ||
| uses: actions/setup-node@v3 | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| registry-url: https://registry.npmjs.org/ | ||
|
|
||
| - name: Update package.json version | ||
| run: | | ||
| tmp=$(mktemp) | ||
| jq '.version = "${{ steps.clean-tag.outputs.TAG }}"' ./package.json > "$tmp" && mv "$tmp" ./package.json | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| yarn install --frozen-lockfile --network-concurrency 1 | ||
| run: yarn install --frozen-lockfile --network-concurrency 1 | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
|
|
||
| - name: Show Forge Version | ||
| run: forge --version | ||
|
|
||
| - name: Install Forge dependancies | ||
| run: forge install | ||
| - name: Cache Foundry build output | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| foundry-out | ||
| cache | ||
| key: ${{ runner.os }}-foundry-${{ hashFiles('foundry.lock', 'foundry.toml') }} | ||
|
|
||
| - name: Compile contracts | ||
| run: | | ||
| yarn compile | ||
| - name: Compile contracts (Foundry) | ||
| run: forge build | ||
|
|
||
| - name: Build dist files | ||
| run: | | ||
| rm -rf dist && yarn build | ||
| run: yarn build | ||
|
|
||
| # ! Do NOT remove - this will cause a Sev 0 incident ! | ||
| - name: Pack NPM package | ||
| run: | | ||
| npm pack | ||
|
|
||
| - name: Generate attestation | ||
| uses: actions/attest-build-provenance@v1 | ||
| with: | ||
| subject-path: ./*.tgz | ||
| # ! ------------------------------------------------- ! | ||
| run: npm pack | ||
|
|
||
| - name: Publish package | ||
| uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1 | ||
| - name: Publish to NPM | ||
| uses: JS-DevTools/npm-publish@0fd2f4369c5d6bcfcde6091a7c527d810b9b5c3f # v4.1.5 | ||
| with: | ||
| token: ${{ secrets.CONTRACTS_NPM_TOKEN }} | ||
| access: public | ||
| tag: "latest" | ||
| provenance: true | ||
| registry: https://registry.npmjs.org/ | ||
| package: package.json | ||
| tag: latest | ||
| provenance: true | ||
| strategy: all | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Release tag ignores package versionHigh Severity The publish workflow no longer validates the GitHub release tag or updates the Reviewed by Cursor Bugbot for commit 2ee3fba. Configure here. |
||
|
|
||
| - name: Attest build provenance | ||
| uses: actions/attest-build-provenance@v3 | ||
| with: | ||
| subject-path: ./*.tgz | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Provenance attestation after publishMedium Severity The Reviewed by Cursor Bugbot for commit 2ee3fba. Configure here. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,142 +1,116 @@ | ||
| name: test | ||
| name: Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: [main] | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| forge-test: | ||
| name: Run Forge Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v3 | ||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| - name: Show Forge Version | ||
| run: forge --version | ||
| - name: Run tests and install dependancies | ||
| run: forge test -vvv | ||
| - name: Debug Info1 | ||
| if: '!cancelled()' | ||
| run: pwd | ||
| hardhat-test: | ||
| name: Run Hardhat Tests | ||
| solhint: | ||
| name: Run solhint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/* | ||
| cache: 'yarn' | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile --network-concurrency 1 | ||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| - name: Show Forge Version | ||
| run: forge --version | ||
| - name: Install Forge dependancies | ||
| run: forge install | ||
| - name: Run Tests | ||
| run: yarn test | ||
| eslint: | ||
| name: Run eslint | ||
| continue-on-error: true | ||
| - name: Run solhint | ||
| run: yarn run lint | ||
|
|
||
| forge-test: | ||
| name: Run Forge Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v3 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| node-version: lts/* | ||
| cache: 'yarn' | ||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile --network-concurrency 1 | ||
| - name: Run eslint | ||
| run: yarn run eslint | ||
| solhint: | ||
| name: Run solhint | ||
| submodules: recursive | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Initialize submodules | ||
| run: git submodule update --init --recursive | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
|
|
||
| - name: Cache Foundry build output | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| foundry-out | ||
| cache | ||
| key: ${{ runner.os }}-foundry-${{ hashFiles('foundry.lock', 'foundry.toml') }} | ||
|
|
||
| - name: Run Forge tests | ||
| run: forge test -vvv | ||
|
|
||
| package-check: | ||
| name: Package build (v3) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v3 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup node | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: lts/* | ||
| cache: 'yarn' | ||
| node-version-file: ".nvmrc" | ||
| cache: yarn | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile --network-concurrency 1 | ||
| - name: Run solhint | ||
| run: yarn run solhint contracts/**/*.sol | ||
| slither: | ||
| name: Run slither | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v3 | ||
| - name: Uninstall Debian package that slither needs to uninstall | ||
| run: sudo apt remove python3-typing-extensions | ||
| - name: Install Slither | ||
| run: sudo pip3 install slither-analyzer | ||
| - name: Show Slither Version | ||
| run: slither --version | ||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| - name: Show Forge Version | ||
| run: forge --version | ||
| - name: Run slither | ||
| run: slither --compile-force-framework forge --foundry-out-directory foundry-out . | ||
|
|
||
| - name: Build dist files | ||
| run: yarn build | ||
|
|
||
| - name: Pack NPM package | ||
| run: npm pack --dry-run | ||
|
|
||
| # Satisfy legacy required checks from main branch protection until rulesets are updated for v3. | ||
| readme: | ||
| name: Check README.md is contained in each contracts directory | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v3 | ||
| - name: Run check script | ||
| run: sh readmecheck.sh | ||
| dependency-review: | ||
| - uses: actions/checkout@v6 | ||
| - run: sh readmecheck.sh | ||
|
|
||
| hardhat-legacy: | ||
| name: Run Hardhat Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: 'Checkout Repository' | ||
| uses: actions/checkout@v4 | ||
| - name: Dependency Review | ||
| uses: actions/dependency-review-action@v4 | ||
| with: | ||
| # Possible values: "critical", "high", "moderate", "low" | ||
| fail-on-severity: critical | ||
|
|
||
| # Address https://github.com/actions/dependency-review-action/issues/456 | ||
| base-ref: ${{ github.event.pull_request.base.sha || github.event.repository.default_branch }} | ||
| head-ref: ${{ github.event.pull_request.head.sha || github.ref }} | ||
| publish: | ||
| name: Publish to NPM (dry run) | ||
| - run: | | ||
| echo "Hardhat was removed in SDK v3. See README and MIGRATION.md." | ||
| echo "This job exists only to satisfy legacy branch protection on PRs targeting main." | ||
|
|
||
| eslint-legacy: | ||
| name: Run eslint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v3 | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| - run: | | ||
| echo "ESLint is not part of the v3 toolchain (solhint covers Solidity)." | ||
| echo "This job exists only to satisfy legacy branch protection on PRs targeting main." | ||
|
|
||
| slither: | ||
| name: Run slither | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| node-version-file: ".nvmrc" | ||
| registry-url: https://registry.npmjs.org/ | ||
| cache: 'yarn' | ||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile --network-concurrency 1 | ||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| - name: Show Forge Version | ||
| run: forge --version | ||
| - name: Install Forge dependancies | ||
| run: forge install | ||
| - name: Compile contracts | ||
| run: yarn compile | ||
| - name: Build dist files | ||
| run: rm -rf dist && yarn build | ||
| - name: Test publish | ||
| run: npm pack --dry-run | ||
| submodules: recursive | ||
| - run: sudo apt-get update && sudo apt-get install -y python3-pip | ||
| - name: Uninstall Debian package that blocks Slither pip install | ||
| run: sudo apt remove -y python3-typing-extensions | ||
| - run: sudo pip3 install slither-analyzer | ||
| - uses: foundry-rs/foundry-toolchain@v1 | ||
| - run: slither --compile-force-framework forge --foundry-out-directory foundry-out . |


Uh oh!
There was an error while loading. Please reload this page.