Make CI green #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
components: rustfmt | |
default: true | |
override: true | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }} | |
- name: Format | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
doc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
components: rust-docs | |
default: true | |
override: true | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }} | |
- name: Documentation | |
uses: actions-rs/cargo@v1 | |
env: | |
DOCS_RS: 1 | |
with: | |
command: doc | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
components: clippy | |
default: true | |
override: true | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }} | |
- name: Build cache | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-build-rust_stable-check-${{ hashFiles('**/Cargo.toml') }} | |
- name: Clippy check | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all --all-features --all-targets | |
check-minimal: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
profile: minimal | |
default: true | |
override: true | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-rust_nightly-${{ hashFiles('**/Cargo.toml') }} | |
- name: Build cache | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-build-rust_nightly-check-minimal-${{ hashFiles('**/Cargo.toml') }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --all --all-features --all-targets -Z minimal-versions | |
test: | |
needs: | |
- format | |
- doc | |
- check | |
- check-minimal | |
strategy: | |
fail-fast: ${{ startsWith(github.ref, 'refs/tags/') }} | |
matrix: | |
rust: [stable, beta, nightly] | |
features: | |
- --no-default-features | |
- '' | |
include: | |
- rust: stable | |
- rust: beta | |
- rust: nightly | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
default: true | |
override: true | |
- name: Cargo cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-rust_stable-${{ hashFiles('**/Cargo.toml') }} | |
- name: Build cache | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-build-rust_stable-check-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update deps | |
uses: actions-rs/cargo@v1 | |
with: | |
command: update | |
- name: Test | |
uses: actions-rs/cargo@v1 | |
env: | |
RUST_BACKTRACE: full | |
with: | |
command: test | |
args: --all ${{ matrix.features }} | |
publish: | |
if: github.repository == 'Smithay/wlcs-rs' && startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- format | |
- doc | |
- check | |
- check-minimal | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Publish crates | |
uses: katyo/publish-crates@v1 | |
with: | |
registry-token: ${{ secrets.CRATES_TOKEN }} | |
args: --no-verify |