-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch CI from GitLab to GitHub Actions (#546)
Switch CI from GitLab to GitHub Actions Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
- Loading branch information
1 parent
5fc75b9
commit c191496
Showing
4 changed files
with
229 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
name: Rust CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
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. | ||
# 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 | ||
needs: [set-image] | ||
container: ${{ needs.set-image.outputs.IMAGE }} | ||
steps: | ||
- name: Checkout code/. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Show Rust version | ||
run: | | ||
cargo -vV | ||
rustc -vV | ||
rustup show | ||
- 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 | ||
needs: [set-image] | ||
container: ${{ needs.set-image.outputs.IMAGE }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Show Rust version | ||
run: | | ||
cargo -vV | ||
rustc -vV | ||
rustup show | ||
- 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 | ||
needs: [set-image] | ||
container: ${{ needs.set-image.outputs.IMAGE }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Show Rust version | ||
run: | | ||
cargo -vV | ||
rustc -vV | ||
rustup show | ||
- 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 --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 --features max-encoded-len,std --no-default-features | ||
# Benches | ||
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 | ||
uses: actions/checkout@v4 | ||
|
||
- 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 ${{ 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 | ||
uses: actions/checkout@v4 | ||
|
||
- 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 ${{ matrix.feature }} --release | ||
# Build | ||
|
||
build-linux-ubuntu-amd64: | ||
runs-on: ubuntu-latest | ||
needs: [set-image, clippy, checks, tests] | ||
container: ${{ needs.set-image.outputs.IMAGE }} | ||
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: 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: [set-image, build-linux-ubuntu-amd64] | ||
container: ${{ needs.set-image.outputs.IMAGE }} | ||
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: Dry Run Publish | ||
if: github.event_name == 'pull_request' | ||
run: cargo publish -p parity-scale-codec --dry-run |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish release to crates.io | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
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 | ||
|
||
- name: Cache Rust dependencies | ||
uses: swatinem/rust-cache@v2 | ||
with: | ||
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} | ||
|
||
- name: Publish Crate | ||
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} -p parity-scale-codec |
Oops, something went wrong.