Update rust.yml #180
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: | |
pull_request: | |
release: | |
types: [released] | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --all -- --check | |
doc2readme: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/msrd0/cargo-doc2readme:nightly | |
steps: | |
- uses: actions/checkout@v3 | |
- run: apk add --no-cache libxrandr-dev | |
- run: cargo doc2readme --check --all-features --expand-macros --manifest-path more-wallpapers/Cargo.toml | |
cargo_publish: | |
if: ${{ github.event_name == 'release' }} | |
needs: [rustfmt, doc2readme, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- name: Install xrandr | |
run: sudo apt-get update && sudo apt-get install -y libxrandr-dev | |
- run: cargo publish --package more-wallpapers --token ${{ secrets.CRATES_IO_TOKEN }} | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, windows, macos] | |
rust_version: [stable, 1.62] | |
name: "${{ matrix.os }} ${{ matrix.rust_version }}" | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust_version }} | |
id: "rust-toolchain" | |
- name: install cargo-all-features | |
uses: baptiste0928/[email protected] | |
with: | |
crate: cargo-all-features | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}" | |
- name: Install xrandr | |
if: ${{ matrix.os == 'ubuntu' }} | |
run: sudo apt-get update && sudo apt-get install -y libxrandr-dev | |
- run: cargo test-all-features | |
env: | |
RUST_BACKTRACE: 1 |