Skip to content

Commit

Permalink
chore: upload code cov, update min rust version
Browse files Browse the repository at this point in the history
  • Loading branch information
gluax committed Dec 20, 2024
1 parent 00244df commit 4cfbc50
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 27 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[alias]
cov = "run --package xtask -- cov"
cov-ci = "run --package xtask -- cov-ci"
schema = "run --bin schema"
tally-data-req-fixture = "run --package xtask -- tally-data-req-fixture"
test-dev = "run --package xtask -- test-dev"
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/Basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ jobs:
uses: taiki-e/install-action@cargo-llvm-cov

- name: 📊 Test Coverage
run: cargo cov
run: cargo cov-ci

- name: 📤 Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: true

fmt:
name: fmt
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: 🚀 Release
on:
push:
tags:
Expand All @@ -21,21 +21,21 @@ jobs:
with:
fetch-depth: 0

- name: 📥 Install Rust
- name: ☁️ Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: wasm32-unknown-unknown

- name: 📥 Install wasm-opt
- name: ☁️ Install wasm-opt
run: cargo install wasm-opt --locked

- name: 🔨 Compile optimized WASM contracts
run: cargo xtask wasm-opt
run: cargo wasm-opt

- name: 🪵 Conventional Changelog
- name: 📝 Conventional Changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v5
uses: TriPSs/conventional-changelog-action@v6
with:
github-token: ${{ secrets.github_token }}
output-file: "false"
Expand All @@ -44,16 +44,19 @@ jobs:
skip-git-pull: true
git-push: false

- name: 🧾 Generate Checksum
- name: 🔢 Generate Checksum
uses: jmgilman/actions-generate-checksum@v1
with:
patterns: |
target/seda_contract.wasm
- name: 📦 Create GitHub Release
- name: 🎉 Create GitHub Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
generateReleaseNotes: true
body: ${{ steps.changelog.outputs.clean_changelog }}
artifacts: "checksum.txt,target/seda_contract.wasm"
artifacts: |
checksum.txt
target/seda_contract.wasm
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ members = [
]

[workspace.package]
rust-version = "1.70.0"
rust-version = "1.82.0"
edition = "2021"

[profile.release]
opt-level = 3
Expand Down
11 changes: 1 addition & 10 deletions contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
[package]
name = "seda-contract"
version = "0.3.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

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

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "xtask"
version = "0.1.0"
edition = "2021"
edition.workspace = true
rust-version.workspace = true

[dependencies]
Expand Down
19 changes: 15 additions & 4 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ fn main() {

const TASKS: &[&str] = &[
"cov",
"cov-ci",
"help",
"tally-data-req-fixture",
"test-ci",
"test-dev",
"tally-data-req-fixture",
"wasm-opt",
];

Expand All @@ -42,12 +43,13 @@ fn try_main() -> Result<()> {
let task = env::args().nth(1);
let sh = Shell::new()?;
match task.as_deref() {
Some("cov") => cov(&sh)?,
Some("cov-ci") => cov_ci(&sh)?,
Some("help") => print_help()?,
Some("wasm-opt") => wasm_opt(&sh)?,
Some("tally-data-req-fixture") => tally_data_req_fixture(&sh)?,
Some("test-dev") => test_dev(&sh)?,
Some("test-ci") => test_ci(&sh)?,
Some("cov") => cov(&sh)?,
Some("test-dev") => test_dev(&sh)?,
Some("wasm-opt") => wasm_opt(&sh)?,
_ => print_help()?,
}

Expand Down Expand Up @@ -211,3 +213,12 @@ fn cov(sh: &Shell) -> Result<()> {
cmd!(sh, "cargo llvm-cov -p seda-contract --locked nextest -P ci").run()?;
Ok(())
}

fn cov_ci(sh: &Shell) -> Result<()> {
cmd!(
sh,
"cargo llvm-cov -p seda-contract --lcov --output-path lcov.info --locked nextest -P ci"
)
.run()?;
Ok(())
}

0 comments on commit 4cfbc50

Please sign in to comment.