Skip to content

Merge pull request #9 from eternal-flame-AD/master #1

Merge pull request #9 from eternal-flame-AD/master

Merge pull request #9 from eternal-flame-AD/master #1

Workflow file for this run

name: Lint Test and Benchmark
on: [push, pull_request]
jobs:
check-unix:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [stable, nightly]
os: [ubuntu-latest, macos-latest]
env:
GTFSORT_TEST_FEATURES_MINIMUM: "testing"
GTFSORT_TEST_FEATURES_FULL: "testing mmap all_ffi"
GTFSORT_TEST_FEATURES_RELEASE: "mmap all_ffi"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Cargo Check with Minimum Feature Flags
run: cargo check --no-default-features --features "$GTFSORT_TEST_FEATURES_MINIMUM"
- name: Cargo Check with Full Feature Flags
run: cargo check --features "$GTFSORT_TEST_FEATURES_FULL"
- name: Cargo Clippy with Minimum Feature Flags
run: cargo clippy --no-default-features --features "$GTFSORT_TEST_FEATURES_MINIMUM" -- -D warnings
- name: Cargo Clippy with Full Feature Flags
run: cargo clippy --features "$GTFSORT_TEST_FEATURES_FULL" -- -D warnings
- name: Cargo Test with Minimum Feature Flags
# saves time on more expensive machines
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: RUST_BACKTRACE=full cargo test --no-default-features --features "$GTFSORT_TEST_FEATURES_MINIMUM" -- --nocapture
- name: Cargo Build Release
run: cargo build --release --features "$GTFSORT_TEST_FEATURES_FULL"
- name: Cargo Test with Full Feature Flags
run: RUST_BACKTRACE=full cargo test --features "$GTFSORT_TEST_FEATURES_FULL" -- --nocapture
- name: Check C headers are up-to-date
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: git diff --exit-code include/gtfsort.h include/gtfsort.hxx
- name: Cargo Clean
if: ${{ matrix.rust == 'stable' }}
run: cargo clean
- name: Build Release
if: ${{ matrix.rust == 'stable' }}
run: cargo build --release --features "$GTFSORT_TEST_FEATURES_RELEASE"
- name: Upload Build Artifacts
if: ${{ startsWith(matrix.os, 'macos') != true && matrix.rust == 'stable' }}
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ matrix.os }}
path: |
target/release/gtfsort
target/release/libgtfsort.so
- name: Upload Build Artifacts (macOS)
if: ${{ startsWith(matrix.os, 'macos') && matrix.rust == 'stable' }}
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ matrix.os }}
path: |
target/release/gtfsort
target/release/libgtfsort.dylib
include/gtfsort.h
include/gtfsort.hxx
check-windows:
runs-on: windows-latest
strategy:
matrix:
rust: [stable, nightly]
env:
GTFSORT_TEST_FEATURES_MINIMUM: "testing"
GTFSORT_TEST_FEATURES_FULL: "testing mmap all_ffi"
GTFSORT_TEST_FEATURES_RELEASE: "mmap all_ffi"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up MSYS2 for Windows
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: x86_64-pc-windows-gnu
- name: Cargo Check with Minimum Feature Flags
run: cargo check --target x86_64-pc-windows-gnu --no-default-features --features $env:GTFSORT_TEST_FEATURES_MINIMUM
- name: Cargo Check with Full Feature Flags
run: cargo check --target x86_64-pc-windows-gnu --features $env:GTFSORT_TEST_FEATURES_FULL
- name: Cargo Clippy with Minimum Feature Flags
run: cargo clippy --target x86_64-pc-windows-gnu --no-default-features --features $env:GTFSORT_TEST_FEATURES_MINIMUM -- -D warnings
- name: Cargo Clippy with Full Feature Flags
run: cargo clippy --target x86_64-pc-windows-gnu --features $env:GTFSORT_TEST_FEATURES_FULL -- -D warnings
- name: Cargo Test with Minimum Feature Flags
run: $env:RUST_BACKTRACE="full"; cargo test --target x86_64-pc-windows-gnu --no-default-features --features $env:GTFSORT_TEST_FEATURES_MINIMUM -- --nocapture
- name: Cargo Build Release
run: cargo build --target x86_64-pc-windows-gnu --release --features $env:GTFSORT_TEST_FEATURES_FULL
- name: Cargo Test with Full Feature Flags
run: $env:RUST_BACKTRACE="full"; cargo test --target x86_64-pc-windows-gnu --features $env:GTFSORT_TEST_FEATURES_FULL -- --nocapture
- name: Cargo Clean
if: ${{ matrix.rust == 'stable' }}
run: cargo clean
- name: Build Release
if: ${{ matrix.rust == 'stable' }}
run: cargo build --target x86_64-pc-windows-gnu --release --features $env:GTFSORT_TEST_FEATURES_RELEASE
- name: Upload Build Artifacts
if: ${{ matrix.rust == 'stable' }}
uses: actions/upload-artifact@v4
with:
name: build-artifacts-windows
path: |
target/x86_64-pc-windows-gnu/release/gtfsort.exe
target/x86_64-pc-windows-gnu/release/gtfsort.dll
include/gtfsort.h
include/gtfsort.hxx
benchmark:
needs: [check-unix, check-windows]
if: ${{ needs.check-unix.result == 'success' && contains(github.event.head_commit.message, '[ci benchmark]') }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- name: Install Hyperfine
run: cargo install hyperfine --force --locked
- name: Set Upstream
run: git remote add upstream https://github.com/alejandrogzi/gtfsort.git
- name: Fetch Upstream
run: git fetch upstream
- name: Build Benchmark
run: cargo build --release --bin gtfsort-benchmark --features "mmap benchmark"
- name: Run Benchmark
env:
GITHUB_REPO_OWNER: ${{ github.event.repository.owner.login }}
GITHUB_REPO_NAME: ${{ github.event.repository.name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: target/release/gtfsort-benchmark -r upstream/master -- --show-output
- name: Upload Benchmark Results
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ matrix.os }}
path: |
tests/benchmark_*.csv
tests/benchmark_*.md
tests/benchmark-output.txt