Remove flakey random tests #3715
This file contains hidden or 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: Tests | |
| on: | |
| workflow_dispatch: ~ | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| merge_group: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| tavern: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: ⚡ Setup Golang | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: 🔨 Install Tools | |
| run: | | |
| # Pin gotestsum to v1.12.0 to support Go 1.23.4 (v1.13.0 requires Go 1.24) | |
| go install gotest.tools/[email protected] | |
| go install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest | |
| - name: 🔨 Build | |
| run: go build -v -o ./build/tavern ./tavern | |
| - name: 🔎 Test | |
| # Use gotestsum for human-readable output to stdout, and capture JSON to file for reporting | |
| shell: bash | |
| run: | | |
| $(go env GOPATH)/bin/gotestsum --jsonfile test-output.json -- \ | |
| -v -race -coverprofile='coverage.out' -covermode=atomic ./tavern/... | |
| - name: 🔄 Convert to CTRF | |
| if: always() # Run even if tests fail so we report the failures | |
| shell: bash | |
| run: | | |
| if [ -f test-output.json ]; then | |
| cat test-output.json | $(go env GOPATH)/bin/go-ctrf-json-reporter -o ctrf-tavern-${{ matrix.os }}.json | |
| # Normalize timestamps to avoid 50+ year durations when merging with reports lacking timestamps | |
| jq '.results.summary.stop = (.results.summary.stop - .results.summary.start) | .results.summary.start = 0' ctrf-tavern-${{ matrix.os }}.json > ctrf-tavern-${{ matrix.os }}.json.tmp && mv ctrf-tavern-${{ matrix.os }}.json.tmp ctrf-tavern-${{ matrix.os }}.json | |
| else | |
| echo "test-output.json not found, skipping CTRF conversion" | |
| fi | |
| - name: 📶 Upload Coverage Results | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.out | |
| flags: tavern | |
| name: tavern-coverage | |
| - name: 📤 Upload CTRF Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ctrf-tavern-${{ matrix.os }} | |
| path: ctrf-tavern-${{ matrix.os }}.json | |
| implants: | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 60 | |
| env: | |
| IMIX_SERVER_PUBKEY: "pR56vDJZb9b3BL3ZvCXIvgK0r2vCk7FiZ1RjeEhJVyU=" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macOS-latest | |
| - windows-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - if: matrix.os == 'windows-latest' | |
| run: start-process -filepath powershell -ArgumentList '/c','Set-MpPreference -DisableRealtimeMonitoring $true' -verb RunAs | |
| name: 👾 Disable defender | |
| shell: powershell | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: '1.91.1' | |
| default: true | |
| profile: minimal | |
| components: rustfmt, clippy | |
| - name: Setup Rust (Loader) | |
| uses: dtolnay/rust-toolchain@master | |
| if: matrix.os == 'windows-latest' | |
| with: | |
| toolchain: 'nightly-2025-11-27' | |
| default: false | |
| profile: minimal | |
| components: rust-src, rustfmt | |
| - name: rust-cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "./implants/ -> ../target" | |
| - if: matrix.os == 'windows-latest' | |
| shell: powershell | |
| name: Build reflective loader | |
| run: | | |
| cd ./bin/reflective_loader/ | |
| cargo +nightly-2025-11-27 build --release -Z build-std=core,compiler_builtins -Z build-std-features=compiler-builtins-mem | |
| - name: Install latest nextest & cargo-llvm-cov release | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest,cargo-llvm-cov | |
| - name: 🔎 Run tests | |
| # nextest configured via nextest.toml to output junit.xml | |
| run: | | |
| cd ./implants/ && | |
| cargo fmt --check && | |
| cargo llvm-cov nextest --lcov --output-path lcov.info | |
| - name: 🔄 Convert to CTRF | |
| if: always() | |
| shell: bash # Explicitly use bash to support standard shell syntax on Windows | |
| run: | | |
| cd ./implants/ | |
| # Move junit report if it exists | |
| JUNIT_PATH=$(find . -name junit.xml | head -n 1) | |
| if [ -n "$JUNIT_PATH" ]; then | |
| mv "$JUNIT_PATH" junit-implants-${{ matrix.os }}.xml | |
| else | |
| echo "No JUnit report generated" | |
| fi | |
| if [ -f junit-implants-${{ matrix.os }}.xml ]; then | |
| npx junit-to-ctrf junit-implants-${{ matrix.os }}.xml -o ctrf-implants-${{ matrix.os }}.json | |
| fi | |
| - name: 📶 Upload Coverage Results | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./implants/lcov.info | |
| flags: implants | |
| name: implants-coverage-${{ matrix.os }} | |
| - name: 📤 Upload CTRF Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ctrf-implants-${{ matrix.os }} | |
| path: implants/ctrf-implants-${{ matrix.os }}.json | |
| ui-tests: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: tavern/internal/www | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: ⚡ Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: tavern/internal/www/package-lock.json | |
| - name: 📦 Install dependencies | |
| run: npm ci | |
| - name: 🔎 Run vitest with coverage | |
| # Generate JUnit XML | |
| run: npm test -- --run --coverage --reporter=junit --output-file=junit-ui-${{ matrix.os }}.xml | |
| - name: 🔄 Convert to CTRF | |
| if: always() | |
| run: npx junit-to-ctrf junit-ui-${{ matrix.os }}.xml -o ctrf-ui-${{ matrix.os }}.json | |
| - name: 📶 Upload Coverage Results | |
| if: always() | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./tavern/internal/www/coverage/lcov.info | |
| flags: ui-tests | |
| name: ui-tests-coverage | |
| - name: 📤 Upload CTRF Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ctrf-ui-${{ matrix.os }} | |
| path: tavern/internal/www/ctrf-ui-${{ matrix.os }}.json |