mirror of
https://github.com/sliverarmory/reflektor
synced 2026-08-25 09:14:48 +00:00
237 lines
8.3 KiB
YAML
237 lines
8.3 KiB
YAML
name: Test Matrix
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
darwin:
|
|
name: darwin-${{ matrix.goarch }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runner: macos-15-intel
|
|
goarch: amd64
|
|
rust_target: x86_64-apple-darwin
|
|
- runner: macos-15
|
|
goarch: arm64
|
|
rust_target: aarch64-apple-darwin
|
|
runs-on: ${{ matrix.runner }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
GOARCH: ${{ matrix.goarch }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
- uses: dtolnay/rust-toolchain@1.94.0
|
|
with:
|
|
targets: ${{ matrix.rust_target }}
|
|
- uses: mlugg/setup-zig@v2
|
|
with:
|
|
version: 0.14.0
|
|
- name: Run Darwin C, Go, and Rust fixture tests
|
|
run: |
|
|
set -euo pipefail
|
|
go test ./... -skip '^TestBuild(CSharedLibraryMatrix|RecursiveCSharedLibraryMatrix)$' -count=1 -v | tee darwin-test.log
|
|
memmod_test="TestLoadLibraryAndCallExport_DarwinArm64"
|
|
if [[ "${GOARCH}" == "amd64" ]]; then
|
|
memmod_test="TestLoadLibraryAndCallExport_DarwinAMD64"
|
|
fi
|
|
for test_name in \
|
|
TestLoadGeneratedCDylibAndCallStartW \
|
|
TestLoadGeneratedGoDylibAndCallStartW \
|
|
TestLoadGeneratedRustHTTPSharedLibrary \
|
|
TestLoadGeneratedCSharedLibraryRecursiveMode \
|
|
TestLoadGeneratedGoSharedLibraryRecursiveMode \
|
|
TestLoadGeneratedRustSharedLibraryRecursiveMode \
|
|
TestLoadLibraryRecursiveDependencies \
|
|
"${memmod_test}"; do
|
|
if ! grep -Fq -- "--- PASS: ${test_name} " darwin-test.log; then
|
|
echo "Required Darwin test did not pass: ${test_name}"
|
|
exit 1
|
|
fi
|
|
done
|
|
unexpected_skips="$(grep -E '^--- SKIP:' darwin-test.log | grep -Ev 'TestBuild(CSharedLibraryMatrix|RecursiveCSharedLibraryMatrix)' || true)"
|
|
if [[ -n "${unexpected_skips}" ]]; then
|
|
echo "Darwin tests were skipped; refusing to pass CI."
|
|
echo "${unexpected_skips}"
|
|
exit 1
|
|
fi
|
|
if grep -Fq 'skipping on GitHub Actions runner' darwin-test.log; then
|
|
echo "Found a CI skip guard in Darwin loader tests; refusing to pass CI."
|
|
exit 1
|
|
fi
|
|
|
|
linux-native:
|
|
name: linux-${{ matrix.goarch }}-native
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runner: ubuntu-24.04
|
|
goarch: amd64
|
|
rust_target: x86_64-unknown-linux-gnu
|
|
- runner: ubuntu-24.04-arm
|
|
goarch: arm64
|
|
rust_target: aarch64-unknown-linux-gnu
|
|
runs-on: ${{ matrix.runner }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
GOARCH: ${{ matrix.goarch }}
|
|
CGO_ENABLED: "1"
|
|
CC: zig cc
|
|
CXX: zig c++
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
- uses: dtolnay/rust-toolchain@1.94.0
|
|
with:
|
|
targets: ${{ matrix.rust_target }}
|
|
- uses: mlugg/setup-zig@v2
|
|
with:
|
|
version: 0.14.0
|
|
- name: Install libcurl development files
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends libcurl4-openssl-dev
|
|
- name: Run Linux C, Go, and Rust fixture tests
|
|
run: |
|
|
set -euo pipefail
|
|
go test ./... -skip '^TestBuild(CSharedLibraryMatrix|RecursiveCSharedLibraryMatrix)$' -count=1 -v | tee linux-test.log
|
|
for test_name in \
|
|
TestLoadGeneratedCLinuxSOAndCallStartW \
|
|
TestLoadGeneratedGoLinuxSOAndCallStartW \
|
|
TestLoadGeneratedRustHTTPSharedLibrary \
|
|
TestLoadGeneratedCSharedLibraryRecursiveMode \
|
|
TestLoadGeneratedGoSharedLibraryRecursiveMode \
|
|
TestLoadGeneratedRustSharedLibraryRecursiveMode \
|
|
TestLoadLibraryRecursiveDependencies \
|
|
TestLoadLibraryAndCallExport_Linux; do
|
|
if ! grep -Fq -- "--- PASS: ${test_name} " linux-test.log; then
|
|
echo "Required Linux test did not pass: ${test_name}"
|
|
exit 1
|
|
fi
|
|
done
|
|
unexpected_skips="$(grep -E '^--- SKIP:' linux-test.log | grep -Ev 'TestBuild(CSharedLibraryMatrix|RecursiveCSharedLibraryMatrix)' || true)"
|
|
if [[ -n "${unexpected_skips}" ]]; then
|
|
echo "Linux tests were skipped; refusing to pass CI."
|
|
echo "${unexpected_skips}"
|
|
exit 1
|
|
fi
|
|
|
|
linux-386:
|
|
name: linux-386-docker
|
|
runs-on: ubuntu-24.04
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-qemu-action@v3
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Run linux/386 C, Go, and Rust fixture tests in Docker
|
|
run: |
|
|
docker build --platform linux/386 -f testdata/docker/linux-memmod.Dockerfile -t reflektor-linux-386-ci .
|
|
docker run --rm --platform linux/386 reflektor-linux-386-ci
|
|
|
|
windows:
|
|
name: windows-${{ matrix.goarch }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runner: windows-2022
|
|
goarch: amd64
|
|
rust_target: x86_64-pc-windows-msvc
|
|
- runner: windows-2022
|
|
goarch: 386
|
|
rust_target: i686-pc-windows-msvc
|
|
- runner: windows-11-arm
|
|
goarch: arm64
|
|
rust_target: aarch64-pc-windows-msvc
|
|
runs-on: ${{ matrix.runner }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
GOARCH: ${{ matrix.goarch }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
- uses: dtolnay/rust-toolchain@1.94.0
|
|
with:
|
|
targets: ${{ matrix.rust_target }}
|
|
- uses: mlugg/setup-zig@v2
|
|
with:
|
|
version: 0.14.0
|
|
- name: Run Windows C, Go, and Rust fixture tests
|
|
run: |
|
|
set -euo pipefail
|
|
go test ./... -skip '^TestBuild(CSharedLibraryMatrix|RecursiveCSharedLibraryMatrix)$' -count=1 -v | tee windows-test.log
|
|
for test_name in \
|
|
TestLoadGeneratedCWindowsDLLAndCallStartW \
|
|
TestLoadGeneratedGoWindowsDLLAndCallStartW \
|
|
TestLoadGeneratedRustHTTPSharedLibrary \
|
|
TestLoadGeneratedCSharedLibraryRecursiveMode \
|
|
TestLoadGeneratedGoSharedLibraryRecursiveMode \
|
|
TestLoadGeneratedRustSharedLibraryRecursiveMode \
|
|
TestLoadLibraryRecursiveDependencies; do
|
|
if ! grep -Fq -- "--- PASS: ${test_name} " windows-test.log; then
|
|
echo "Required Windows test did not pass: ${test_name}"
|
|
exit 1
|
|
fi
|
|
done
|
|
unexpected_skips="$(grep -E '^--- SKIP:' windows-test.log | grep -Ev 'TestBuild(CSharedLibraryMatrix|RecursiveCSharedLibraryMatrix)' || true)"
|
|
if [[ -n "${unexpected_skips}" ]]; then
|
|
echo "Windows tests were skipped; refusing to pass CI."
|
|
echo "${unexpected_skips}"
|
|
exit 1
|
|
fi
|
|
|
|
fixture-build-matrix:
|
|
name: fixture-build-matrix
|
|
# Apple's nm understands the Mach-O rows while the Xcode objdump also
|
|
# handles the ELF and PE artifacts produced by Zig.
|
|
runs-on: macos-15
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
- uses: mlugg/setup-zig@v2
|
|
with:
|
|
version: 0.14.0
|
|
- name: Validate the complete C fixture build matrix
|
|
run: |
|
|
set -euo pipefail
|
|
go test . -run '^TestBuild(CSharedLibraryMatrix|RecursiveCSharedLibraryMatrix)$' -count=1 -v | tee fixture-build-test.log
|
|
if ! grep -Fq -- '--- PASS: TestBuildCSharedLibraryMatrix ' fixture-build-test.log; then
|
|
echo "The complete C fixture build matrix did not pass."
|
|
exit 1
|
|
fi
|
|
if ! grep -Fq -- '--- PASS: TestBuildRecursiveCSharedLibraryMatrix ' fixture-build-test.log; then
|
|
echo "The complete recursive C fixture build matrix did not pass."
|
|
exit 1
|
|
fi
|