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

chore(ci): Use debug & release profiles #3616

Merged
merged 64 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c28a54c
Debug assertions in CI
ark0f Dec 22, 2023
3f0be4a
Fix `gear-wasm-builder`
ark0f Dec 22, 2023
119e41b
Fix target paths
ark0f Dec 22, 2023
9d6b4b5
Change `--profile` to `--cargo-profile` for nextest
ark0f Dec 22, 2023
81cd3ee
Fix gsdk tests
ark0f Dec 22, 2023
fe0ad6f
Fix gcli tests
ark0f Dec 22, 2023
b891898
Fix `clap` in `gcli` binary
ark0f Dec 22, 2023
10a14be
Fix gclient tests
ark0f Dec 23, 2023
07789ff
Use `debug` profile by default
ark0f Dec 24, 2023
edd4bdf
Run `calc-stack-height` in release
ark0f Dec 24, 2023
789bdd5
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Feb 5, 2024
f2b2bd8
Revert obsolete files
ark0f Feb 5, 2024
899bf9c
Build node in release in `CI.yml`
ark0f Feb 5, 2024
853ed36
Build node in separated step
ark0f Feb 5, 2024
2c61163
Test matrix
ark0f Feb 5, 2024
15c62d5
Apply matrix values to steps
ark0f Feb 5, 2024
9484332
Use args instead of profile names
ark0f Feb 5, 2024
106cc69
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Feb 7, 2024
74717e8
Remove short flag for `vanity` arg
ark0f Feb 7, 2024
04fafb9
Propagate matrix to other OS builds
ark0f Feb 7, 2024
ebbb1cc
Always build `win-cross` in debug
ark0f Feb 7, 2024
2eaedaf
Run native Windows build on label
ark0f Feb 7, 2024
6046df7
Propagate matrix to native Windows build
ark0f Feb 7, 2024
3b919fc
Uncomment lines
ark0f Feb 7, 2024
d338cae
Revert "Always build `win-cross` in debug"
ark0f Feb 7, 2024
318edbc
Run matrix step on default GH runner
ark0f Feb 7, 2024
7556eac
Fix missing output
ark0f Feb 7, 2024
95fc2ec
Set jobs' names
ark0f Feb 7, 2024
d8bef92
Double deadline in authorship tests
ark0f Feb 7, 2024
dca9aee
Build in release on label
ark0f Feb 7, 2024
8b1d1b9
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Feb 7, 2024
b443d26
Fix bash formatting
ark0f Feb 8, 2024
36fe884
Build production binaries only when release profile activated
ark0f Feb 8, 2024
685aa33
Use release node in `gcli` tests
ark0f Feb 8, 2024
8b944e5
Fix clippy warnings
ark0f Feb 8, 2024
bfe5950
Add missing feature for `common` in `gear-voucher`
ark0f Feb 8, 2024
a743b85
Make benchmark unit test listing consistent
ark0f Feb 8, 2024
5194f91
Run full benchmark test in release build only
ark0f Feb 8, 2024
69a7e1e
Set deadline to 10s in authorship tests
ark0f Feb 8, 2024
8b488b7
Make `win-native` and `macos` jobs cancelable
ark0f Feb 8, 2024
6fc0ba0
Set deadline to 1 minute in authorship tests
ark0f Feb 8, 2024
94eefbd
Wrap if conditions in braces
ark0f Feb 9, 2024
06c0e66
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Feb 9, 2024
8d4612a
Use `contains` to workaround GH actions bug
ark0f Feb 9, 2024
a563172
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Feb 12, 2024
5166b01
Don't compare boolean with strings
ark0f Feb 12, 2024
568e0e5
Fix WASM benchmarks started in debug build
ark0f Feb 12, 2024
b6b5054
Rename matrix variables
ark0f Feb 12, 2024
f6552eb
Fix not only benchmark tests run
ark0f Feb 12, 2024
79494de
Fix wrong matrix field used
ark0f Feb 12, 2024
4ee0273
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Feb 12, 2024
ffd626d
Fix comparison value
ark0f Feb 12, 2024
3c7f2a1
Fix profile flags are not used in native Windows build
ark0f Feb 12, 2024
4b88e25
Don't run some steps in debug
ark0f Feb 12, 2024
124f64c
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Mar 12, 2024
03ddf57
Remove obsolete branches
ark0f Mar 12, 2024
2e5657f
Remove obsolete caching
ark0f Mar 12, 2024
fda41e9
Revert authorship tests
ark0f Mar 12, 2024
5e7960b
Describe outputs
ark0f Mar 12, 2024
91587f6
Fix main.js
ark0f Mar 12, 2024
de11456
Rename workflow
ark0f Mar 12, 2024
ff220ea
Rename job
ark0f Mar 12, 2024
b286db9
Merge remote-tracking branch 'origin/master' into al/debug-build-ci
ark0f Mar 12, 2024
23b5dec
Merge branch 'master' into al/debug-build-ci
ark0f Mar 13, 2024
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
7 changes: 3 additions & 4 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,23 @@ jobs:
shell: powershell

