Update rust.yml #24
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: CI Rust -> Check code and make git version | |
on: | |
push: | |
branches: ["master"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
make-cache: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Make Cache | |
uses: Swatinem/rust-cache@v2.7.3 | |
with: | |
save-if: true | |
cache-all-crates: true | |
shared-key: tests | |
cache-directories: ~/.cargo | |
- name: Set Toolchain | |
uses: actions-rs/toolchain@v1.0.6 | |
with: | |
toolchain: stable | |
- name: Job | |
run: cargo build -F full --locked | |
Clippy: | |
needs: | |
- make-cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Load Cache | |
uses: Swatinem/rust-cache@v2.7.3 | |
with: | |
# save-if: false | |
shared-key: tests | |
- name: Toolchain info | |
run: echo rustc --version | |
- name: Job | |
run: cargo clippy --all-targets -F full --locked -- -D warnings | |
Doc-check: | |
needs: | |
- make-cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Load Cache | |
uses: Swatinem/rust-cache@v2.7.3 | |
with: | |
# save-if: false | |
shared-key: tests | |
- name: Toolchain info | |
run: echo rustc --version | |
- name: Job | |
run: cargo test -F full --doc --locked | |
Lib-check: | |
needs: | |
- make-cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Load Cache | |
uses: Swatinem/rust-cache@v2.7.3 | |
with: | |
# save-if: false | |
shared-key: tests | |
- name: Toolchain info | |
run: echo rustc --version | |
- name: Job | |
run: cargo test -p shuller -F full --lib --locked | |
Lib-and-Tests-check: | |
needs: | |
- make-cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Load Cache | |
uses: Swatinem/rust-cache@v2.7.3 | |
with: | |
# save-if: false | |
shared-key: tests | |
- name: Toolchain info | |
run: echo rustc --version | |
- name: Job | |
run: cargo test -p shuller tests -F full --locked | |
Make-Tag: | |
needs: | |
- Clippy | |
- Doc-check | |
- Lib-check | |
- Lib-and-Tests-check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Save version | |
run: | | |
version=$(grep '^version =' Cargo.toml | head -n 1 | cut -d '"' -f 2) | |
echo "version=$version" >> $GITHUB_ENV | |
echo "Extracted version: $version" | |
- name: Configure Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Make tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git fetch --tags | |
if git show-ref --tags | grep -q "refs/tags/v$version"; then | |
git tag -d "v$version" | |
git push origin --delete "v$version" | |
fi | |
git tag "v$version" | |
git push origin "v$version" | |