Skip to content
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
51 changes: 47 additions & 4 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,48 @@ jobs:
- name: Run Forge tests
run: forge test -vvv

lint:
name: Lint Rust
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

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

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}

- name: Check formatting
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

build:
name: Build on ${{ matrix.os }}
needs: [test, test-solidity]
needs: [test, test-solidity, lint]
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -123,7 +162,7 @@ jobs:
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu

- name: Cache cargo registry
uses: actions/cache@v4
Expand Down Expand Up @@ -154,10 +193,14 @@ jobs:
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

- name: Strip binary (Linux/macOS)
if: matrix.os != 'windows-latest'
- name: Strip binary (native builds)
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-unknown-linux-gnu'
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}

- name: Strip binary (Linux aarch64 cross-compile)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: aarch64-linux-gnu-strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/tagging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Bump Version

on:
push:
branches: ["main"]

jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
persist-credentials: false
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b #v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set Cargo.toml version to match github tag for docs
shell: bash
env:
RELEASE_TAG: ${{ steps.tag_version.outputs.new_tag }}
run: |
mv docs/python/src/conf.py docs/python/src/conf.py.orig
sed "s/0\\.0\\.0/${RELEASE_TAG//v}/" docs/python/src/conf.py.orig >docs/python/src/conf.py
rm docs/python/src/conf.py.orig
mv docs/python/requirements-docs.txt docs/python/requirements-docs.txt.orig
sed "s/0\\.0\\.0/${RELEASE_TAG//v}/" docs/python/requirements-docs.txt.orig >docs/python/requirements-docs.txt
rm docs/python/requirements-docs.txt.orig

- name: Commit files and create tag
env:
RELEASE_TAG: ${{ steps.tag_version.outputs.new_tag }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git fetch --tags
git checkout -b release-$RELEASE_TAG
git add .
git commit -m "ci: update version string in docs"
git tag -d $RELEASE_TAG
git tag $RELEASE_TAG

- name: Push changes
uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa #master
env:
RELEASE_TAG: ${{ steps.tag_version.outputs.new_tag }}
with:
branch: release-${{ steps.tag_version.outputs.new_tag }}
force: true
tags: true
132 changes: 132 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ path = "src/main.rs"
anyhow = "1.0"
async-trait = "0.1"
axum = { version = "0.8", features = ["macros"] }
tower-http = { version = "0.6", features = ["fs", "trace", "cors"] }
rust-embed = "8.5"
mime_guess = "2.0"
chrono = { version = "0.4", features = ["clock", "serde"] }
clap = "4.5.60"
hex = "0.4"
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ install:
test: test-rust test-solidity

test-rust:
cargo fmt
cargo clippy
cargo nextest run

test-solidity:
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ sudo snap install multipass

2. Install safepaw
```bash
make test
make
```

## Testing
Expand All @@ -58,4 +58,7 @@ make test-rust

# Run solidity tests
make test-solidity
```
```

# Credits
1. [WebUI Assets -From : Sprout Lands -By : Cup Nooble](https://cupnooble.itch.io/sprout-lands-ui-pack)
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[profile.default]
src = "contracts"
test = "solidity-tests"
out = "out"
libs = ["lib"]
solc_version = "0.8.20"
Expand Down
File renamed without changes.
Loading