- name: "Build: Node"
run: ./scripts/gear.sh build node --release --locked
run: ./scripts/gear.sh build node --locked

- name: "Check: Stack height limit"
run: cargo run -p calc-stack-height --release --locked

- name: "Test: gsdk tests"
run: ./scripts/gear.sh test gsdk --release
run: ./scripts/gear.sh test gsdk

- name: "Test: Client tests"
run: ./scripts/gear.sh test client --release
run: ./scripts/gear.sh test client

- name: "Test: Lazy pages"
run: >-
cargo nextest run
-p "pallet-*"
-p gear-lazy-pages
-p gear-runtime-interface
--release

upload:
if: github.event_name == 'push' && github.ref_name == 'master'
Expand Down
41 changes: 20 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,61 +66,61 @@ jobs:
run: ./scripts/gear.sh init cargo

- name: "Build: Gear"
run: ./scripts/gear.sh build gear --locked --release
run: ./scripts/gear.sh build gear --locked

- name: "Build fuzzer"
run: ./scripts/gear.sh build fuzz --locked --release
run: ./scripts/gear.sh build fuzz --locked

- name: "Check: Vara runtime imports"
run: ./target/release/wasm-proc --check-runtime-imports target/release/wbuild/vara-runtime/vara_runtime.compact.wasm
run: ./target/debug/wasm-proc --check-runtime-imports target/debug/wbuild/vara-runtime/vara_runtime.compact.wasm

- name: "Check: Stack height limit"
run: cargo run -p calc-stack-height --release --locked

- name: "Test: Gear workspace"
run: ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk --release --locked
run: ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk --locked

- name: "Test: gsdk tests"
run: ./scripts/gear.sh test gsdk --release
run: ./scripts/gear.sh test gsdk

- name: "Test: `gcli`"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/gear.sh test gcli --release --locked --retries 3
run: ./scripts/gear.sh test gcli --locked --retries 3

- name: "Test: Client tests"
run: ./scripts/gear.sh test client --release
run: ./scripts/gear.sh test client

- name: "Test: Runtime benchmarks and benchmark tests work"
run: |
cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers
cargo build -p gear-cli --features=runtime-benchmarks,runtime-benchmarks-checkers
# check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number.
./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096
./target/debug/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096
# check that read_big_state benchmarks works
./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="read_big_state" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra
./target/debug/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="read_big_state" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra
# check that check/test benchmarks works
./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_all" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra
./target/debug/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_all" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra
# check also lazy-pages benchmarks tests for native runtime
./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_lazy_pages_all" --execution=native --heap-pages=4096 --extra
./target/debug/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_lazy_pages_all" --execution=native --heap-pages=4096 --extra

- name: "Test: Syscalls Wasmi integrity"
run: ./scripts/gear.sh test syscalls --release
run: ./scripts/gear.sh test syscalls

- name: "Test: `try-runtime` feature tests"
run: |
cargo test -p "pallet-*" --features try-runtime --release --locked
cargo test -p "pallet-*" --features try-runtime --locked

- name: "Test: Try runtime migrations"
run: |
cargo build -p gear-cli --features try-runtime --release --locked
./target/release/gear try-runtime --runtime ./target/release/wbuild/vara-runtime/vara_runtime.wasm on-runtime-upgrade --checks live --uri ws://rpc-private.vara-network.io:9944
cargo build -p gear-cli --features try-runtime --locked
./target/debug/gear try-runtime --runtime ./target/debug/wbuild/vara-runtime/vara_runtime.wasm on-runtime-upgrade --checks live --uri ws://rpc-private.vara-network.io:9944
env:
RUST_LOG: info

