mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2026-11-29 08:00:36 +00:00
84 lines
2.2 KiB
YAML
84 lines
2.2 KiB
YAML
name: Test
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**/*.go"
|
|
- "go.mod"
|
|
- "go.sum"
|
|
- "nt_install.sh"
|
|
- "scripts/test_nt_install.sh"
|
|
- ".github/workflows/*.yml"
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
paths:
|
|
- "**/*.go"
|
|
- "go.mod"
|
|
- "go.sum"
|
|
- "nt_install.sh"
|
|
- "scripts/test_nt_install.sh"
|
|
- ".github/workflows/*.yml"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
steps:
|
|
- name: Checkout codebase
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
|
|
- name: Set up Go (built-in cache)
|
|
uses: actions/setup-go@v7
|
|
with:
|
|
go-version: '1.26.5'
|
|
check-latest: true
|
|
cache: true
|
|
|
|
- name: Test with unix
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
shell: bash
|
|
run: |
|
|
sudo go env -w GOTOOLCHAIN=go1.26.5+auto
|
|
sudo go test -v -covermode=count -coverprofile='coverage.out' ./...
|
|
|
|
- name: Verify q v0.19.12 adapter parity
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
shell: bash
|
|
run: |
|
|
export GOTOOLCHAIN=go1.26.5+auto
|
|
go mod download github.com/natesales/q@v0.19.12
|
|
Q_SOURCE="$(go env GOMODCACHE)/github.com/natesales/q@v0.19.12"
|
|
(cd "${Q_SOURCE}" && go build -trimpath -o "${RUNNER_TEMP}/q-v0.19.12" .)
|
|
NEXTTRACE_Q_REFERENCE_BINARY="${RUNNER_TEMP}/q-v0.19.12" \
|
|
go test ./internal/dnsclient -run '^TestPinnedQ' -count=1
|
|
|
|
- name: Smoke test nt_install.sh
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
shell: bash
|
|
run: |
|
|
bash -n nt_install.sh
|
|
sh -n nt_install.sh
|
|
bash scripts/test_nt_install.sh
|
|
|
|
- name: Test with windows
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
run: |
|
|
go env -w GOTOOLCHAIN=go1.26.5+auto
|
|
go test -v -covermode=count -coverprofile="coverage.out" ./...
|