Skip to content

enabled hdf feature for testing build #539

enabled hdf feature for testing build

enabled hdf feature for testing build #539

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: ["master"]
# Ensure this workflow gets cancelled if a newer commit has been pushed on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
RUST_BACKTRACE: 1
RUST_LOG: debug
JUST_VERBOSE: 1
JUST_COLOR: always
jobs:
check:
strategy:
fail-fast: false
matrix:
include:
- TARGET: x86_64-unknown-linux-gnu
# If you add features to your crate, chances are you want to test for all features for native binaries,
# so that all features are checked and can be build by someone cloning your repository.
# If you build natively it will be a binary, the default binary will have the entrypoint "src/main.rs".
flags: "--all-features --bins"
- TARGET: wasm32-unknown-unknown
# With the current trunk setup, if you add features, the webpage will have the default features.
# You could test for all features too, however that might require a lot of conditional compilation annotations.
# Thus we only test for the default features by default.
# Since we build with trunk the entrypoint will also be the "src/main.rs" file.
flags: "--bin ${{ github.event.repository.name }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{matrix.TARGET}}
- uses: Swatinem/rust-cache@v2
- run: sudo apt-get update && sudo apt-get install libhdf5-dev
- run: cargo check ${{matrix.flags}} --target ${{matrix.TARGET}}
audit:
runs-on: ubuntu-latest
env:
RUST_LOG: '' # Otherwise audit-check errors on attempting to parse the logging output
steps:
- uses: actions/checkout@v4
- name: Install cargo-binstall
uses: cargo-bins/[email protected]
- name: Install Cargo audit
run: cargo binstall cargo-audit
- name: Run Audit
run: cargo audit
test:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- uses: extractions/setup-just@v2
- uses: Swatinem/rust-cache@v2
- name: Install HDF5
shell: bash
run: just init::install-hdf5-headers
- name: Run MSI installer (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd just\hdf
msiexec /i HDF5-1.14.0-win64.msi /quiet /qn /norestart
- name: Run tests
run: cargo nextest run --workspace --profile ci
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: sudo apt-get update && sudo apt-get install libhdf5-dev
- name: Lint native
run: cargo clippy --workspace --all-features -- -D warnings -W clippy::all
- name: Lint WASM
run: |
export CLIPPY_CONF_DIR="$(pwd)/lint/wasm/clippy.toml"
cargo clippy --workspace --all-features --target wasm32-unknown-unknown -- -D warnings -W clippy::all
trunk:
name: trunk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Download and install Trunk binary
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
- name: Build
run: ./trunk build
tag-release:
needs: [check, audit, test, format, lint, trunk]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && success()
permissions:
contents: write # This is required to create and push tags
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_WITH_REPO_SCOPE }}
- name: Get version from Cargo.toml
id: get_version
run: |
VERSION=$(grep '^version = ' Cargo.toml | cut -d '"' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if tag exists
id: check_tag
run: |
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
echo "Tag already exists"
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "Tag does not exist"
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: Create and push tag
if: env.TAG_EXISTS == 'false'
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git tag -a "v${{ env.VERSION }}" -m "Release v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"