awesome-rust/.github/workflows/rust.yml

49 lines
1.5 KiB
YAML
Raw Normal View History

2021-01-31 12:46:10 +00:00
name: Rust
on:
push:
2021-08-08 18:52:32 +00:00
branches:
2022-06-11 09:17:08 +00:00
- main
2021-01-31 12:46:10 +00:00
pull_request:
2021-08-08 18:52:32 +00:00
branches:
2022-06-11 09:17:08 +00:00
- main
schedule:
2021-08-08 18:52:32 +00:00
- cron: 0 0 * * *
2021-01-31 12:46:10 +00:00
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
2024-03-17 13:52:20 +00:00
- uses: actions/checkout@v4
2022-11-06 18:29:11 +00:00
- uses: dtolnay/rust-toolchain@master
2021-08-08 18:52:32 +00:00
with:
toolchain: stable
2021-10-16 20:56:51 +00:00
components: rustfmt
2022-11-06 18:29:11 +00:00
- uses: Swatinem/rust-cache@v2
2024-03-17 14:04:13 +00:00
- name: Load results cache
2024-04-24 20:10:15 +00:00
uses: actions/cache/restore@v4
2021-08-08 18:52:32 +00:00
with:
2021-08-10 22:55:13 +00:00
path: results/*.yaml
2024-04-24 20:18:55 +00:00
key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }}-${{ github.run_attempt }}
2021-08-08 18:52:32 +00:00
restore-keys: |
2024-04-24 20:18:55 +00:00
results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }}-
2021-08-08 18:52:32 +00:00
results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-
results-${{ hashFiles('Cargo.lock') }}-
results-
2021-10-16 20:56:51 +00:00
- name: Check Format
run: cargo fmt -- --check
2021-08-08 18:52:32 +00:00
- name: Build
run: cargo build
2022-06-11 09:33:22 +00:00
- name: Run
run: cargo run
env:
USERNAME_FOR_GITHUB: ${{ secrets.USERNAME_FOR_GITHUB }}
TOKEN_FOR_GITHUB: ${{ secrets.TOKEN_FOR_GITHUB }}
2022-06-11 09:33:22 +00:00
RUST_LOG: warn
- name: Save results cache
2024-04-24 20:10:15 +00:00
uses: actions/cache/save@v4
2024-04-24 20:14:52 +00:00
if: always() && (github.ref == 'refs/heads/main' || github.ref == 'refs/pull/1716/merge')
with:
path: results/*.yaml
2024-04-24 20:18:55 +00:00
key: results-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('README.md') }}-${{ github.run_id }}-${{ github.run_attempt }}