Skip to content

get_times

get_times #5793

Workflow file for this run

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: |
# Use latest gotestsum, Go 1.25.0 supports it
go install gotest.tools/gotestsum@latest
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 with retries for flaky test handling, and emit JUnit XML for the flaky monitor.
shell: bash
run: |
$(go env GOPATH)/bin/gotestsum \
--junitfile results.xml \
--jsonfile test-output.json \
--rerun-fails=2 \
--packages="./tavern/..." \
-- -v -race -coverprofile='coverage.out' -covermode=atomic
- 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
- name: 📤 Upload JUnit Results
if: always()
uses: actions/upload-artifact@v4
with:
name: junit-tavern-${{ matrix.os }}
path: results.xml
if-no-files-found: ignore
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: Install system dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libgbm-dev libx11-dev libssl-dev protobuf-compiler pkg-config libclang-dev libxcb1-dev libxrandr-dev libdbus-1-dev libpipewire-0.3-dev libwayland-dev libegl-dev
- 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 is configured via .config/nextest.toml: [profile.ci] has retries=2 and writes
# JUnit to target/nextest/ci/junit.xml. The stdlib/tests crate is a separate Cargo
# project that does not inherit implants/.config/, so we pass --config-file explicitly.
shell: bash
run: |
NEXTEST_CONFIG="$GITHUB_WORKSPACE/implants/.config/nextest.toml"
cd ./implants/
cargo fmt --check
cargo llvm-cov nextest --profile ci --lcov --output-path lcov.info
cd ./lib/eldritch/stdlib/tests
cargo llvm-cov nextest --config-file "$NEXTEST_CONFIG" --profile ci --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/
# Rename every junit.xml produced by nextest so we can upload them all as artifacts
# and so the CTRF converter has a stable, unique input file name.
idx=0
while IFS= read -r JUNIT_PATH; do
[ -z "$JUNIT_PATH" ] && continue
if [ $idx -eq 0 ]; then
DEST="junit-implants-${{ matrix.os }}.xml"
else
DEST="junit-implants-${{ matrix.os }}-${idx}.xml"
fi
mv "$JUNIT_PATH" "$DEST"
idx=$((idx + 1))
done < <(find . -name junit.xml)
if [ $idx -eq 0 ]; then
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,./implants/lib/eldritch/stdlib/tests/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
- name: 📤 Upload JUnit Results
if: always()
uses: actions/upload-artifact@v4
with:
name: junit-implants-${{ matrix.os }}
path: implants/junit-implants-${{ matrix.os }}*.xml
if-no-files-found: ignore
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
- name: 📤 Upload JUnit Results
if: always()
uses: actions/upload-artifact@v4
with:
name: junit-ui-${{ matrix.os }}
path: tavern/internal/www/junit-ui-${{ matrix.os }}.xml
if-no-files-found: ignore