- name: "Coverage: Aggregate"
if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage')
run: >-
./grcov . --binary-path ./target/release/ -s . -t lcov --branch --ignore-not-existing
./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing
--ignore "/*"
--ignore "examples/*"
--ignore "utils/*"
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
cp target/production/wbuild/vara-runtime/vara_runtime.compact.wasm artifact/
cp target/production/wbuild/vara-runtime/vara_runtime.wasm artifact/
cp target/production/gear artifact/
cp target/release/wasm-proc artifact/
cp target/debug/wasm-proc artifact/
strip artifact/gear || true
strip artifact/wasm-proc || true

Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
mv ./cargo-xwin ${CARGO_HOME:-~/.cargo}/bin/

- name: "Build: Node"
run: ./scripts/gear.sh build node --release --locked
run: ./scripts/gear.sh build node --locked
env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc

Expand All @@ -238,7 +238,7 @@ jobs:

#- name: "Test: Client tests"
# run: |
# cp ./target/x86_64-pc-windows-msvc/release/gear.exe ./target/release/
# cp ./target/x86_64-pc-windows-msvc/release/gear.exe ./target/debug/
# ./scripts/gear.sh test client
# env:
# CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
Expand All @@ -249,7 +249,6 @@ jobs:
-p "pallet-*"
-p gear-lazy-pages
-p gear-runtime-interface
--release
env:
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/crates-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
uses: dsherret/rust-toolchain-file@v1

- name: "Check packages"
run: cargo run --release -p crates-io check
run: cargo run -p crates-io check

- name: "Publish packages"
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }}
run: cargo run --release -p crates-io publish -v ${{ inputs.version }}
run: cargo run -p crates-io publish -v ${{ inputs.version }}
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,16 @@ scale-decode = "0.9.0" # gsdk
directories = "5.0.1" # utils/key-finder
num-traits = { version = "0.2", default-features = false } # gear-core

# compile non-workspace dependencies in release
# to reach fast block production in node binary
[profile.dev.package."*"]
opt-level = 3

# TODO: remove after wasmer bug is fixed:
# `misaligned pointer dereference: address must be a multiple of 0x8 but is...`
[profile.dev.package."wasmer-vm"]
debug-assertions = false

[profile.release]
panic = "unwind"

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ vara-release:

.PHONY: gear-replay
gear-replay:
@ ./scripts/gear.sh build gear-replay --release
@ ./scripts/gear.sh build gear-replay

.PHONY: gear-replay-vara-native
gear-replay-vara-native:
@ ./scripts/gear.sh build gear-replay --release --no-default-features --features=std,vara-native
@ ./scripts/gear.sh build gear-replay --no-default-features --features=std,vara-native

# Check section
.PHONY: check
Expand Down
2 changes: 1 addition & 1 deletion gcli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub trait App: Parser + Sync {
}

