Rust #346
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: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
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: Install dependencies (apt) | |
run: sudo apt-get install libpcsclite-dev nettle-dev | |
- name: Build | |
run: cargo build --release --verbose | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bin | |
path: target/release/sh4d0wup | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
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: Install dependencies | |
run: brew install pkg-config zstd | |
- name: Build | |
run: cargo build --release --verbose | |
integration-test: | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
plot: | |
- path: contrib/plot-alpine.yaml | |
- path: contrib/plot-archlinux-lsign.yaml | |
- path: contrib/plot-archlinux.yaml | |
- path: contrib/plot-curl-sh.yaml | |
- path: contrib/plot-debian.yaml | |
- path: contrib/plot-elf-galore.yaml | |
setup: | | |
rustup target add x86_64-unknown-linux-musl | |
- path: contrib/plot-git.yaml | |
- path: contrib/plot-git-tags.yaml | |
- path: contrib/plot-helm.yaml | |
- path: contrib/plot-httpbin.yaml | |
- path: contrib/plot-linuxbrew.yaml | |
args: '-B 0.0.0.0:443' | |
sudo: 'sudo' | |
- path: contrib/plot-podman-cgr.yaml | |
- path: contrib/plot-podman-docker-hub.yaml | |
- path: contrib/plot-podman-ecr.yaml | |
- path: contrib/plot-podman-gcr.yaml | |
- path: contrib/plot-podman-ghcr.yaml | |
- path: contrib/plot-rustup.yaml | |
- path: contrib/plot-signal-desktop.yaml | |
- path: contrib/plot-terraform.yaml | |
- path: contrib/plot-curl-ipfs.yaml | |
name: ${{ matrix.plot.path }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- name: Install dependencies (apt) | |
run: sudo apt-get install libpcsclite-dev nettle-dev | |
- name: Setup environment | |
run: ${{ matrix.plot.setup }} | |
if: ${{ matrix.plot.setup }} | |
- name: 🦝 Run a plot | |
run: chmod +x bin/sh4d0wup && ${{ matrix.plot.sudo }} bin/sh4d0wup check ${{ matrix.plot.path }} ${{ matrix.plot.args }} | |
make-plots: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
- name: Install dependencies (apt) | |
run: sudo apt-get install libpcsclite-dev nettle-dev | |
- name: Setup rust for musl target | |
run: rustup target add x86_64-unknown-linux-musl | |
- name: Compile all plots | |
run: chmod +x bin/sh4d0wup && make sh4d0wup=bin/sh4d0wup -j8 | |
unit-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
continue-on-error: false | |
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: Install dependencies (apt) | |
run: sudo apt-get install libpcsclite-dev nettle-dev sq | |
- name: Run clippy | |
run: cargo clippy -- -D warnings | |
- name: Run tests | |
run: cargo test --verbose | |
fmt: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check |