linutil/.github/workflows/rust.yml

54 lines
1.3 KiB
YAML
Raw Normal View History

2024-07-13 22:58:12 +01:00
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
2024-07-13 23:35:48 +01:00
permissions:
contents: write
2024-07-13 22:58:12 +01:00
env:
CARGO_TERM_COLOR: always
jobs:
2024-07-13 23:49:23 +01:00
build_and_test:
2024-07-13 22:58:12 +01:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2024-07-13 23:04:40 +01:00
- name: Cache Cargo registry
uses: actions/cache@v4
2024-07-13 23:04:40 +01:00
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
2024-07-13 23:49:23 +01:00
restore-keys: ${{ runner.os }}-cargo-registry-
2024-07-13 23:04:40 +01:00
- name: Cache Cargo index
uses: actions/cache@v4
2024-07-13 23:04:40 +01:00
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
2024-07-13 23:49:23 +01:00
restore-keys: ${{ runner.os }}-cargo-index-
2024-07-13 23:04:40 +01:00
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
2024-07-13 22:58:12 +01:00
- name: Build
2024-07-13 23:57:54 +01:00
run: cargo build --release --verbose
- name: Upload linutil binary
uses: actions/upload-artifact@v4
with:
name: linutil
path: target/release/linutil
- name: Download linutil binary
uses: actions/download-artifact@v4
with:
name: linutil
path: .
2024-07-13 23:04:40 +01:00
- name: Replace linutil binary
2024-07-13 23:25:58 +01:00
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Replace linutil binary"
file_pattern: linutil
commit_options: "--allow-empty --no-verify"