Skip to content

Fix actions

Fix actions #3

Workflow file for this run

name: Rust Build and Test
on:
push:
branches: [ main ]
paths: [ .github/workflows/build.yml, src/**, test/**, build.rs, Cargo.lock, Cargo.toml, Cross.toml ]
pull_request:
branches: [ main ]
paths: [ .github/workflows/build.yml, src/**, test/**, build.rs, Cargo.lock, Cargo.toml, Cross.toml ]
workflow_dispatch:
env:
bin-name: dvs
feature-set: ''
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache
with:
path: |
.cargo-store
key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
- name: Create Folders
if: ${{ !steps.cache.outputs.cache-hit }}
run: |
mkdir -p ~/.cargo/registry/index
mkdir -p ~/.cargo/registry/cache
mkdir -p ~/.cargo/git/db
mkdir -p ./.cargo-store
- name: Update Rust
if: ${{ !steps.cache.outputs.cache-hit }}
run: rustup update
- name: Rust Version
if: ${{ !steps.cache.outputs.cache-hit }}
run: rustc --version
- name: Download Deps
if: ${{ !steps.cache.outputs.cache-hit }}
run: cargo fetch --verbose --locked
- name: Store Deps
if: ${{ !steps.cache.outputs.cache-hit }}
run: |
mkdir -p ./.cargo-store/registry
mkdir -p ./.cargo-store/git
cp -r ~/.cargo/registry/index ./.cargo-store/registry
cp -r ~/.cargo/registry/cache ./.cargo-store/registry
cp -r ~/.cargo/git/db ./.cargo-store/git
reports:
runs-on: ubuntu-latest
needs: [ setup ]
steps:
- uses: actions/checkout@v3
- name: Get deps from cache
uses: actions/cache@v3
with:
path: |
.cargo-store
key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Move deps
run: mv ./.cargo-store/* ~/.cargo
- name: Cache Advisory DB
uses: actions/cache@v3
with:
path: |
~/.cargo/advisory-db
key: cache-advisory-db
- name: Update Rust
run: rustup update
- name: Rust Version
run: rustc --version
- uses: cargo-prebuilt/cargo-prebuilt-action@v2
with:
pkgs: cargo-audit
- name: Deps Report
run: |
echo "### Deps:" >> $GITHUB_STEP_SUMMARY
echo "Generated on: $(date --utc)" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cargo tree --verbose -e normal,build --locked >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Audit Report
run: |
echo "### Audit:" >> $GITHUB_STEP_SUMMARY
echo "Generated on: $(date --utc)" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cargo audit >> $GITHUB_STEP_SUMMARY || true
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
cross:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
can-test: true
- target: x86_64-unknown-linux-musl
can-test: true
- target: aarch64-unknown-linux-gnu
can-test: true
- target: aarch64-unknown-linux-musl
can-test: true
- target: x86_64-unknown-freebsd
can-test: false
- target: x86_64-unknown-netbsd
can-test: false
- target: x86_64-unknown-illumos
can-test: false
- target: x86_64-sun-solaris
can-test: false
- target: riscv64gc-unknown-linux-gnu
can-test: true
- target: powerpc64-unknown-linux-gnu
can-test: true
- target: powerpc64le-unknown-linux-gnu
can-test: true
- target: s390x-unknown-linux-gnu
can-test: true
- target: armv7-unknown-linux-gnueabihf
can-test: true
- target: armv7-unknown-linux-musleabihf
can-test: true
- target: x86_64-pc-windows-gnu
can-test: true
ending: .exe
runs-on: ubuntu-latest
needs: [ setup ]
steps:
- uses: actions/checkout@v3
- name: Get deps from cache
uses: actions/cache@v3
with:
path: |
.cargo-store
key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Move deps
run: mv ./.cargo-store/* ~/.cargo
- uses: actions/cache@v3
with:
path: |
target
key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
- name: Update Rust
run: rustup update
- name: Rust Version
run: rustc --version
- uses: cargo-prebuilt/cargo-prebuilt-action@v2
with:
pkgs: cross
- name: Run tests
if: ${{ matrix.can-test }}
run: cross test --verbose --workspace --locked --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Build
run: cross build --verbose --workspace --locked --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: target-${{ matrix.target }}
path: |
target/${{ matrix.target }}/debug/${{ env.bin-name }}${{ matrix.ending }}
apple-darwin:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
can-test: true
- target: aarch64-apple-darwin
can-test: false
runs-on: macos-latest
needs: [ setup ]
steps:
- uses: actions/checkout@v3
- name: Get deps from cache
uses: actions/cache@v3
with:
path: |
.cargo-store
key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Move deps
run: mv ./.cargo-store/* ~/.cargo
- uses: actions/cache@v3
with:
path: |
target
key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
- name: Update Rust
run: rustup update
- name: Rust Version
run: rustc --version
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- uses: cargo-prebuilt/cargo-prebuilt-action@v2
with:
pkgs: cargo-auditable
- name: Run tests
if: ${{ matrix.can-test }}
run: cargo test --verbose --workspace --locked --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Build
run: cargo auditable build --verbose --workspace --locked --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: target-${{ matrix.target }}
path: |
target/${{ matrix.target }}/debug/${{ env.bin-name }}
pc-windows-msvc:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
can-test: true
- target: aarch64-pc-windows-msvc
can-test: false
runs-on: windows-latest
needs: [ setup ]
steps:
- uses: actions/checkout@v3
- name: Get deps from cache
uses: actions/cache@v3
with:
path: |
.cargo-store
key: deps-cache-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Move deps
run: mv ./.cargo-store/* ~/.cargo
- uses: actions/cache@v3
with:
path: |
target
key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
- name: Update Rust
run: rustup update
- name: Rust Version
run: rustc --version
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- uses: cargo-prebuilt/cargo-prebuilt-action@v2
with:
pkgs: cargo-auditable
- name: Run tests
if: ${{ matrix.can-test }}
run: cargo test --verbose --workspace --locked --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Build
run: cargo auditable build --verbose --workspace --locked --target ${{ matrix.target }} ${{ env.feature-set }}
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: target-${{ matrix.target }}
path: |
target/${{ matrix.target }}/debug/${{ env.bin-name }}.exe