feat: add SDK package (#12)

This PR introduces the template for the SDK package.
This commit is contained in:
moebius
2025-01-08 13:30:40 +00:00
committed by GitHub
parent 9d7173c9a7
commit b81ed7bc34
25 changed files with 2036 additions and 136 deletions

View File

@@ -1,6 +1,13 @@
name: CI
name: Circuits
on: [push]
on:
push:
paths:
- "packages/circuits/**"
pull_request:
branches: [main, dev]
paths:
- "packages/circuits/**"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
@@ -12,7 +19,7 @@ defaults:
jobs:
test:
name: Run Circuits Tests
name: Tests
runs-on: ubuntu-latest
steps:

View File

@@ -1,6 +1,13 @@
name: CI
name: Contracts
on: [push]
on:
push:
paths:
- "packages/contracts/**"
pull_request:
branches: [main, dev]
paths:
- "packages/contracts/**"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
@@ -16,7 +23,7 @@ env:
jobs:
unit-tests:
name: Run Unit Tests
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -43,7 +50,7 @@ jobs:
run: yarn test:unit
integration-tests:
name: Run Integration Tests
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -69,7 +76,7 @@ jobs:
run: yarn test:integration
halmos-tests:
name: Run symbolic execution tests
name: Symbolic execution tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -120,3 +127,69 @@ jobs:
run: yarn --frozen-lockfile --network-concurrency 1
- run: yarn lint:check
upload-coverage:
name: Upload Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1
- name: Run coverage
shell: bash
run: yarn coverage
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- name: Filter directories
run: lcov --remove lcov.info 'test/*' 'script/*' --output-file lcovNew.info --rc lcov_branch_coverage=1 --rc derive_function_end_line=0 --ignore-errors unused
- name: Capture coverage output
id: new-coverage
uses: zgosalvez/github-actions-report-lcov@v4
with:
coverage-files: lcovNew.info
- name: Retrieve previous coverage
uses: actions/download-artifact@v4
with:
name: coverage.info
continue-on-error: true
- name: Check if a previous coverage exists
run: |
if [ ! -f coverage.info ]; then
echo "Artifact not found. Initializing at 0"
echo "0" >> coverage.info
fi
- name: Compare previous coverage
run: |
old=$(cat coverage.info)
new=$(( ${{ steps.new-coverage.outputs.total-coverage }} + ${{ env.COVERAGE_SENSITIVITY_PERCENT }} ))
if [ "$new" -lt "$old" ]; then
echo "Coverage decreased from $old to $new"
exit 1
fi
mv lcovNew.info coverage.info
- name: Upload the new coverage
uses: actions/upload-artifact@v4
with:
name: coverage.info
path: ./coverage.info

View File

@@ -1,77 +0,0 @@
name: Coverage Check
on: [push]
env:
COVERAGE_SENSITIVITY_PERCENT: 1
defaults:
run:
working-directory: packages/contracts
jobs:
upload-coverage:
name: Upload Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1
- name: Run coverage
shell: bash
run: yarn coverage
- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
- name: Filter directories
run: lcov --remove lcov.info 'test/*' 'script/*' --output-file lcovNew.info --rc lcov_branch_coverage=1 --rc derive_function_end_line=0 --ignore-errors unused
- name: Capture coverage output
id: new-coverage
uses: zgosalvez/github-actions-report-lcov@v4
with:
coverage-files: lcovNew.info
- name: Retrieve previous coverage
uses: actions/download-artifact@v4
with:
name: coverage.info
continue-on-error: true
- name: Check if a previous coverage exists
run: |
if [ ! -f coverage.info ]; then
echo "Artifact not found. Initializing at 0"
echo "0" >> coverage.info
fi
- name: Compare previous coverage
run: |
old=$(cat coverage.info)
new=$(( ${{ steps.new-coverage.outputs.total-coverage }} + ${{ env.COVERAGE_SENSITIVITY_PERCENT }} ))
if [ "$new" -lt "$old" ]; then
echo "Coverage decreased from $old to $new"
exit 1
fi
mv lcovNew.info coverage.info
- name: Upload the new coverage
uses: actions/upload-artifact@v4
with:
name: coverage.info
path: ./coverage.info

53
.github/workflows/sdk.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: SDK
on:
push:
paths:
- "packages/sdk/**"
pull_request:
branches: [main, dev]
paths:
- "packages/sdk/**"
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
defaults:
run:
working-directory: packages/sdk
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out github repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1
- name: Run Build
run: yarn build
- name: Check types
run: yarn check-types
unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Check out github repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests with coverage
run: yarn test:cov