Skip to content

Commit

Permalink
Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
harmless-tech committed Aug 26, 2023
1 parent 9c8eabf commit 0a12d91
Show file tree
Hide file tree
Showing 12 changed files with 1,918 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: cargo
directory: /
schedule:
interval: daily
293 changes: 293 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
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: mips64-unknown-linux-gnuabi64
can-test: true
- target: mips64-unknown-linux-muslabi64
can-test: true
- target: mips64el-unknown-linux-gnuabi64
can-test: true
- target: mips64el-unknown-linux-muslabi64
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: Run cargo-prebuilt
if: ${{ contains(matrix.target, 'x86_64-unknown-linux-') }}
run: |
target/${{ matrix.target }}/debug/${{ env.bin-name }} just
just --version
target/${{ matrix.target }}/debug/${{ env.bin-name }} --color just
- 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: Run cargo-prebuilt
if: ${{ matrix.can-test }}
run: |
target/${{ matrix.target }}/debug/${{ env.bin-name }} just
just --version
target/${{ matrix.target }}/debug/${{ env.bin-name }} --color just
- 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: Run cargo-prebuilt
if: ${{ matrix.can-test }}
run: |
target/${{ matrix.target }}/debug/${{ env.bin-name }}.exe just
just --version
- name: Artifact
uses: actions/upload-artifact@v3
with:
name: target-${{ matrix.target }}
path: |
target/${{ matrix.target }}/debug/${{ env.bin-name }}.exe
Loading

0 comments on commit 0a12d91

Please sign in to comment.