Release-build + install/verify/re-install/uninstall cycle on Linux and macOS. Runs after lint/test passes (needs dependency). Cleanup step uses if: always() to handle cancellation.
124 lines
3.3 KiB
YAML
124 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- 'site/**'
|
|
- 'blog/**'
|
|
- 'drafts/**'
|
|
- '*.md'
|
|
- 'scripts/serve-site.sh'
|
|
- 'scripts/generate-blog-index.sh'
|
|
pull_request:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- 'site/**'
|
|
- 'blog/**'
|
|
- 'drafts/**'
|
|
- '*.md'
|
|
- 'scripts/serve-site.sh'
|
|
- 'scripts/generate-blog-index.sh'
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: fmt
|
|
run: cargo fmt --check
|
|
- name: clippy
|
|
run: cargo clippy -- -D warnings
|
|
- name: test
|
|
run: cargo test
|
|
- name: audit
|
|
run: cargo install cargo-audit && cargo audit
|
|
|
|
check-macos:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: clippy
|
|
run: cargo clippy -- -D warnings
|
|
- name: test
|
|
run: cargo test
|
|
|
|
check-windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: build
|
|
run: cargo build
|
|
- name: clippy
|
|
run: cargo clippy -- -D warnings
|
|
- name: test
|
|
run: cargo test
|
|
- name: Upload binary
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: numa-windows-x86_64
|
|
path: target/debug/numa.exe
|
|
|
|
integration-linux:
|
|
needs: [check]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: build
|
|
run: cargo build --release
|
|
- name: install / verify / re-install / uninstall
|
|
run: |
|
|
sudo ./target/release/numa install
|
|
sleep 2
|
|
curl -sf http://127.0.0.1:5380/health
|
|
dig @127.0.0.1 example.com +short +timeout=5 | grep -q '.'
|
|
sudo ./target/release/numa install
|
|
sleep 2
|
|
curl -sf http://127.0.0.1:5380/health
|
|
sudo ./target/release/numa uninstall
|
|
sleep 1
|
|
! curl -sf http://127.0.0.1:5380/health 2>/dev/null
|
|
- name: cleanup
|
|
if: always()
|
|
run: sudo ./target/release/numa uninstall 2>/dev/null || true
|
|
|
|
integration-macos:
|
|
needs: [check-macos]
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: build
|
|
run: cargo build --release
|
|
- name: install / verify / re-install / uninstall
|
|
run: |
|
|
sudo ./target/release/numa install
|
|
sleep 2
|
|
curl -sf http://127.0.0.1:5380/health
|
|
dig @127.0.0.1 example.com +short +timeout=5 | grep -q '.'
|
|
sudo ./target/release/numa install
|
|
sleep 2
|
|
curl -sf http://127.0.0.1:5380/health
|
|
sudo ./target/release/numa uninstall
|
|
sleep 1
|
|
! curl -sf http://127.0.0.1:5380/health 2>/dev/null
|
|
- name: cleanup
|
|
if: always()
|
|
run: sudo ./target/release/numa uninstall 2>/dev/null || true
|