ci: use cross for FreeBSD CI workflow (#1985)

* ci: test FreeBSD + cross for CI job again

* looks like I don't need to use a VM now!
This commit is contained in:
Clement Tsang
2026-02-25 21:35:22 -05:00
committed by GitHub
parent d268f3c378
commit 0063592455
3 changed files with 30 additions and 73 deletions
-32
View File
@@ -31,38 +31,6 @@ jobs:
with:
fetch-depth: 1
- name: FreeBSD Test (Attempt 1)
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
if: ${{ inputs.os-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/ci_bsd.sh ${{ inputs.os-target }}
id: freebsd_attempt_1
continue-on-error: true
- name: FreeBSD Test (Attempt 2)
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
if: ${{ inputs.os-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/ci_bsd.sh ${{ inputs.os-target }}
id: freebsd_attempt_2
continue-on-error: true
- name: FreeBSD Test (Attempt 3)
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
if: ${{ inputs.os-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/ci_bsd.sh ${{ inputs.os-target }}
id: freebsd_attempt_3
- name: OpenBSD Test (Attempt 1)
uses: vmactions/openbsd-vm@9a8e4351a4a0dc6238e7c69276dcbf6c03bea576 # v1.3.6
if: ${{ inputs.os-target == 'x86_64-unknown-openbsd' }}
+28 -29
View File
@@ -232,6 +232,13 @@ jobs:
cross: false,
}
# FreeBSD
- {
os: "ubuntu-latest",
target: "x86_64-unknown-freebsd",
cross: true,
}
# NetBSD
- {
os: "ubuntu-latest",
@@ -285,50 +292,42 @@ jobs:
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
# Check BSD platforms using a VM layer.
check-bsd-vm:
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
strategy:
fail-fast: false
matrix:
info:
# Seems like cross's FreeBSD image is a bit broken? I get build errors,
# may be related to this issue: https://github.com/cross-rs/cross/issues/1291
# Alas, that's why we do it with VMs.
# TODO: Check if this is still the case!
- { os_release: "13.5", target: "x86_64-unknown-freebsd" }
- { os_release: "14.3", target: "x86_64-unknown-freebsd" }
- { os_release: "15.0", target: "x86_64-unknown-freebsd" }
# OpenBSD is not very well-supported, given that it's tier 3. We skip clippy and only run basic tests + fmt.
# We also use `--no-default-features` when building as starship-battery does not support OpenBSD.
# Cross also doesn't support OpenBSD, so we will do it with VMs here too.
# - { os_release: "7.8", target: "x86_64-unknown-openbsd" } # Supports Rust 1.90
uses: ./.github/workflows/bsd_vm_check.yml
with:
os-target: ${{ matrix.info.target }}
os-release: ${{ matrix.info.os_release }}
# # Check BSD platforms using a VM layer.
# check-bsd-vm:
# needs: pre-job
# if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
# strategy:
# fail-fast: false
# matrix:
# info:
# # OpenBSD is not very well-supported, given that it's tier 3. We skip clippy and only run basic tests + fmt.
# # We also use `--no-default-features` when building as starship-battery does not support OpenBSD.
# # Cross also doesn't support OpenBSD, so we will do it with VMs here too.
# - { os_release: "7.8", target: "x86_64-unknown-openbsd" } # Supports Rust 1.90
# uses: ./.github/workflows/bsd_vm_check.yml
# with:
# os-target: ${{ matrix.info.target }}
# os-release: ${{ matrix.info.os_release }}
completion:
name: "CI Pass Check"
needs: [supported, unsupported-check, check-bsd-vm]
if: ${{ needs.supported.result != 'skipped' || needs.unsupported-check.result != 'skipped' || needs.check-bsd-vm.result != 'skipped'}}
needs: [supported, unsupported-check]
if: ${{ needs.supported.result != 'skipped' || needs.unsupported-check.result != 'skipped' }}
runs-on: "ubuntu-latest"
steps:
- name: CI Passed
if: ${{ (needs.supported.result == 'success' || needs.supported.result == 'skipped') && (needs.unsupported-check.result == 'success' || needs.unsupported-check.result == 'skipped') && (needs.check-bsd-vm.result == 'success' || needs.check-bsd-vm.result == 'skipped') }}
if: ${{ (needs.supported.result == 'success' || needs.supported.result == 'skipped') && (needs.unsupported-check.result == 'success' || needs.unsupported-check.result == 'skipped') }}
run: |
echo "CI workflow completed successfully.";
- name: CI Failed
if: ${{ needs.supported.result == 'failure' || needs.unsupported-check.result == 'failure' || needs.check-bsd-vm.result == 'failure' }}
if: ${{ needs.supported.result == 'failure' || needs.unsupported-check.result == 'failure' }}
run: |
echo "CI workflow failed.";
exit 1;
- name: CI Cancelled
if: ${{ needs.supported.result == 'cancelled' || needs.unsupported-check.result == 'cancelled' || needs.check-bsd-vm.result == 'cancelled' }}
if: ${{ needs.supported.result == 'cancelled' || needs.unsupported-check.result == 'cancelled' }}
run: |
echo "CI workflow was cancelled.";
exit 1;
+2 -12
View File
@@ -11,17 +11,7 @@ if [ -z "$BSD_TARGET" ]; then
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 fmt --all -- --check
# Note this only tests the default features, but I think that's fine.
cargo test --no-fail-fast --locked -- --nocapture --quiet
cargo clippy --all-targets --workspace -- -D warnings
elif [ "$BSD_TARGET" = "x86_64-unknown-openbsd" ]; then
if [ "$BSD_TARGET" = "x86_64-unknown-openbsd" ]; then
pkg_add rust rust-rustfmt
. "$HOME/.cargo/env"
@@ -31,6 +21,6 @@ elif [ "$BSD_TARGET" = "x86_64-unknown-openbsd" ]; then
# it being tier 3 (see https://github.com/eza-community/eza/pull/1669).
cargo test --no-fail-fast --locked --no-default-features -- --nocapture --quiet
else
echo "Unsupported BSD target type."
echo "Unsupported BSD VM target type."
exit 1
fi