Skip to content

Commit

Permalink
Improve ci (#327)
Browse files Browse the repository at this point in the history
* Improve ci

* Use rust workspace

* Bump pnpm
  • Loading branch information
tarrencev authored May 31, 2024
1 parent 2139578 commit f32ba10
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 75 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/build.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: quality

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.78.0

jobs:
ensure-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
target: wasm32-unknown-unknown
- run: |
cd packages/account_sdk
cargo build -r --target wasm32-unknown-unknown -p account-sdk
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
- run: cargo clippy --all-targets --all-features

rust-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt
- uses: actions-rust-lang/rustfmt@v1

ts-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- run: corepack enable pnpm
- uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 9
run_install: false
- run: pnpm install --frozen-lockfile
- run: pnpm lint
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: test

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.78.0

jobs:
rust-test:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.2
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --all-features --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info

ts-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- run: corepack enable pnpm
- uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 9
run_install: false
- run: pnpm install --frozen-lockfile
- run: pnpm test:ci --coverage
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,40 @@ node_modules/

# vite
**/vite.config.*.timestamp-*

**/.venv
**/__pycache__

# Generated by Cargo
# will have compiled files and executables
**/debug/
**/target/
**/abi/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
**/*.pdb

# Envs
**/.cargo/

# Scarb
**/Scarb.lock

# StarkNet Foundry
**/.snfoundry_cache/

# IDEs and editors
**/.vscode/
**/.idea/

# Logs
**/log/

lcov.info
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scarb 2.6.3
starknet-foundry 0.18.0
34 changes: 34 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[workspace]
resolver = "2"
members = ["packages/account_sdk"]

[workspace.package]
edition = "2021"
version = "0.1.0"

[workspace.dependencies]
anyhow = "1"
async-trait = "0.1"
base64 = "0.21"
cainome = { git = "https://github.com/piniom/cainome", rev = "beb1f1f5" }
cairo-lang-starknet = "2.4.0"
coset = { version = "0.3.4", features = ["std"] }
ecdsa = "0.16.9"
futures = "0.3"
lazy_static = "1"
p256 = "0.13"
primitive-types = { version = "0.12", default-features = false }
rand_core = { version = "0.6", features = ["getrandom"] }
serde = "1"
serde_json = "1"
sha2 = "0.10"
starknet = "0.10.0"
starknet-crypto = "0.6.1"
thiserror = "1"
toml = "0.8"
u256-literal = "1"
url = "2"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4.42"
wasm-webauthn = { git = "https://github.com/broody/wasm-webauthn", rev = "972693fdeaa5dbcf7eee181c1e4aad5dfdb73a82" }
tokio = { version = "1", features = ["macros", "time"] }
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cartridge",
"packageManager": "pnpm@9.0.6+sha256.0624e30eff866cdeb363b15061bdb7fd9425b17bc1bb42c22f5f4efdea21f6b3",
"name": "controller",
"packageManager": "pnpm@9.1.4",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand All @@ -27,4 +27,4 @@
"prettier": "^2.7.1",
"turbo": "^1.10.11"
}
}
}
55 changes: 27 additions & 28 deletions packages/account_sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
[package]
name = "account-sdk"
edition = "2021"
version = "0.1.0"
edition.workspace = true
version.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["lib"]

[dependencies]
anyhow = "1"
async-trait = "0.1"
base64 = "0.21"
cainome = { git = "https://github.com/piniom/cainome", rev = "beb1f1f5" }
cairo-lang-starknet = "2.4.0"
coset = { version = "0.3.4", features = ["std"] }
ecdsa = "0.16.9"
futures = "0.3"
lazy_static = "1"
p256 = "0.13"
primitive-types = { version = "0.12", default-features = false }
rand_core = { version = "0.6", features = ["getrandom"] }
serde = "1"
serde_json = "1"
sha2 = "0.10"
starknet = "0.10.0"
starknet-crypto = "0.6.1"
thiserror = "1"
toml = "0.8"
u256-literal = "1"
url = "2"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4.42"
wasm-webauthn = { git = "https://github.com/broody/wasm-webauthn", rev = "972693fdeaa5dbcf7eee181c1e4aad5dfdb73a82" }
tokio = { version = "1", features = ["macros", "time"] }
anyhow.workspace = true
async-trait.workspace = true
base64.workspace = true
cainome.workspace = true
cairo-lang-starknet.workspace = true
coset.workspace = true
ecdsa.workspace = true
futures.workspace = true
lazy_static.workspace = true
p256.workspace = true
primitive-types.workspace = true
rand_core.workspace = true
serde.workspace = true
serde_json.workspace = true
sha2.workspace = true
starknet.workspace = true
starknet-crypto.workspace = true
thiserror.workspace = true
toml.workspace = true
u256-literal.workspace = true
url.workspace = true
wasm-bindgen-futures.workspace = true
wasm-bindgen.workspace = true
wasm-webauthn.workspace = true
web-sys = "0.3.69"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1", features = ["macros", "time"] }
tokio.workspace = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-test = "0.3.34"
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.78.0"

0 comments on commit f32ba10

Please sign in to comment.