Merge pull request #1574 from SudoVoxel/main #2524
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 | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: 0 0 * * * | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Get random cache id | |
run: echo "CACHE_ID=$((RANDOM))" >> $GITHUB_ENV | |
shell: bash | |
- uses: pat-s/[email protected] | |
with: | |
path: results/*.yaml | |
key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ env.CACHE_ID }} | |
restore-keys: | | |
results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}- | |
results-${{ hashFiles('Cargo.lock') }}- | |
results- | |
- name: Check Format | |
run: cargo fmt -- --check | |
- name: Build | |
run: cargo build | |
- name: Run | |
run: cargo run | |
env: | |
USERNAME_FOR_GITHUB: ${{ secrets.USERNAME_FOR_GITHUB }} | |
TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }} | |
RUST_LOG: warn |