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: Install toolchain
run: |
rustup component add rustfmt
- name: Build
run: |
cargo build --verbose
cargo build --release --verbose
- name: Run tests
run: |
cargo test --verbose
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 --verbose
- name: Run tests
run: |
cargo test --verbose
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 --verbose
continue-on-error: true
- name: Run tests
run: |
cargo test --verbose
continue-on-error: true
deploy-and-tag:
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
needs: [stable]
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 build
cargo publish --token "${CRATES_TOKEN}"
git tag --annotate "v$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" --message='See CHANGELOG.md'
git push --tags