mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-05-03 21:40:32 +00:00
ci: fix *BSD tests (#1993)
* ci: fix CI tests for FreeBSD * add netbsd * netbsd skips data collection for now * comments * wrong script
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
name: Test BSD Target
|
||||
description: Run tests for a BSD target using VMs, with retries on failure. Needed as cross doesn't support them (https://github.com/cross-rs/cross/wiki/FAQ#running-bsd-tests).
|
||||
|
||||
inputs:
|
||||
target:
|
||||
description: "Rust target triple (e.g., x86_64-unknown-freebsd)"
|
||||
required: true
|
||||
os-release:
|
||||
description: "OS release version (e.g., 13.2 for FreeBSD)"
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: FreeBSD Test (Attempt 1)
|
||||
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
|
||||
if: ${{ inputs.target == 'x86_64-unknown-freebsd' }}
|
||||
with:
|
||||
release: "${{ inputs.os-release }}"
|
||||
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
|
||||
usesh: true
|
||||
run: sh ./scripts/ci/bsd_tests.sh ${{ inputs.target }}
|
||||
id: freebsd_attempt_1
|
||||
continue-on-error: true
|
||||
|
||||
- name: FreeBSD Test (Attempt 2)
|
||||
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
|
||||
if: ${{ inputs.target == 'x86_64-unknown-freebsd' && steps.freebsd_attempt_1.outcome == 'failure' }}
|
||||
with:
|
||||
release: "${{ inputs.os-release }}"
|
||||
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
|
||||
usesh: true
|
||||
run: sh ./scripts/ci/bsd_tests.sh ${{ inputs.target }}
|
||||
id: freebsd_attempt_2
|
||||
continue-on-error: true
|
||||
|
||||
- name: FreeBSD Test (Attempt 3)
|
||||
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
|
||||
if: ${{ inputs.target == 'x86_64-unknown-freebsd' && steps.freebsd_attempt_2.outcome == 'failure' }}
|
||||
with:
|
||||
release: "${{ inputs.os-release }}"
|
||||
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
|
||||
usesh: true
|
||||
run: sh ./scripts/ci/bsd_tests.sh ${{ inputs.target }}
|
||||
id: freebsd_attempt_3
|
||||
|
||||
- name: NetBSD Test (Attempt 1)
|
||||
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
|
||||
if: ${{ inputs.target == 'x86_64-unknown-netbsd' }}
|
||||
with:
|
||||
release: "${{ inputs.os-release }}"
|
||||
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
|
||||
usesh: true
|
||||
run: sh ./scripts/ci/bsd_tests.sh ${{ inputs.target }}
|
||||
id: netbsd_attempt_1
|
||||
continue-on-error: true
|
||||
|
||||
- name: NetBSD Test (Attempt 2)
|
||||
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
|
||||
if: ${{ inputs.target == 'x86_64-unknown-netbsd' && steps.netbsd_attempt_1.outcome == 'failure' }}
|
||||
with:
|
||||
release: "${{ inputs.os-release }}"
|
||||
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
|
||||
usesh: true
|
||||
run: sh ./scripts/ci/bsd_tests.sh ${{ inputs.target }}
|
||||
id: netbsd_attempt_2
|
||||
continue-on-error: true
|
||||
|
||||
- name: NetBSD Test (Attempt 3)
|
||||
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
|
||||
if: ${{ inputs.target == 'x86_64-unknown-netbsd' && steps.netbsd_attempt_2.outcome == 'failure' }}
|
||||
with:
|
||||
release: "${{ inputs.os-release }}"
|
||||
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
|
||||
usesh: true
|
||||
run: sh ./scripts/ci/bsd_tests.sh ${{ inputs.target }}
|
||||
id: netbsd_attempt_3
|
||||
@@ -256,13 +256,12 @@ jobs:
|
||||
}
|
||||
|
||||
# FreeBSD
|
||||
# TODO: Fix tests, see https://github.com/cross-rs/cross/wiki/FAQ#running-bsd-tests - tests don't work! May need
|
||||
# to do the VM thing again.
|
||||
- {
|
||||
os: "ubuntu-24.04",
|
||||
target: "x86_64-unknown-freebsd",
|
||||
cross: true,
|
||||
checks: ["format", "clippy"],
|
||||
os-release: "13.2",
|
||||
checks: ["format", "clippy", "test"],
|
||||
}
|
||||
|
||||
# NetBSD
|
||||
@@ -270,7 +269,8 @@ jobs:
|
||||
os: "ubuntu-24.04",
|
||||
target: "x86_64-unknown-netbsd",
|
||||
cross: true,
|
||||
checks: ["clippy"],
|
||||
os-release: "9.3",
|
||||
checks: ["clippy", "test"],
|
||||
}
|
||||
runs-on: ${{ matrix.info.os }}
|
||||
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
|
||||
@@ -306,7 +306,7 @@ jobs:
|
||||
|
||||
- name: Run tests
|
||||
uses: ClementTsang/cargo-action@2438cc5f3ba4e971289fffca2a00dedea6911f14 # v0.0.7
|
||||
if: ${{ contains(matrix.info.checks, 'test') }}
|
||||
if: ${{ contains(matrix.info.checks, 'test') && !contains(matrix.info.target, 'bsd') }}
|
||||
with:
|
||||
command: test
|
||||
args: --no-fail-fast --locked --target=${{ matrix.info.target }} -- --nocapture --quiet
|
||||
@@ -315,6 +315,14 @@ jobs:
|
||||
env:
|
||||
RUST_BACKTRACE: full
|
||||
|
||||
# *BSD targets run tests in a VM due to cross limitations.
|
||||
- name: Run tests (BSD)
|
||||
if: ${{ contains(matrix.info.checks, 'test') && contains(matrix.info.target, 'bsd') }}
|
||||
uses: ./.github/actions/test-bsd-target
|
||||
with:
|
||||
target: ${{ matrix.info.target }}
|
||||
os-release: ${{ matrix.info.os-release }}
|
||||
|
||||
- name: Set up clippy configuration
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Script to be run by the `ci.yml` workflow for -BSD jobs based on the target.
|
||||
|
||||
set -eu
|
||||
|
||||
BSD_TARGET="${1:-}"
|
||||
|
||||
if [ -z "$BSD_TARGET" ]; then
|
||||
echo "Error: BSD target must be specified."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$BSD_TARGET" = "x86_64-unknown-freebsd" ]; then
|
||||
pkg install -y curl bash
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
|
||||
sh rustup.sh --default-toolchain stable -y
|
||||
|
||||
. "$HOME/.cargo/env"
|
||||
cargo test --no-fail-fast --locked -- --nocapture --quiet
|
||||
elif [ "$BSD_TARGET" = "x86_64-unknown-netbsd" ]; then
|
||||
/usr/sbin/pkg_add -u curl bash mozilla-rootcerts-openssl
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
|
||||
sh rustup.sh --default-toolchain stable -y
|
||||
|
||||
. "$HOME/.cargo/env"
|
||||
# TODO: Support default features eventually?
|
||||
cargo test --no-fail-fast --locked --no-default-features -- --nocapture --quiet --skip test_data_collection
|
||||
else
|
||||
echo "Unsupported BSD target type."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user