Skip to content

fix(cache): isolate cache entries across hot reloads #268

fix(cache): isolate cache entries across hot reloads

fix(cache): isolate cache entries across hot reloads #268

Workflow file for this run

name: Build
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
release:
types: [ created ]
workflow_dispatch:
permissions:
contents: write
jobs:
build-windows:
name: Build Windows ${{ matrix.arch }} gnullvm
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnullvm
arch: x86_64
runner: windows-latest
- target: aarch64-pc-windows-gnullvm
arch: arm64
runner: windows-11-arm
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install MSYS2 x86_64 toolchain
if: matrix.arch == 'x86_64'
uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
update: true
install: >-
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-lld
mingw-w64-clang-x86_64-llvm
mingw-w64-clang-x86_64-rust
- name: Install MSYS2 aarch64 toolchain
if: matrix.arch == 'arm64'
uses: msys2/setup-msys2@v2
with:
msystem: CLANGARM64
update: true
install: >-
mingw-w64-clang-aarch64-clang
mingw-w64-clang-aarch64-lld
mingw-w64-clang-aarch64-llvm
mingw-w64-clang-aarch64-rust
- name: Build
shell: msys2 {0}
run: |
cargo build --release --target ${{ matrix.target }}
strip target/${{ matrix.target }}/release/kixdns.exe || true
- name: Package
shell: msys2 {0}
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/kixdns.exe dist/kixdns-windows-${{ matrix.arch }}.exe
- name: Upload CI artifact
uses: actions/upload-artifact@v7
with:
name: kixdns-windows-${{ matrix.arch }}.exe
path: dist/kixdns-windows-${{ matrix.arch }}.exe
retention-days: 30
- name: Upload to Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: dist/kixdns-windows-${{ matrix.arch }}.exe
build-linux:
name: Build Linux ${{ matrix.arch }} ${{ matrix.toolset }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
arch: x86_64
runner: ubuntu-24.04
toolset: gnu
- target: aarch64-unknown-linux-gnu
arch: arm64
runner: ubuntu-24.04-arm
toolset: gnu
- target: x86_64-unknown-linux-musl
arch: x86_64
runner: ubuntu-24.04
toolset: musl
- target: aarch64-unknown-linux-musl
arch: arm64
runner: ubuntu-24.04-arm
toolset: musl
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install musl toolchain
if: matrix.toolset == 'musl'
run: |
sudo apt update
sudo apt install -y musl-tools musl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: |
cargo build --release --target ${{ matrix.target }}
strip target/${{ matrix.target }}/release/kixdns || true
- name: Package
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/kixdns dist/kixdns-linux-${{ matrix.arch }}-${{ matrix.toolset }}
- name: Upload CI artifact
uses: actions/upload-artifact@v7
with:
name: kixdns-linux-${{ matrix.arch }}-${{ matrix.toolset }}
path: dist/kixdns-linux-${{ matrix.arch }}-${{ matrix.toolset }}
retention-days: 30
- name: Upload to Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: dist/kixdns-linux-${{ matrix.arch }}-${{ matrix.toolset }}
build-freebsd:
name: Build FreeBSD ${{ matrix.arch }} (cross)
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-freebsd
arch: x86_64
toolchain: stable
build_std: ""
- target: aarch64-unknown-freebsd
arch: arm64
toolchain: nightly
build_std: "-Z build-std=std,panic_abort"
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Cache Cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.toolchain }}-
- name: Cache target (per target)
uses: actions/cache@v5
with:
path: target/${{ matrix.target }}
key: ${{ runner.os }}-target-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-target-${{ matrix.target }}-
- name: Install toolchain and cross
run: |
if ! command -v cross >/dev/null 2>&1; then
cargo install cross --git https://github.com/cross-rs/cross
else
echo "cross already installed, skip install"
fi
rustup toolchain install ${{ matrix.toolchain }}
rustup component add rust-src --toolchain ${{ matrix.toolchain }}
- name: Build FreeBSD ${{ matrix.arch }}
run: |
if [ -n "${{ matrix.build_std }}" ]; then
cross +${{ matrix.toolchain }} build --target ${{ matrix.target }} ${{ matrix.build_std }} --release
else
cross +${{ matrix.toolchain }} build --target ${{ matrix.target }} --release
fi
strip target/${{ matrix.target }}/release/kixdns || true
- name: Package
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/kixdns dist/kixdns-freebsd-${{ matrix.arch }}
- name: Upload CI artifact
uses: actions/upload-artifact@v7
with:
name: kixdns-freebsd-${{ matrix.arch }}
path: dist/kixdns-freebsd-${{ matrix.arch }}
retention-days: 30
- name: Upload to Release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
files: dist/kixdns-freebsd-${{ matrix.arch }}
test-linux:
name: Test Linux (unit + DoH integration)
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run unit tests
run: cargo test --lib
- name: Run listener integration tests
run: cargo test --bin kixdns
- name: Run DoH integration tests
run: cargo test --test doh_integration
lint-linux:
name: Lint (clippy + fmt)
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Check formatting
run: cargo fmt --check
- name: Run Clippy
run: cargo clippy --all-targets --all-features --locked -- -D warnings