Rust #27
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: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
- cron: '0 9 * * 1' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ${{ matrix.os.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: ubuntu-22.04 | |
upload: target/release/backseat-signed | |
- name: macos-latest | |
# https://github.com/magicant/yash-rs/pull/357 | |
#- name: windows-latest | |
# features: -F vendored | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-release- | |
- name: Build | |
run: cargo build --release --locked --verbose ${{ matrix.os.features }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bin | |
path: ${{ matrix.os.upload }} | |
if: matrix.os.upload | |
integration-test: | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
test: | |
- name: archlinux-pkg-from-sig | |
cmd: plumbing archlinux-pkg-from-sig --keyring tests/data/kpcyrd.asc --sig tests/data/cmatrix/cmatrix-2.0-3-x86_64.pkg.tar.zst.sig tests/data/cmatrix/cmatrix-2.0-3-x86_64.pkg.tar.zst | |
- name: archlinux-pkgbuild-from-pkg | |
cmd: plumbing archlinux-pkgbuild-from-pkg --pkg tests/data/cmatrix/cmatrix-2.0-3-x86_64.pkg.tar.zst tests/data/cmatrix/PKGBUILD | |
- name: archlinux-file-from-pkgbuild | |
cmd: plumbing archlinux-file-from-pkgbuild --pkgbuild tests/data/cmatrix/PKGBUILD tests/data/cmatrix/cmatrix-2.0.tar.gz | |
- name: pgp-verify (Debian, vim) | |
cmd: plumbing pgp-verify --keyring tests/data/debian-archive-bookworm-automatic.asc --sig tests/data/vim/Release.gpg tests/data/vim/Release | |
- name: pgp-verify (Arch Linux, cmatrix) | |
cmd: plumbing pgp-verify --keyring tests/data/kpcyrd.asc --sig tests/data/cmatrix/cmatrix-2.0-3-x86_64.pkg.tar.zst.sig tests/data/cmatrix/cmatrix-2.0-3-x86_64.pkg.tar.zst | |
- name: debian-sources-from-release (vim) | |
cmd: plumbing debian-sources-from-release --keyring tests/data/debian-archive-bookworm-automatic.asc --sig tests/data/vim/Release.gpg --release tests/data/vim/Release tests/data/vim/Sources.xz | |
- name: debian-tarball-from-sources (vim) | |
cmd: plumbing debian-tarball-from-sources --sources tests/data/vim/Sources.xz --orig tests/data/vim/vim_9.1.0199.orig.tar.xz --name vim tests/data/vim/vim_9.1.0199.orig.tar | |
setup: | | |
unxz -k tests/data/vim/vim_9.1.0199.orig.tar.xz | |
- name: debian-tarball-from-sources (cmatrix) | |
cmd: plumbing debian-tarball-from-sources --sources tests/data/vim/Sources.xz tests/data/cmatrix/cmatrix-2.0.tar.gz | |
name: "integration: ${{ matrix.test.name }}" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: actions/download-artifact@v4 | |
- name: Setup environment | |
run: ${{ matrix.test.setup }} | |
if: ${{ matrix.test.setup }} | |
- name: 🧪 Run test | |
run: chmod +x bin/backseat-signed && bin/backseat-signed ${{ matrix.test.cmd }} | |
unit-test: | |
runs-on: ${{ matrix.os.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: ubuntu-22.04 | |
- name: macos-latest | |
# https://github.com/magicant/yash-rs/pull/357 | |
#- name: windows-latest | |
# features: -F vendored | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo-debug- | |
- name: Run clippy | |
run: cargo clippy ${{ matrix.os.features }} -- -D warnings | |
- name: Run tests | |
run: cargo test ${{ matrix.os.features }} --verbose | |
fmt: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check |