From 80a5a608ac50e2cf782ce2956fce22175ef0feb6 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 12 Jan 2024 15:25:10 +0100 Subject: [PATCH 1/6] ci: move `nightly job` to the CI. After the binaries `polkadot` and `staking-miner-playground` are built in a cronjob, running all tests should take ~5 minutes which is fast enough for the CI. --- .github/workflows/ci.yml | 5 +++- .github/workflows/nightly.yml | 43 ----------------------------------- 2 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14cd6c0a1..a989f3800 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,6 +130,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Get Polkadot and Staking Miner Playground binaries + uses: ./.github/workflows/actions/prepare-binaries + - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 with: @@ -138,7 +141,7 @@ jobs: - name: Run tests on Ubuntu run: | ${{ env.RUST_INFO }} - RUST_LOG=info cargo test --workspace -- --nocapture + RUST_LOG=info cargo test --workspace --all-features -- --nocapture build: name: Build polkadot-staking-miner binary diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index e53de1b4a..000000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Nightly test - -on: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -jobs: - nightly-test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Get Polkadot and Staking Miner Playground binaries - uses: ./.github/workflows/actions/prepare-binaries - - - name: Cache Rust dependencies - uses: swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - cache-on-failure: true - - - name: Run nightly tests - run: | - RUST_LOG=info cargo test --workspace --all-features -- --nocapture - - - name: Create an issue on failure - if: failure() - uses: JasonEtco/create-an-issue@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FAILED_WORKFLOW_RUN_URL: https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks/${{ github.run_id }} - with: - # Use this issue template: - filename: .github/issue_templates/nightly_run_failed.md - # Update existing issue if found; hopefully will make it clearer - # that it is still an issue: - update_existing: true - # Look for new *open* issues in this search (we want to - # create a new one if we only find closed versions): - search_existing: open - From 63977c62d6ace57ded99410b3d619c8d2c4fd4ef Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 12 Jan 2024 16:17:53 +0100 Subject: [PATCH 2/6] add debug logs --- .github/workflows/actions/prepare-binaries/action.yml | 6 +++--- .github/workflows/ci.yml | 5 ++++- Cargo.toml | 4 ---- tests/monitor.rs | 1 - 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/actions/prepare-binaries/action.yml b/.github/workflows/actions/prepare-binaries/action.yml index ad614b420..d6a74f7fd 100644 --- a/.github/workflows/actions/prepare-binaries/action.yml +++ b/.github/workflows/actions/prepare-binaries/action.yml @@ -23,6 +23,6 @@ runs: chmod u+x ./tmp/polkadot* ./tmp/staking-miner-playground ./tmp/polkadot --version ./tmp/staking-miner-playground --version - mkdir -p ~/.local/bin - mv ./tmp/polkadot* ~/.local/bin - mv ./tmp/staking-miner-playground ~/.local/bin + mkdir -p /usr/local/bin + mv ./tmp/polkadot* /usr/local/bin + mv ./tmp/staking-miner-playground /usr/local/bin diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a989f3800..d6586750d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,8 +140,11 @@ jobs: - name: Run tests on Ubuntu run: | + staking-miner-playground --version + polkadot --version + echo $PATH ${{ env.RUST_INFO }} - RUST_LOG=info cargo test --workspace --all-features -- --nocapture + RUST_LOG=info cargo test --workspace -- --nocapture build: name: Build polkadot-staking-miner binary diff --git a/Cargo.toml b/Cargo.toml index cbcfd9e45..cce1e0396 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,3 @@ anyhow = "1" assert_cmd = "2.0" sp-storage = "17.0.0" regex = "1" - -[features] -default = [] -slow-tests = [] diff --git a/tests/monitor.rs b/tests/monitor.rs index 7fbb51df6..b6925647e 100644 --- a/tests/monitor.rs +++ b/tests/monitor.rs @@ -1,5 +1,4 @@ //! Requires a `polkadot binary ` built with `--features fast-runtime` in the path to run integration tests against. -#![cfg(feature = "slow-tests")] pub mod common; From c27e597f4d825bb860c5f783d73ddcd52e1bd7e9 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 12 Jan 2024 16:57:12 +0100 Subject: [PATCH 3/6] remove hacks --- .github/dependabot.yml | 4 ++-- .github/workflows/ci.yml | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4424fc73b..53472f74c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,9 +13,9 @@ updates: - dependency-name: "polkadot-*" - dependency-name: "node-template-*" schedule: - interval: "daily" + interval: "weekly" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6586750d..4e9e8562d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,11 +140,8 @@ jobs: - name: Run tests on Ubuntu run: | - staking-miner-playground --version - polkadot --version - echo $PATH ${{ env.RUST_INFO }} - RUST_LOG=info cargo test --workspace -- --nocapture + RUST_LOG=info cargo +stable test --workspace -- --nocapture --release build: name: Build polkadot-staking-miner binary From 9cd263b85c8da258b590de1ce1604a46934a4d82 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 12 Jan 2024 17:25:00 +0100 Subject: [PATCH 4/6] Update .github/workflows/ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e9e8562d..6a8c5ec62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,7 +141,7 @@ jobs: - name: Run tests on Ubuntu run: | ${{ env.RUST_INFO }} - RUST_LOG=info cargo +stable test --workspace -- --nocapture --release + RUST_LOG=info cargo +stable test --release --workspace -- --nocapture build: name: Build polkadot-staking-miner binary From 66a0c4776d508b68ea93ade922f176fdc2e0eaa2 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 12 Jan 2024 17:27:50 +0100 Subject: [PATCH 5/6] strip binaries to make CI job faster --- .github/workflows/build-polkadot-for-nightly.yml | 3 +++ .../workflows/build-staking-miner-playground-for-nightly.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build-polkadot-for-nightly.yml b/.github/workflows/build-polkadot-for-nightly.yml index d650eba21..5ba9a33cf 100644 --- a/.github/workflows/build-polkadot-for-nightly.yml +++ b/.github/workflows/build-polkadot-for-nightly.yml @@ -29,6 +29,9 @@ jobs: run: | cargo build -p polkadot --release --features fast-runtime ./target/release/polkadot --version + strip -s ./target/release/polkadot + strip -s ./target/release/polkadot-prepare-worker + strip -s ./target/release/polkadot-execute-worker - name: upload polkadot binary uses: actions/upload-artifact@v3 diff --git a/.github/workflows/build-staking-miner-playground-for-nightly.yml b/.github/workflows/build-staking-miner-playground-for-nightly.yml index 52a3a1cfd..f092d1e8a 100644 --- a/.github/workflows/build-staking-miner-playground-for-nightly.yml +++ b/.github/workflows/build-staking-miner-playground-for-nightly.yml @@ -34,6 +34,7 @@ jobs: cd staking-miner-playground cargo build --release --features test-trimming ./target/release/staking-miner-playground --version + strip -s ./target/release/staking-miner-playground - name: upload staking-miner-playground binary uses: actions/upload-artifact@v3 From cffb3e4d43add17d9a5604be37929d2f1f64e05b Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Fri, 12 Jan 2024 17:57:23 +0100 Subject: [PATCH 6/6] Update .github/workflows/ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a8c5ec62..9cf10bda4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,7 +141,7 @@ jobs: - name: Run tests on Ubuntu run: | ${{ env.RUST_INFO }} - RUST_LOG=info cargo +stable test --release --workspace -- --nocapture + RUST_LOG=info cargo +stable test --workspace -- --nocapture build: name: Build polkadot-staking-miner binary