/// The verbosity logging level.
fn verbose(&self) -> u16 {
fn verbose(&self) -> u8 {
0
}

Expand Down
4 changes: 2 additions & 2 deletions gcli/src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub struct Opt {
pub timeout: u64,
/// Enable verbose logs.
#[clap(short, long, action = clap::ArgAction::Count)]
pub verbose: u16,
pub verbose: u8,
/// Gear node rpc endpoint.
#[arg(short, long)]
pub endpoint: Option<String>,
Expand All @@ -101,7 +101,7 @@ impl App for Opt {
self.timeout
}

fn verbose(&self) -> u16 {
fn verbose(&self) -> u8 {
self.verbose
}

Expand Down
7 changes: 5 additions & 2 deletions gclient/tests/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@

//! Test for infinity loop, that it can't exceed block production time.

mod utils;

use crate::utils::gear_api;
use demo_custom::{InitMessage, WASM_BINARY};
use gclient::{EventProcessor, GearApi};
use gclient::EventProcessor;
use parity_scale_codec::Encode;

#[tokio::test]
async fn backend_errors_handled_by_sandbox() -> anyhow::Result<()> {
// Creating gear api.
//
// By default, login as Alice.
let api = GearApi::dev_from_path("../target/release/gear").await?;
let api = gear_api().await?;

// Taking block gas limit constant.
let gas_limit = api.block_gas_limit()?;
Expand Down
7 changes: 5 additions & 2 deletions gclient/tests/keyhasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@

//! Test for infinity loop, that it can't exceed block production time.

mod utils;

use crate::utils::gear_api;
use demo_wat::WatExample;
use gclient::{EventProcessor, GearApi};
use gclient::EventProcessor;

#[tokio::test]
async fn keyhasher_size_exceed() -> anyhow::Result<()> {
// Creating gear api.
//
// By default, login as Alice.
let api = GearApi::dev_from_path("../target/release/gear").await?;
let api = gear_api().await?;

// Taking block gas limit constant.
let gas_limit = api.block_gas_limit()?;
Expand Down
7 changes: 5 additions & 2 deletions gclient/tests/loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@

//! Test for infinity loop, that it can't exceed block production time.

mod utils;

use crate::utils::gear_api;
use demo_constructor::{Calls, Scheme, WASM_BINARY};
use gclient::{EventProcessor, GearApi};
use gclient::EventProcessor;
use parity_scale_codec::Encode;

#[tokio::test]
async fn inf_loop() -> anyhow::Result<()> {
// Creating gear api.
//
// By default, login as Alice.
let api = GearApi::dev_from_path("../target/release/gear").await?;
let api = gear_api().await?;

// Taking block gas limit constant.
let gas_limit = api.block_gas_limit()?;
Expand Down
5 changes: 4 additions & 1 deletion gclient/tests/memory_dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

mod utils;

use crate::utils::gear_api;
use demo_custom::{InitMessage, WASM_BINARY};
use gclient::{EventListener, EventProcessor, GearApi, Result};
use gear_core::ids::ProgramId;
Expand Down Expand Up @@ -65,7 +68,7 @@ impl Drop for CleanupFolderOnDrop {
#[tokio::test]
async fn memory_dump() -> Result<()> {
// Create API instance
let api = GearApi::dev_from_path("../target/release/gear").await?;
let api = gear_api().await?;
// Subscribe to events
let mut listener = api.subscribe().await?;
// Check that blocks are still running
Expand Down
15 changes: 7 additions & 8 deletions gclient/tests/node.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
mod utils;

use crate::utils::gear_api;
use gclient::{Error, EventProcessor, GearApi};
use gear_core::ids::ProgramId;
use hex::ToHex;
use parity_scale_codec::{Decode, Encode};

const GEAR_PATH: &str = "../target/release/gear";

/// Running this test requires gear node to be built in advance.
#[tokio::test]
async fn two_nodes_run_independently() {
Expand Down Expand Up @@ -40,7 +41,7 @@ async fn program_migrated_to_another_node() {
.expect("Unable to transfer funds to source program");

// Initialize destination node
let dest_node_api = GearApi::dev_from_path(GEAR_PATH)
let dest_node_api = gear_api()
.await
.expect("Unable to connect to destination node api");

Expand Down Expand Up @@ -110,7 +111,7 @@ async fn program_migration_fails_if_program_exists() {
.await;

// Initialize destination node
let dest_node_api = GearApi::dev_from_path(GEAR_PATH)
let dest_node_api = gear_api()
.await
.expect("Unable to connect to destination node api");

Expand Down Expand Up @@ -181,7 +182,7 @@ async fn program_with_gas_reservation_migrated_to_another_node() {
.expect("Unable to get source node last block hash");

// Initialize the destination node api
let dest_node_api = GearApi::dev_from_path(GEAR_PATH)
let dest_node_api = gear_api()
.await
.expect("Unable to connect to destination node api");

Expand Down Expand Up @@ -234,9 +235,7 @@ async fn upload_program_to_node<E>(
where
E: Encode,
{
let api = GearApi::dev_from_path(GEAR_PATH)
.await
.expect("Unable to connect to node api");
let api = gear_api().await.expect("Unable to connect to node api");

let gas_limit = api
.block_gas_limit()
Expand Down
20 changes: 8 additions & 12 deletions gclient/tests/set_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,28 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use gclient::{
errors::{self, ModuleError},
GearApi,
};
mod utils;

use crate::utils::{gear_api, target_dir};
use gclient::errors::{self, ModuleError};

#[tokio::test]
async fn set_code_succeed() {
let api = GearApi::dev_from_path("../target/release/gear")
.await
.unwrap();
let api = gear_api().await.unwrap();
let _block_hash = api
.set_code_without_checks_by_path(
"../target/release/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm",
target_dir().join("wbuild/vara-runtime/vara_runtime.compact.compressed.wasm"),
)
.await
.unwrap();
}

#[tokio::test]
async fn set_code_failed() {
let api = GearApi::dev_from_path("../target/release/gear")
.await
.unwrap();
let api = gear_api().await.unwrap();
let err = api
.set_code_by_path(
"../target/release/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm",
target_dir().join("wbuild/vara-runtime/vara_runtime.compact.compressed.wasm"),
)
.await
.unwrap_err();
Expand Down
Loading