build: update lockfiles #253
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: Test and Build Rust | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: --allow unknown-lints --deny warnings | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt | |
- uses: actions/checkout@v4 | |
- run: cargo fmt --check --verbose | |
clippy: | |
name: Clippy ${{ matrix.toolchain }} | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ (matrix.toolchain == 'beta') || (matrix.toolchain == 'nightly') }} | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- stable | |
- beta | |
- nightly | |
env: | |
RUSTFLAGS: --deny warnings | |
steps: | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: clippy | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
key: clippy-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }} | |
path: target/ | |
- run: cargo fetch --locked | |
- run: cargo clippy --offline --all-targets | |
- run: cargo doc --offline --no-deps | |
test: | |
name: Test ${{ matrix.toolchain }} ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.toolchain == 'nightly' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- stable | |
- beta | |
- nightly | |
os: | |
- ubuntu-latest | |
- macos-latest | |
steps: | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
key: test-${{ matrix.toolchain }}-${{ matrix.os }}-${{ hashFiles('**/Cargo.lock') }} | |
path: target/ | |
- run: cargo fetch --locked | |
- run: cargo build --offline --all-targets | |
- run: cargo test --offline | |
release: | |
name: Release ${{ matrix.triple }} | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- triple: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
steps: | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
targets: ${{ matrix.triple }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set artifact name | |
shell: bash | |
run: | | |
version="$(git describe --tags --match "v*.*.*" --always)" | |
echo "version: $version" | |
echo "GIT_TAG_VERSION=$version" >> $GITHUB_ENV | |
name="hawhh-calendarbot-parser-$version-${{ matrix.triple }}" | |
echo "artifact: $name" | |
echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
key: release-${{ matrix.triple }}-${{ hashFiles('**/Cargo.lock') }} | |
path: target/ | |
- run: cargo fetch --locked | |
- name: Build | |
run: cargo build --release --offline --target ${{ matrix.triple }} | |
- name: Package tar.gz (*nix) | |
if: runner.os != 'Windows' | |
run: > | |
tar -cv | |
LICENSE README.md | |
-C target/${{ matrix.triple }}/release/ hawhh-calendarbot-parser | |
| gzip --best > ${{ env.ARTIFACT_NAME }}.tar.gz | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.triple }} | |
path: | | |
*.deb | |
*.rpm | |
*.tar.gz | |
*.zip | |
- name: Create GitHub release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
*.deb | |
*.rpm | |
*.tar.gz | |
*.zip |