Skip to content

Commit

Permalink
CI: github actions updates
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Jan 8, 2025
1 parent 77e1802 commit 30b493d
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 130 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/asv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ jobs:
with:
python-version: "3.10"

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Install dependencies
run: |
Expand Down
170 changes: 55 additions & 115 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
run: |
cargo check
test:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -53,32 +49,30 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
override: true

- uses: Swatinem/rust-cache@v2

- uses: taiki-e/install-action@nextest

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --no-fail-fast
run: |
cargo nextest run
test_all_features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- uses: actions-rs/install@v0.1
- uses: taiki-e/install-action@v2
with:
crate: cargo-all-features
version: latest
use-tool-cache: true
tool: cargo-all-features

- name: Run tests for all feature combinations
run: cargo test-all-features --no-fail-fast --all
Expand All @@ -88,29 +82,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2

- name: Install cargo-binstall
run: |
wget https://github.com/ryankurte/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-gnu.tgz
tar xf cargo-binstall-x86_64-unknown-linux-gnu.tgz
chmod +x cargo-binstall
mv cargo-binstall "$HOME/.cargo/bin"
- name: Install cargo-tarpaulin
run: cargo binstall --no-confirm cargo-tarpaulin
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest

- name: Coverage with tarpaulin
run: cargo tarpaulin --all --all-features --timeout 600 --out xml -- --test-threads 1
- name: Collect coverage data
run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info

- name: Upload Rust coverage to codecov
uses: codecov/codecov-action@v3
with:
flags: rust
fail_ci_if_error: true
files: lcov.info

lints:
name: Lints
Expand All @@ -129,36 +117,33 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
components: "clippy, rustfmt"

- uses: Swatinem/rust-cache@v2

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: |
cargo fmt --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all -- -D warnings
run: |
cargo clippy --all -- -D warnings
wasm-pack:
name: Check if wasm-pack builds a valid package for the sourmash crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: wasm32-unknown-unknown

- uses: Swatinem/rust-cache@v2

- name: Install wasm-pack
run: "curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh"

Expand Down Expand Up @@ -190,51 +175,16 @@ jobs:
with:
path: 'pkg/sourmash*.tgz'

wasm32-wasi:
name: Run tests under wasm32-wasi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install wasm32-wasi target
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-wasi
- name: Install wasmtime
run: "curl https://wasmtime.dev/install.sh -sSf | bash"
- name: Add wasmtime to PATH
run: echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
- name: Install cargo-wasi command
uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-wasi
- name: Build code with cargo-wasi
uses: actions-rs/cargo@v1
continue-on-error: true ## TODO: remove this when build works...
with:
command: wasi
args: build
- name: Run tests under wasm32-wasi
uses: actions-rs/cargo@v1
continue-on-error: true ## TODO: remove this when tests work...
with:
command: wasi
args: test

publish:
name: Publish (on tags, dry-run otherwise)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
Expand All @@ -245,62 +195,52 @@ jobs:
features: branchwater

- name: Make sure we can publish the sourmash crate
uses: actions-rs/cargo@v1
with:
command: publish
args: --dry-run --manifest-path src/core/Cargo.toml
run: |
cargo publish --dry-run --manifest-path src/core/Cargo.toml
# Login to crates.io on tags
- name: login to crates.io
uses: actions-rs/cargo@v1
if: startsWith(github.ref, 'refs/tags/r')
with:
command: login
args: ${{ secrets.CRATES_IO_TOKEN }}
run: |
cargo login ${{ secrets.CRATES_IO_TOKEN }}
# Publish to crates.io on tags
- name: Publish to crates.io
if: startsWith(github.ref, 'refs/tags/r')
uses: actions-rs/cargo@v1
with:
command: publish
args: --manifest-path src/core/Cargo.toml
run: |
cargo publish --manifest-path src/core/Cargo.toml
minimum_rust_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.66.0"
override: true

- uses: Swatinem/rust-cache@v2

- name: check if README matches MSRV defined here
run: grep '1.66.0' src/core/README.md

- name: Check if it builds properly
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features
run: |
cargo build --all-features
check_cbindgen:
name: "Check if cbindgen runs cleanly for generating the C headers"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- uses: actions-rs/install@v0.1
- uses: taiki-e/install-action@v2
with:
crate: cbindgen
version: 0.20.0
use-tool-cache: true
tool: [email protected]

- run: make include/sourmash.h

Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
};
rustVersion = pkgs.rust-bin.stable.latest.default.override {
#extensions = [ "rust-src" ];
extensions = [ "llvm-tools-preview" ];
#targets = [ "x86_64-unknown-linux-musl" ];
targets = [ "wasm32-wasi" "wasm32-unknown-unknown" "wasm32-unknown-emscripten" ];
targets = [ "wasm32-unknown-unknown" "wasm32-unknown-emscripten" ];
};
rustPlatform = pkgs.makeRustPlatform {
cargo = rustVersion;
Expand Down Expand Up @@ -122,7 +123,9 @@
cargo-outdated
cargo-udeps
cargo-deny
cargo-wasi
cargo-nextest
cargo-llvm-cov
cargo-component
cargo-codspeed
cargo-semver-checks
nixpkgs-fmt
Expand Down

0 comments on commit 30b493d

Please sign in to comment.