Skip to content

Commit

Permalink
Modernize actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marmeladema committed Nov 22, 2023
1 parent aeb8b30 commit 28b4d61
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 129 deletions.
166 changes: 46 additions & 120 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,238 +5,164 @@ jobs:
name: x86_64 stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo +${{steps.toolchain.outputs.name}} fmt --all -- --check
- name: Build all targets
uses: actions-rs/cargo@v1
with:
command: build
args: --workspace --all-targets
run: cargo +${{steps.toolchain.outputs.name}} build --workspace --all-targets
- name: Run Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets -- -D warnings
run: cargo +${{steps.toolchain.outputs.name}} clippy --workspace --all-targets -- -D warnings
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace
run: cargo +${{steps.toolchain.outputs.name}} test --workspace
x86_64-nightly:
name: x86_64 nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
override: true
components: clippy, rustfmt
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo +${{steps.toolchain.outputs.name}} fmt --all -- --check
- name: Build all targets
uses: actions-rs/cargo@v1
with:
command: build
args: --workspace --all-targets --all-features
run: cargo +${{steps.toolchain.outputs.name}} build --workspace --all-targets --all-features
- name: Run Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets --all-features -- -D warnings
run: cargo +${{steps.toolchain.outputs.name}} clippy --workspace --all-targets --all-features -- -D warnings
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-features
run: cargo +${{steps.toolchain.outputs.name}} test --workspace --all-features
x86_64-sanitizer:
name: x86_64 sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
override: true
components: rust-src
- name: Run tests with address sanitizer
uses: actions-rs/cargo@v1
env:
ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-12/bin/llvm-symbolizer
ASAN_SYMBOLIZER_PATH: /usr/lib/llvm-14/bin/llvm-symbolizer
RUSTFLAGS: -Zsanitizer=address
RUSTDOCFLAGS: -Zsanitizer=address
with:
command: test
args: --workspace --all-features --target x86_64-unknown-linux-gnu -Zbuild-std
run: cargo +${{steps.toolchain.outputs.name}} test --workspace --all-features --target x86_64-unknown-linux-gnu -Zbuild-std
wasm32-stable:
name: wasm32 stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
target: wasm32-wasi
- name: Build all targets
uses: actions-rs/cargo@v1
with:
command: build
args: --target wasm32-wasi --workspace --all-targets
run: cargo +${{steps.toolchain.outputs.name}} build --target wasm32-wasi --workspace --all-targets
- name: Run Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --target wasm32-wasi --workspace --all-targets -- -D warnings
run: cargo +${{steps.toolchain.outputs.name}} clippy --target wasm32-wasi --workspace --all-targets -- -D warnings
- name: Install cargo-wasi
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-wasi
run: cargo +${{steps.toolchain.outputs.name}} install cargo-wasi
- name: Install wasmtime
run: |
curl https://wasmtime.dev/install.sh -sSf | bash
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: wasi
args: test --workspace
run: cargo +${{steps.toolchain.outputs.name}} wasi test --workspace
wasm32-nightly:
name: wasm32 nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
override: true
components: clippy
target: wasm32-wasi
- name: Build all targets
uses: actions-rs/cargo@v1
with:
command: build
args: --target wasm32-wasi --workspace --all-targets --all-features
run: cargo +${{steps.toolchain.outputs.name}} build --target wasm32-wasi --workspace --all-targets --all-features
- name: Run Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --target wasm32-wasi --workspace --all-targets --all-features -- -D warnings
run: cargo +${{steps.toolchain.outputs.name}} clippy --target wasm32-wasi --workspace --all-targets --all-features -- -D warnings
- name: Install cargo-wasi
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-wasi
run: cargo +${{steps.toolchain.outputs.name}} install cargo-wasi
- name: Install wasmtime
run: |
curl https://wasmtime.dev/install.sh -sSf | bash
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: wasi
args: test --workspace --all-features
run: cargo +${{steps.toolchain.outputs.name}} wasi test --workspace --all-features
aarch64-nightly:
name: aarch64 nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install cross-compilation toolchain
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
override: true
components: clippy, rustfmt
target: aarch64-unknown-linux-gnu
- name: Build all targets
uses: actions-rs/cargo@v1
with:
command: build
args: --target aarch64-unknown-linux-gnu --workspace --all-targets --all-features
run: cargo +${{steps.toolchain.outputs.name}} build --target aarch64-unknown-linux-gnu --workspace --all-targets --all-features
env:
RUSTFLAGS: -C linker=aarch64-linux-gnu-gcc
- name: Run Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --target aarch64-unknown-linux-gnu --workspace --all-targets --all-features -- -D warnings
run: cargo +${{steps.toolchain.outputs.name}} clippy --target aarch64-unknown-linux-gnu --workspace --all-targets --all-features -- -D warnings
bench-stable:
name: Benchmarks stable
runs-on: ubuntu-latest
env:
CXX: clang++
LLVM_CONFIG_PATH: /usr/lib/llvm-12/bin/llvm-config
LLVM_CONFIG_PATH: /usr/lib/llvm-14/bin/llvm-config
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path bench/Cargo.toml --all -- --check
run: cargo +${{steps.toolchain.outputs.name}} fmt --manifest-path bench/Cargo.toml --all -- --check
- name: Build all targets
uses: actions-rs/cargo@v1
with:
command: bench
args: --manifest-path bench/Cargo.toml --workspace --no-run --all-targets
run: cargo +${{steps.toolchain.outputs.name}} bench --manifest-path bench/Cargo.toml --workspace --no-run --all-targets
- name: Run Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path bench/Cargo.toml --workspace --all-targets -- -D warnings
run: cargo +${{steps.toolchain.outputs.name}} clippy --manifest-path bench/Cargo.toml --workspace --all-targets -- -D warnings
bench-nightly:
name: Benchmarks nightly
runs-on: ubuntu-latest
env:
CXX: clang++
LLVM_CONFIG_PATH: /usr/lib/llvm-12/bin/llvm-config
LLVM_CONFIG_PATH: /usr/lib/llvm-14/bin/llvm-config
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
override: true
components: clippy, rustfmt
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path bench/Cargo.toml --all -- --check
run: cargo +${{steps.toolchain.outputs.name}} fmt --manifest-path bench/Cargo.toml --all -- --check
- name: Build all targets
uses: actions-rs/cargo@v1
with:
command: bench
args: --manifest-path bench/Cargo.toml --workspace --no-run --all-targets --all-features
run: cargo +${{steps.toolchain.outputs.name}} bench --manifest-path bench/Cargo.toml --workspace --no-run --all-targets --all-features
- name: Run Clippy linter
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path bench/Cargo.toml --workspace --all-targets --all-features -- -D warnings
run: cargo +${{steps.toolchain.outputs.name}} clippy --manifest-path bench/Cargo.toml --workspace --all-targets --all-features -- -D warnings
13 changes: 4 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ jobs:
name: Cargo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
- name: Check version number
run: ./scripts/check-version.sh
- name: Login to registry
uses: actions-rs/cargo@v1
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
command: login
args: "$CARGO_REGISTRY_TOKEN"
run: cargo +${{steps.toolchain.outputs.name}} login "$CARGO_REGISTRY_TOKEN"
- name: Publish crate
uses: actions-rs/cargo@v1
with:
command: publish
run: cargo +${{steps.toolchain.outputs.name}} publish

0 comments on commit 28b4d61

Please sign in to comment.