Skip to content
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

Add publish workflow, update version and dependencies #7

Merged
merged 7 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs: # each workflow consists of 1+ jobs; by default, all jobs run in parallel
- name: Install dependencies 📦
run: yarn install --frozen-lockfile

- name: Run prettier check
run: yarn prettier

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Publish package

on:
release:
types: [ published ]

env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

jobs:
npm_publish:
runs-on: ubuntu-latest
Expand All @@ -28,3 +33,31 @@ jobs:
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

cargo_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "yarn"
cache-dependency-path: "yarn.lock"

- name: Install dependencies 📦
run: yarn install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Generate contract Rust bindings
run: forge bind -b src/bindings/ --module --overwrite

- name: Publish to crates.io
run: cargo publish
76 changes: 71 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,84 @@ on:

env:
CARGO_TERM_COLOR: always
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}

jobs:
build:
name: Rust Tests
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "yarn"
cache-dependency-path: "yarn.lock"

- name: Install dependencies 📦
run: yarn install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Generate contract Rust bindings
run: forge bind -b src/bindings/ --module --overwrite

- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: clippy

- name: Check lint
run: cargo clippy -- -D warnings

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "yarn"
cache-dependency-path: "yarn.lock"

- name: Install dependencies 📦
run: yarn install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Generate contract Rust bindings
run: forge bind -b src/bindings/ --module --overwrite

- name: Cache Cargo registry
uses: actions/cache@v3
with:
Expand All @@ -32,7 +98,7 @@ jobs:
${{ runner.os }}-cargo-registry-

- name: Build
run: cargo build --verbose
run: cargo build

- name: Run tests
run: cargo test --verbose
run: cargo test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ dist
# Foundry cache
cache
dry-run
src/bindings

# Hardhat cache
artifacts
Expand Down
Loading
Loading