name: Rust
on:
push:
pull_request:
schedule:
- cron: '0 6 * * 0-6'
jobs:
stable:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: |
cargo build --verbose
cargo build --release --features="osmgraphing" --verbose
- name: Run tests
run: |
cargo test --verbose
cargo run --example dijkstra
cargo run --example parser
cargo fmt -- --check
- name: Build docs
run: cargo doc
beta:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install toolchain
run: |
rustup toolchain install beta
rustup default beta
- name: Build
run: |
cargo build --verbose
cargo build --release --features="osmgraphing" --verbose
- name: Run tests
run: |
cargo test --verbose
cargo run --example dijkstra
cargo run --example parser
cargo fmt -- --check
nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
continue-on-error: true
- name: Install
run: |
rustup toolchain install nightly
rustup default nightly
continue-on-error: true
- name: Build
run: |
cargo build --verbose
cargo build --release --features="osmgraphing" --verbose
continue-on-error: true
- name: Run tests
run: |
cargo test --verbose
cargo run --example dijkstra
cargo run --example parser
cargo fmt -- --check
continue-on-error: true
benches:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run benchmarks
run: cargo bench --bench routing -- --warm-up-time 10 --measurement-time 120
- name: Prepare upload
run: |
__ARTIFACTS="artifacts/$(git rev-parse --verify HEAD)"
mkdir -p "${__ARTIFACTS}"
mv target/criterion/ "${__ARTIFACTS}/"
- name: Upload results
uses: actions/upload-artifact@v1
with:
name: benches
path: artifacts/
deploy-and-tag:
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
needs: [stable, benches]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup git-user
env:
GIT_USER_NAME: 'GitHub Actions'
GIT_USER_EMAIL: 'actions@users.noreply.github.com'
run: |
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"
git fetch --all
- name: Deploy and tag
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
run: |
cargo publish --token "${CRATES_TOKEN}"
git tag --annotate "v$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" --message='See CHANGELOG.md'
git push --tags