From bd832935c3af5407f0a42bd09063f132ec96ae0d Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Mon, 4 Dec 2023 16:09:50 +0200 Subject: [PATCH 01/15] add GHA --- .github/workflows/ci.yml | 223 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6b0c7766 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,223 @@ +name: Rust CI/CD + +on: + push: + branches: + - master + pull_request: + +jobs: +# Checks + clippy: + runs-on: ubuntu-latest + steps: + - name: Checkout code/. + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + profile: minimal + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Run Clippy + run: | + cargo +stable clippy --locked -- -Dwarnings + cargo +stable clippy --locked -p parity-scale-codec-derive -- -Dwarnings + cargo +stable clippy --locked --test clippy -- -Dwarnings + + checks: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Check Rust Stable (no_derive_no_std) + run: time cargo +stable check --verbose --no-default-features --features bit-vec,bytes,generic-array + + - name: Check Rust Stable (no_std-chain-error) + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable check --verbose --no-default-features --features chain-error + + - name: check-rust-stable-no_derive + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable check --verbose --features bit-vec,bytes,generic-array + + - name: check-rust-stable-only_mel + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable check --verbose --features max-encoded-len + +# Tests + tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Test Rust Stable + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable test --verbose --all --features bit-vec,bytes,generic-array,derive,max-encoded-len + + - name: Test Rust Stable (no_derive) + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable test --verbose --no-default-features --features bit-vec,bytes,generic-array + + - name: Test Rust Stable (only_mel) + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable test --verbose --features max-encoded-len + + - name: Test Rust Stable (only_mel-no_default_std) + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable test --verbose --no-default-features --features max-encoded-len + +# Benches + bench-rust-nightly: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Bench Rust Nightly + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +nightly bench --features bit-vec,bytes,generic-array,derive,max-encoded-len + + miri: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: miri + profile: minimal + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Run Miri + run: | + export RUST_BACKTRACE=1 + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + export MIRIFLAGS='-Zmiri-disable-isolation' + time cargo +nightly miri test --features bit-vec,bytes,generic-array,arbitrary --release + +# Build + + build-linux-ubuntu-amd64: + runs-on: ubuntu-latest + needs: [checks, tests] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Build for Linux (Ubuntu, AMD64) + run: cargo build --verbose --release --features bit-vec,bytes,generic-array,derive + + publish-dry-run: + runs-on: ubuntu-latest + needs: [build-linux-ubuntu-amd64] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Dry Run Publish + if: github.event_name == 'pull_request' + run: cargo publish -p parity-scale-codec --dry-run + + + # publish-crate: + # runs-on: ubuntu-latest + # needs: [publish-dry-run] + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + + # - name: Set up Rust + # uses: actions-rs/toolchain@v1 + # with: + # profile: minimal + + # - name: Cache Rust dependencies + # uses: swatinem/rust-cache@v2 + # with: + # key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + # - name: Publish Crate + # if: startsWith(github.ref, 'refs/tags/v') + # run: cargo publish -p parity-scale-codec + + From ca50d61cea070bdfdc27a6b00bb539f689492e2d Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Mon, 4 Dec 2023 21:44:49 +0200 Subject: [PATCH 02/15] add container and beefier runners for benches --- .github/workflows/ci.yml | 41 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b0c7766..ba3c8f4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,16 +10,17 @@ jobs: # Checks clippy: runs-on: ubuntu-latest + container: paritytech/ci-unified:bullseye-1.73.0-2023-05-23-v20231009 steps: - name: Checkout code/. uses: actions/checkout@v4 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy - profile: minimal + # - name: Set up Rust + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # components: clippy + # profile: minimal - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 @@ -34,15 +35,16 @@ jobs: checks: runs-on: ubuntu-latest + container: paritytech/ci-unified:bullseye-1.73.0-2023-05-23-v20231009 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal + # - name: Set up Rust + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # profile: minimal - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 @@ -70,15 +72,16 @@ jobs: # Tests tests: runs-on: ubuntu-latest + container: paritytech/ci-unified:bullseye-1.73.0-2023-05-23-v20231009 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal + # - name: Set up Rust + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # profile: minimal - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 @@ -107,7 +110,7 @@ jobs: # Benches bench-rust-nightly: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-8-cores steps: - name: Checkout code uses: actions/checkout@v4 @@ -129,7 +132,7 @@ jobs: time cargo +nightly bench --features bit-vec,bytes,generic-array,derive,max-encoded-len miri: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-8-cores steps: - name: Checkout code uses: actions/checkout@v4 @@ -157,7 +160,7 @@ jobs: build-linux-ubuntu-amd64: runs-on: ubuntu-latest - needs: [checks, tests] + needs: [clippy, checks, tests] steps: - name: Checkout code uses: actions/checkout@v4 From d6b9a2909ec7564592c87b5b10f29b7c518ea828 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Tue, 5 Dec 2023 00:44:06 +0200 Subject: [PATCH 03/15] use 16 cores runner for bench --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba3c8f4b..3634fe1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: # Benches bench-rust-nightly: - runs-on: ubuntu-latest-8-cores + runs-on: ubuntu-latest-16-cores steps: - name: Checkout code uses: actions/checkout@v4 @@ -132,7 +132,7 @@ jobs: time cargo +nightly bench --features bit-vec,bytes,generic-array,derive,max-encoded-len miri: - runs-on: ubuntu-latest-8-cores + runs-on: ubuntu-latest-16-cores steps: - name: Checkout code uses: actions/checkout@v4 From 2b1f0cbe68a7f963d3ab77ee4aa17c8750a1e16a Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Tue, 5 Dec 2023 02:59:13 +0200 Subject: [PATCH 04/15] debug --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3634fe1b..b4d05902 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,8 @@ jobs: - name: Test Rust Stable (no_derive) run: | + rustup show + cargo --version export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' time cargo +stable test --verbose --no-default-features --features bit-vec,bytes,generic-array From ff901d4afb4bd58c67aa7c5606f676ee33797741 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Tue, 5 Dec 2023 03:06:57 +0200 Subject: [PATCH 05/15] debug --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4d05902..bb377c9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: # Tests tests: runs-on: ubuntu-latest - container: paritytech/ci-unified:bullseye-1.73.0-2023-05-23-v20231009 + container: paritytech/ci-unified:bullseye-1.73.0 steps: - name: Checkout code uses: actions/checkout@v4 @@ -95,8 +95,9 @@ jobs: - name: Test Rust Stable (no_derive) run: | + cargo -vV + rustc -vV rustup show - cargo --version export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' time cargo +stable test --verbose --no-default-features --features bit-vec,bytes,generic-array From a7aace80c28753e09370edfe3b3474279ee3bbe9 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Tue, 5 Dec 2023 03:14:06 +0200 Subject: [PATCH 06/15] debug --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb377c9c..14cc44d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,15 +83,15 @@ jobs: # toolchain: stable # profile: minimal - - name: Cache Rust dependencies - uses: swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + # - name: Cache Rust dependencies + # uses: swatinem/rust-cache@v2 + # with: + # key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - - name: Test Rust Stable - run: | - export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' - time cargo +stable test --verbose --all --features bit-vec,bytes,generic-array,derive,max-encoded-len + # - name: Test Rust Stable + # run: | + # export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + # time cargo +stable test --verbose --all --features bit-vec,bytes,generic-array,derive,max-encoded-len - name: Test Rust Stable (no_derive) run: | From 38b3ed35fe5a4e09245be77e3794b57578c32a44 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Tue, 5 Dec 2023 03:19:22 +0200 Subject: [PATCH 07/15] debug --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14cc44d4..caa49386 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,15 +83,15 @@ jobs: # toolchain: stable # profile: minimal - # - name: Cache Rust dependencies - # uses: swatinem/rust-cache@v2 - # with: - # key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - # - name: Test Rust Stable - # run: | - # export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' - # time cargo +stable test --verbose --all --features bit-vec,bytes,generic-array,derive,max-encoded-len + - name: Test Rust Stable + run: | + export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' + time cargo +stable test --verbose --all --features bit-vec,bytes,generic-array,derive,max-encoded-len - name: Test Rust Stable (no_derive) run: | @@ -99,7 +99,7 @@ jobs: rustc -vV rustup show export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' - time cargo +stable test --verbose --no-default-features --features bit-vec,bytes,generic-array + time cargo +stable test --verbose --features bit-vec,bytes,generic-array - name: Test Rust Stable (only_mel) run: | @@ -109,11 +109,11 @@ jobs: - name: Test Rust Stable (only_mel-no_default_std) run: | export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' - time cargo +stable test --verbose --no-default-features --features max-encoded-len + time cargo +stable test --verbose --features max-encoded-len,std --no-default-features # Benches bench-rust-nightly: - runs-on: ubuntu-latest-16-cores + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 @@ -135,7 +135,7 @@ jobs: time cargo +nightly bench --features bit-vec,bytes,generic-array,derive,max-encoded-len miri: - runs-on: ubuntu-latest-16-cores + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 From db6861fe8f3f661e94153163fa231799aadeae74 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Tue, 5 Dec 2023 09:42:54 +0200 Subject: [PATCH 08/15] cleanup --- .github/workflows/ci.yml | 125 ++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index caa49386..268590f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,21 +6,34 @@ on: - master pull_request: +env: + IMAGE: paritytech/ci-unified:bullseye-1.73.0 + jobs: + set-image: + # GitHub Actions does not allow using 'env' in a container context. + # This workaround sets the container image for each job using 'set-image' job output. + runs-on: ubuntu-latest + outputs: + IMAGE: ${{ steps.set_image.outputs.IMAGE }} + steps: + - id: set_image + run: echo "IMAGE=${{ env.IMAGE }}" >> $GITHUB_OUTPUT + # Checks clippy: runs-on: ubuntu-latest - container: paritytech/ci-unified:bullseye-1.73.0-2023-05-23-v20231009 + needs: [set-image] + container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code/. uses: actions/checkout@v4 - # - name: Set up Rust - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # components: clippy - # profile: minimal + - name: Show Rust version + run: | + cargo -vV + rustc -vV + rustup show - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 @@ -35,16 +48,17 @@ jobs: checks: runs-on: ubuntu-latest - container: paritytech/ci-unified:bullseye-1.73.0-2023-05-23-v20231009 + needs: [set-image] + container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code uses: actions/checkout@v4 - # - name: Set up Rust - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # profile: minimal + - name: Show Rust version + run: | + cargo -vV + rustc -vV + rustup show - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 @@ -72,16 +86,17 @@ jobs: # Tests tests: runs-on: ubuntu-latest - container: paritytech/ci-unified:bullseye-1.73.0 + needs: [set-image] + container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code uses: actions/checkout@v4 - # - name: Set up Rust - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # profile: minimal + - name: Show Rust version + run: | + cargo -vV + rustc -vV + rustup show - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 @@ -95,9 +110,6 @@ jobs: - name: Test Rust Stable (no_derive) run: | - cargo -vV - rustc -vV - rustup show export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' time cargo +stable test --verbose --features bit-vec,bytes,generic-array @@ -114,16 +126,12 @@ jobs: # Benches bench-rust-nightly: runs-on: ubuntu-latest + needs: [set-image] + container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - profile: minimal - - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 with: @@ -136,17 +144,12 @@ jobs: miri: runs-on: ubuntu-latest + needs: [set-image] + container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - components: miri - profile: minimal - - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 with: @@ -163,17 +166,12 @@ jobs: build-linux-ubuntu-amd64: runs-on: ubuntu-latest - needs: [clippy, checks, tests] + needs: [set-image, clippy, checks, tests] + container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 with: @@ -184,17 +182,12 @@ jobs: publish-dry-run: runs-on: ubuntu-latest - needs: [build-linux-ubuntu-amd64] + needs: [set-image, build-linux-ubuntu-amd64] + container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - - name: Cache Rust dependencies uses: swatinem/rust-cache@v2 with: @@ -205,25 +198,19 @@ jobs: run: cargo publish -p parity-scale-codec --dry-run - # publish-crate: - # runs-on: ubuntu-latest - # needs: [publish-dry-run] - # steps: - # - name: Checkout code - # uses: actions/checkout@v4 - - # - name: Set up Rust - # uses: actions-rs/toolchain@v1 - # with: - # profile: minimal - - # - name: Cache Rust dependencies - # uses: swatinem/rust-cache@v2 - # with: - # key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - - # - name: Publish Crate - # if: startsWith(github.ref, 'refs/tags/v') - # run: cargo publish -p parity-scale-codec + publish-crate: + runs-on: ubuntu-latest + needs: [set-image, publish-dry-run] + container: ${{ needs.set-image.outputs.IMAGE }} + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + # - name: Publish Crate + # run: cargo publish -p parity-scale-codec From 45fad9a479dbe31a09f3e2eddfb514eb24beebc4 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Fri, 8 Dec 2023 01:57:03 +0200 Subject: [PATCH 09/15] parallelize benchmarks --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 268590f4..0298184b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,9 @@ jobs: bench-rust-nightly: runs-on: ubuntu-latest needs: [set-image] + strategy: + matrix: + feature: [bit-vec,bytes,generic-array,derive,max-encoded-len] container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code @@ -140,11 +143,14 @@ jobs: - name: Bench Rust Nightly run: | export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' - time cargo +nightly bench --features bit-vec,bytes,generic-array,derive,max-encoded-len + time cargo +nightly bench --features ${{ matrix.feature }} miri: runs-on: ubuntu-latest needs: [set-image] + strategy: + matrix: + feature: [bit-vec,bytes,generic-array,arbitrary] container: ${{ needs.set-image.outputs.IMAGE }} steps: - name: Checkout code @@ -160,7 +166,7 @@ jobs: export RUST_BACKTRACE=1 export RUSTFLAGS='-Cdebug-assertions=y -Dwarnings' export MIRIFLAGS='-Zmiri-disable-isolation' - time cargo +nightly miri test --features bit-vec,bytes,generic-array,arbitrary --release + time cargo +nightly miri test --features ${{ matrix.feature }} --release # Build From 1a619ad21c631f7d89c67399dd49f72304090c89 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Fri, 8 Dec 2023 11:43:16 +0200 Subject: [PATCH 10/15] remove gitlab pipeline --- .github/workflows/gitspiegel-trigger.yml | 22 --- .gitlab-ci.yml | 201 ----------------------- 2 files changed, 223 deletions(-) delete mode 100644 .github/workflows/gitspiegel-trigger.yml delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/gitspiegel-trigger.yml b/.github/workflows/gitspiegel-trigger.yml deleted file mode 100644 index dce3aaf2..00000000 --- a/.github/workflows/gitspiegel-trigger.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: gitspiegel sync - -# This workflow doesn't do anything, it's only use is to trigger "workflow_run" -# webhook, that'll be consumed by gitspiegel -# This way, gitspiegel won't do mirroring, unless this workflow runs, -# and running the workflow is protected by GitHub - -on: - pull_request: - types: - - opened - - synchronize - - unlocked - - ready_for_review - - reopened - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Do nothing - run: echo "let's go" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 1776e7d1..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,201 +0,0 @@ -# .gitlab-ci.yml -# - -include: - - project: parity/infrastructure/ci_cd/shared - ref: main - file: /common/ci-unified.yml - -stages: - - check - - test - - build - - publish - -variables: - GIT_STRATEGY: fetch - GIT_DEPTH: "100" - CARGO_INCREMENTAL: 0 - CI_IMAGE: !reference [.ci-unified, variables, CI_IMAGE] - -default: - cache: {} - interruptible: true - retry: - max: 2 - when: - - runner_system_failure - - unknown_failure - - api_failure - -.kubernetes-env: - image: $CI_IMAGE - tags: - - kubernetes-parity-build - -.docker-env: - image: $CI_IMAGE - before_script: - - cargo -vV - - rustc -vV - - rustup show - - bash --version - rules: - - if: $CI_PIPELINE_SOURCE == "trigger" - - if: $CI_PIPELINE_SOURCE == "web" - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_REF_NAME == "master" - - if: $CI_COMMIT_REF_NAME == "tags" - - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs - - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 - tags: - - linux-docker - -#### stage: check - -check-clippy: - stage: check - extends: .docker-env - script: - - rustup component add clippy --toolchain stable-x86_64-unknown-linux-gnu - - time cargo +stable clippy --locked -- -Dwarnings - - time cargo +stable clippy --locked -p parity-scale-codec-derive -- -Dwarnings - - time cargo +stable clippy --locked --test clippy -- -Dwarnings - -check-rust-stable-no_derive_no_std: - stage: check - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable check --verbose --no-default-features --features bit-vec,bytes,generic-array - -check-rust-stable-no_std-chain-error: - stage: check - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable check --verbose --no-default-features --features chain-error - -check-rust-stable-no_derive: - stage: check - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable check --verbose --features bit-vec,bytes,generic-array - -check-rust-stable-only_mel: - stage: check - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable check --verbose --features max-encoded-len - -#### stage: test - -test-rust-stable: - stage: test - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable test --verbose --all --features bit-vec,bytes,generic-array,derive,max-encoded-len - -test-rust-stable-no_derive: - stage: test - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable test --verbose --features bit-vec,bytes,generic-array - -test-rust-stable-only_mel: - stage: test - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable test --verbose --features max-encoded-len - -test-rust-stable-only_mel-no_default_std: - stage: test - extends: .docker-env - variables: - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" - script: - - time cargo +stable test --verbose --features max-encoded-len,std --no-default-features - -bench-rust-nightly: - stage: test - extends: .docker-env - script: - - time cargo +nightly bench --features bit-vec,bytes,generic-array,derive - -miri: - stage: test - extends: .docker-env - variables: - RUST_BACKTRACE: 1 - MIRIFLAGS: "-Zmiri-disable-isolation" - script: - - time cargo +nightly miri test --features bit-vec,bytes,generic-array,arbitrary --release - -# check that build is no_std compatible -# more info: https://github.com/paritytech/parity-scale-codec/pull/389 -build-no-std: - stage: test - extends: .docker-env - variables: - RUST_BACKTRACE: 1 - script: - # this target doesn't support std envs; it should flag any unexpected uses of std - - rustup target add thumbv6m-none-eabi - - time cargo build --target thumbv6m-none-eabi --no-default-features - -build-no-atomic-ptrs: - stage: test - extends: .docker-env - variables: - RUST_BACKTRACE: 1 - script: - # this target doesn't have atomic ptrs. Some parts of alloc are not available there - # we want to make sure that this crate still works on those targets - - cargo +nightly check --target bpfel-unknown-none -Zbuild-std="core,alloc" --no-default-features --features generic-array,derive,max-encoded-len,chain-error - -#### stage: build - -build-linux-ubuntu-amd64: - stage: build - extends: .docker-env - rules: - - if: $CI_PIPELINE_SOURCE == "web" - - if: $CI_PIPELINE_SOURCE == "schedule" - - if: $CI_COMMIT_REF_NAME == "master" - - if: $CI_COMMIT_REF_NAME == "tags" - script: - - cargo build --verbose --release --features bit-vec,bytes,generic-array,derive - -#### stage: publish - -publish-dry-run: - stage: publish - extends: .kubernetes-env - # artificial dependency in order not to wait miri job - needs: - - job: check-clippy - artifacts: false - rules: - - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs - script: - - cargo publish -p parity-scale-codec --dry-run - -publish-crate: - stage: publish - extends: .kubernetes-env - rules: - - if: $CI_COMMIT_REF_NAME =~ /^v.[0-9]+\.[0-9]+.*$/ # i.e. v.1.0, v.2.1rc1 - script: - - cargo publish -p parity-scale-codec From 25aafd5bc85e729eb54b04bf9715d06cd11d6df9 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Fri, 8 Dec 2023 12:00:43 +0200 Subject: [PATCH 11/15] restore publish step --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0298184b..81fbc560 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -218,5 +218,5 @@ jobs: with: key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - # - name: Publish Crate - # run: cargo publish -p parity-scale-codec + - name: Publish Crate + run: cargo publish -p parity-scale-codec From 93410180cae9e6ba973203d2396e3ca8839cdeb2 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko <85877331+sergejparity@users.noreply.github.com> Date: Fri, 8 Dec 2023 12:27:02 +0200 Subject: [PATCH 12/15] Update .github/workflows/ci.yml Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81fbc560..760e7ee4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,9 @@ on: env: IMAGE: paritytech/ci-unified:bullseye-1.73.0 - +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: set-image: # GitHub Actions does not allow using 'env' in a container context. From 75a62206dcbcebda774d71acf1be7727432a07ab Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Mon, 11 Dec 2023 11:20:21 +0200 Subject: [PATCH 13/15] publish release in separate workflow --- .github/workflows/ci.yml | 18 ------------------ .github/workflows/publish.yml | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 760e7ee4..573ce99f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -204,21 +204,3 @@ jobs: - name: Dry Run Publish if: github.event_name == 'pull_request' run: cargo publish -p parity-scale-codec --dry-run - - - publish-crate: - runs-on: ubuntu-latest - needs: [set-image, publish-dry-run] - container: ${{ needs.set-image.outputs.IMAGE }} - if: startsWith(github.ref, 'refs/tags/v') - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Cache Rust dependencies - uses: swatinem/rust-cache@v2 - with: - key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - - - name: Publish Crate - run: cargo publish -p parity-scale-codec diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..1f0c7092 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,22 @@ +name: Publish release to crates.io + +on: + release: + types: + - published + +jobs: + publish-crate: + runs-on: ubuntu-latest + environment: release + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache Rust dependencies + uses: swatinem/rust-cache@v2 + with: + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + + - name: Publish Crate + run: cargo publish -p parity-scale-codec \ No newline at end of file From c9f769f2f433693b15b5918af3e82108c2c954cb Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Mon, 11 Dec 2023 12:15:18 +0200 Subject: [PATCH 14/15] add container --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1f0c7092..6df7cb22 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,6 +9,7 @@ jobs: publish-crate: runs-on: ubuntu-latest environment: release + container: paritytech/ci-unified:bullseye-1.73.0 steps: - name: Checkout code uses: actions/checkout@v4 From 3deedbc25d5f6141b1c14f69df4c3bec006b01c2 Mon Sep 17 00:00:00 2001 From: Sergejs Kostjucenko Date: Wed, 13 Dec 2023 12:38:06 +0200 Subject: [PATCH 15/15] add cargo publish auth token --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6df7cb22..2e9f3322 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,4 +20,4 @@ jobs: key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - name: Publish Crate - run: cargo publish -p parity-scale-codec \ No newline at end of file + run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} -p parity-scale-codec