build: update lockfiles #103
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: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- uses: actions/checkout@v4 | |
- run: cargo fmt --check --verbose | |
clippy: | |
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: | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: clippy | |
- uses: actions/checkout@v4 | |
- run: cargo fetch | |
- run: cargo clippy --offline --all-targets | |
- run: cargo doc --offline --no-deps | |
test: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.toolchain == 'nightly' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- stable | |
- beta | |
- nightly | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
steps: | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: actions/checkout@v4 | |
- run: cargo fetch | |
- run: cargo build --offline --all-targets | |
- run: cargo test --offline --no-fail-fast | |
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 | |
rpm: true | |
- triple: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
rpm: true | |
- triple: armv7-unknown-linux-gnueabihf | |
os: ubuntu-latest | |
rpm: true | |
- triple: arm-unknown-linux-gnueabihf | |
os: ubuntu-latest | |
- triple: riscv64gc-unknown-linux-gnu | |
os: ubuntu-latest | |
- triple: x86_64-apple-darwin | |
os: macos-latest | |
- triple: aarch64-apple-darwin | |
os: macos-latest | |
- triple: x86_64-pc-windows-msvc | |
os: windows-latest | |
- triple: aarch64-pc-windows-msvc | |
os: windows-latest | |
env: | |
RUSTFLAGS: --deny warnings | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.triple }} | |
- name: Install cargo tools | |
if: runner.os == 'Linux' | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cross,cargo-deb,cargo-generate-rpm | |
- 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="project-below-$version-${{ matrix.triple }}" | |
echo "artifact: $name" | |
echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV | |
- run: cargo fetch --locked | |
- run: ${{ runner.os == 'Linux' && 'cross' || 'cargo' }} build --release --offline --target ${{ matrix.triple }} | |
- name: Package tar.gz (*nix) | |
if: runner.os != 'Windows' | |
run: > | |
tar -cv | |
CHANGELOG.md LICENSE README.md | |
-C target/ completions/ -C ../ | |
-C target/ manpages/ -C ../ | |
-C target/${{ matrix.triple }}/release/ project-below | |
| gzip --best > ${{ env.ARTIFACT_NAME }}.tar.gz | |
- name: Package zip (Windows) | |
if: runner.os == 'Windows' | |
run: > | |
7z a ${{ env.ARTIFACT_NAME }}.zip | |
CHANGELOG.md LICENSE README.md | |
./target/completions/ | |
./target/manpages/ | |
./target/${{ matrix.triple }}/release/project-below.exe | |
- name: Package deb | |
if: runner.os == 'Linux' | |
run: cargo deb --no-build --no-strip --target ${{ matrix.triple }} --output ${{ env.ARTIFACT_NAME }}.deb | |
- name: Package rpm | |
if: matrix.rpm | |
run: cargo generate-rpm --auto-req disabled --target ${{ matrix.triple }} --output ${{ env.ARTIFACT_NAME }}.rpm | |
- 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 |