remove no-hash; cargo update #399
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: | |
release: | |
types: [released] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: sudo apt-get update -y && sudo apt-get install -y knot-dnsutils | |
- uses: dtolnay/rust-toolchain@stable | |
id: "rust-toolchain" | |
- name: install cargo-all-features | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cargo-all-features | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}" | |
- run: cargo test-all-features --locked -- --include-ignored | |
env: | |
RUST_BACKTRACE: 1 | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- run: cargo fmt --all -- --check | |
benchmark: | |
name: bench | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust Bench ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}" | |
- name: Run benchmark | |
run: cargo +nightly bench | |
cargo_publish: | |
if: ${{ github.event_name == 'release' }} | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: msrd0/cargo-publish-action@v1 | |
with: | |
packages: crab-hole | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
cross_build: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [i686-unknown-linux-musl, x86_64-unknown-linux-musl, arm-unknown-linux-musleabihf, armv7-unknown-linux-musleabihf, aarch64-unknown-linux-musl, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-gnu] | |
roots: [native-roots, webpki-roots] | |
name: ${{ matrix.target }}--${{ matrix.roots }} | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
id: "rust-toolchain" | |
- name: install cross | |
uses: baptiste0928/cargo-install@v2 | |
with: | |
crate: cross | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Target ${{ matrix.target }} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}" | |
- run: cross build --release --locked --no-default-features --features ${{ matrix.roots }} --target ${{ matrix.target }} | |
env: | |
RUST_BACKTRACE: 1 | |
- run: tree | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "${{ matrix.target }}--${{ matrix.roots }}" | |
path: | | |
target/${{ matrix.target }}/release/crab-hole | |
target/${{ matrix.target }}/release/crab-hole.exe | |
build_x86_64-apple-darwin: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
roots: [native-roots, webpki-roots] | |
name: x86_64-apple-darwin--${{ matrix.roots }} | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
id: "rust-toolchain" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/git | |
~/.cargo/registry | |
target | |
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}} Lock ${{hashFiles('Cargo.lock')}}" | |
- run: cargo build --release --all-features | |
env: | |
RUST_BACKTRACE: 1 | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "x86_64-apple-darwin--${{ matrix.roots }}" | |
path: target/release/crab-hole | |
docker: | |
runs-on: ubuntu-latest | |
needs: [cross_build] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: github_artifacts | |
- name: docker | |
uses: LuckyTurtleDev/easy-docker-action@main | |
with: | |
ghcr_password: ${{ secrets.GITHUB_TOKEN }} | |
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 | |
max_parallelism: 1 | |
github_publish: | |
runs-on: ubuntu-latest | |
needs: [cross_build] | |
if: ${{ github.event_name == 'release' }} | |
steps: | |
- name: Checkout repository #needed to get github.event.release.tag_name | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: github_artifacts | |
- name: Upload Release Artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_NAME: ${{ github.event.release.tag_name }} | |
run: | | |
for dir in github_artifacts/*; do | |
dir=${dir#github_artifacts/} | |
cd github_artifacts | |
zip -r ${dir}.zip ${dir} | |
gh release upload ${RELEASE_NAME} ${dir}.zip | |
rm ${dir}.zip | |
cd .. | |
done |