name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
release:
types: [published]
schedule:
- cron: '0 10 * * *'
jobs:
changelog:
name: CHANGELOG
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v1
- name: Debugging info
run: |
git remote -v
- name: Check that CHANGELOG has been updated
run: |
# If this step fails, this means you haven't updated the CHANGELOG.md
# file with notes on your contribution.
git diff --name-only $(git merge-base origin/master HEAD) | grep '^CHANGELOG.md$' && echo "Thanks for helping keep our CHANGELOG up-to-date!"
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
override: true
- name: Set build variables
run: |
# We use these variables as part of the cache keys.
echo "RUST_VERSION=$(rustc --version)" >> $GITHUB_ENV
echo "CARGO_VERSION=$(cargo --version)" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: cargo registry ${{ github.job }} ${{ runner.os }} ${{ env.RUST_VERSION }} ${{ env.CARGO_VERSION }} ${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: cargo build ${{ github.job }} ${{ runner.os }} ${{ env.RUST_VERSION }} ${{ env.CARGO_VERSION }} ${{ hashFiles('**/Cargo.toml') }}
- name: Lint with rustfmt
if: always()
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Lint with clippy
if: always()
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D warnings
- name: Build
if: always()
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features
- name: Run unit tests
if: always()
uses: actions-rs/cargo@v1
with:
command: test
args: --lib --all-features
- name: Run integration tests
if: always()
uses: actions-rs/cargo@v1
with:
command: test
args: --test cli
- name: Run doc tests
if: always()
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --all-features
publish:
name: Publish
needs: [build]
runs-on: ubuntu-latest
if: github.repository == 'epwalsh/rust-cached-path' && github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Log in to crates.io
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_TOKEN }}
- name: Publish
uses: actions-rs/cargo@v1
with:
command: publish