ci: simplify BSD jobs, move NetBSD CI to use cross (#1983)

* ci: combine all bsd vm jobs

* can't do conditional 'uses'

* remove need

* fix stuff

* rename

* also test netbsd using cross

* looks like netbsd is fine with cross
This commit is contained in:
Clement Tsang
2026-02-24 04:30:38 -05:00
committed by GitHub
parent 8811e5fbe1
commit d268f3c378
3 changed files with 162 additions and 246 deletions
+100
View File
@@ -0,0 +1,100 @@
# Run BSD VM jobs with manually-implemented retries.
name: "BSD VM Check"
on:
workflow_call:
inputs:
os-target:
type: string
description: "BSD target (x86_64-unknown-freebsd, x86_64-unknown-netbsd, or x86_64-unknown-openbsd)"
required: true
os-release:
type: string
description: "Release version"
required: true
# Duplicated because GHA doesn't support passing env vars through without making them all inputs or something.
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
jobs:
bsd-vm-test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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' }}
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: openbsd_attempt_1
continue-on-error: true
- name: OpenBSD Test (Attempt 2)
uses: vmactions/openbsd-vm@9a8e4351a4a0dc6238e7c69276dcbf6c03bea576 # v1.3.6
if: ${{ inputs.os-target == 'x86_64-unknown-openbsd' && steps.openbsd_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: openbsd_attempt_2
continue-on-error: true
- name: OpenBSD Test (Attempt 3)
uses: vmactions/openbsd-vm@9a8e4351a4a0dc6238e7c69276dcbf6c03bea576 # v1.3.6
if: ${{ inputs.os-target == 'x86_64-unknown-openbsd' && steps.openbsd_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: openbsd_attempt_3
- name: Check result
if: ${{ failure() }}
run: exit 1
+26 -246
View File
@@ -224,12 +224,20 @@ jobs:
no-clippy: true,
}
# Windows ARM, may promote to official.
# Windows ARM.
# TODO: Promote to official?
- {
os: "windows-11-arm",
target: "aarch64-pc-windows-msvc",
cross: false,
}
# NetBSD
- {
os: "ubuntu-latest",
target: "x86_64-unknown-netbsd",
cross: true,
}
runs-on: ${{ matrix.info.os }}
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
timeout-minutes: 12
@@ -258,6 +266,7 @@ jobs:
key: ${{ matrix.info.target }}
cache-all-crates: true
# TODO: Make this deny warnings
- name: Clippy (default features)
uses: ClementTsang/cargo-action@2438cc5f3ba4e971289fffca2a00dedea6911f14 # v0.0.7
if: ${{ matrix.info.no-default-features != true }}
@@ -276,279 +285,50 @@ jobs:
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
check-freebsd:
# Check BSD platforms using a VM layer.
check-bsd-vm:
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
runs-on: "ubuntu-latest"
timeout-minutes: 20
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" }
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 1
- name: Enable Rust cache
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork
with:
key: ${{ matrix.info.target }}-${{ matrix.info.os_release }}
cache-all-crates: true
# The VM jobs randomly fail, and since GHA clearly never fails and doesn't know how to retry, we retry manually.
- name: FreeBSD Tests + Clippy (Attempt 1)
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
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
run: |
. "$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
id: upload_attempt_1
continue-on-error: true
- name: FreeBSD Tests + Clippy (Attempt 2)
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
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
run: |
. "$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
if: steps.upload_attempt_1.outcome == 'failure'
id: upload_attempt_2
continue-on-error: true
- name: FreeBSD Tests + Clippy (Attempt 3)
uses: vmactions/freebsd-vm@c9f815bc7aa0d34c9fdd0619b034a32d6ca7b57e # v1.4.2
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
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
run: |
. "$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
if: steps.upload_attempt_2.outcome == 'failure'
id: upload_attempt_3
check-netbsd:
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
runs-on: "ubuntu-latest"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
info:
- { os_release: "9.4", target: "x86_64-unknown-netbsd" }
- { os_release: "10.1", target: "x86_64-unknown-netbsd" }
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 1
- name: Enable Rust cache
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork
with:
key: ${{ matrix.info.target }}-${{ matrix.info.os_release }}
cache-all-crates: true
# The VM jobs randomly fail, and since GHA clearly never fails and doesn't know how to retry, we retry manually.
- name: NetBSD Tests + Clippy (Attempt 1)
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
/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
run: |
. "$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 --skip test_data_collection
# Temporarily skip clippy on NetBSD as the build is broken.
# cargo clippy --all-targets --workspace -- -D warnings
id: upload_attempt_1
continue-on-error: true
- name: NetBSD Tests + Clippy (Attempt 2)
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
/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
run: |
. "$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 --skip test_data_collection
# Temporarily skip clippy on NetBSD as the build is broken.
# cargo clippy --all-targets --workspace -- -D warnings
if: steps.upload_attempt_1.outcome == 'failure'
id: upload_attempt_2
continue-on-error: true
- name: NetBSD Tests + Clippy (Attempt 3)
uses: vmactions/netbsd-vm@e04aec09540429f9cebb0e7941f7cd0c0fc3b44f # v1.3.6
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
/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
run: |
. "$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 --skip test_data_collection
# Temporarily skip clippy on NetBSD as the build is broken.
# cargo clippy --all-targets --workspace -- -D warnings
if: steps.upload_attempt_2.outcome == 'failure'
id: upload_attempt_3
# # 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.
# unsupported-check-openbsd:
# needs: pre-job
# if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
# runs-on: "ubuntu-latest"
# timeout-minutes: 20
# strategy:
# fail-fast: false
# matrix:
# info:
# # Cross doesn't support OpenBSD, so we do it with VMs here too.
# - { os_release: "7.8", target: "x86_64-unknown-openbsd" } # Supports Rust 1.90
# steps:
# - name: Checkout repository
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# with:
# fetch-depth: 1
# - name: Enable Rust cache
# uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
# if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork
# with:
# key: ${{ matrix.info.target }}-${{ matrix.info.os_release }}
# cache-all-crates: true
# # The VM jobs randomly fail, and since GHA clearly never fails and doesn't know how to retry, we retry manually.
# - name: OpenBSD Tests + Clippy (Attempt 1)
# uses: vmactions/openbsd-vm@9a8e4351a4a0dc6238e7c69276dcbf6c03bea576 # v1.3.6
# with:
# release: "${{ matrix.info.os_release }}"
# envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
# usesh: true
# prepare: |
# pkg_add rust rust-rustfmt
# run: |
# cargo fmt --all -- --check
# # Note this only tests the default features, but I think that's fine.
# # We also do not run clippy because OpenBSD tends to lag behind due to
# # it being tier 3 (see https://github.com/eza-community/eza/pull/1669).
# cargo test --no-fail-fast --locked --no-default-features -- --nocapture --quiet
# id: upload_attempt_1
# continue-on-error: true
# - name: OpenBSD Tests + Clippy (Attempt 2)
# uses: vmactions/openbsd-vm@9a8e4351a4a0dc6238e7c69276dcbf6c03bea576 # v1.3.6
# with:
# release: "${{ matrix.info.os_release }}"
# envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
# usesh: true
# prepare: |
# pkg_add rust rust-rustfmt
# run: |
# cargo fmt --all -- --check
# # Note this only tests the default features, but I think that's fine.
# # We also do not run clippy because OpenBSD tends to lag behind due to
# # it being tier 3 (see https://github.com/eza-community/eza/pull/1669).
# cargo test --no-fail-fast --locked --no-default-features -- --nocapture --quiet
# if: steps.upload_attempt_1.outcome == 'failure'
# id: upload_attempt_2
# continue-on-error: true
# - name: OpenBSD Tests + Clippy (Attempt 3)
# uses: vmactions/openbsd-vm@9a8e4351a4a0dc6238e7c69276dcbf6c03bea576 # v1.3.6
# with:
# release: "${{ matrix.info.os_release }}"
# envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
# usesh: true
# prepare: |
# pkg_add rust rust-rustfmt
# run: |
# cargo fmt --all -- --check
# # Note this only tests the default features, but I think that's fine.
# # We also do not run clippy because OpenBSD tends to lag behind due to
# # it being tier 3 (see https://github.com/eza-community/eza/pull/1669).
# cargo test --no-fail-fast --locked --no-default-features -- --nocapture --quiet
# if: steps.upload_attempt_2.outcome == 'failure'
# id: upload_attempt_3
# 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"
# TODO: Probably unify the VM jobs so I don't have this giant mess... can probably just move all the conditional commands to a script or something.
needs: [supported, unsupported-check, check-freebsd, check-netbsd]
if: ${{ needs.supported.result != 'skipped' || needs.unsupported-check.result != 'skipped' || needs.check-freebsd.result != 'skipped' || needs.check-netbsd.result != 'skipped' }}
needs: [supported, unsupported-check, check-bsd-vm]
if: ${{ needs.supported.result != 'skipped' || needs.unsupported-check.result != 'skipped' || needs.check-bsd-vm.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-freebsd.result == 'success' || needs.check-freebsd.result == 'skipped') && (needs.check-netbsd.result == 'success' || needs.check-netbsd.result == 'skipped') }}
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') }}
run: |
echo "CI workflow completed successfully.";
- name: CI Failed
if: ${{ needs.supported.result == 'failure' || needs.unsupported-check.result == 'failure' || needs.check-freebsd.result == 'failure' || needs.check-netbsd.result == 'failure' }}
if: ${{ needs.supported.result == 'failure' || needs.unsupported-check.result == 'failure' || needs.check-bsd-vm.result == 'failure' }}
run: |
echo "CI workflow failed.";
exit 1;
- name: CI Cancelled
if: ${{ needs.supported.result == 'cancelled' || needs.unsupported-check.result == 'cancelled' || needs.check-freebsd.result == 'cancelled' || needs.check-netbsd.result == 'cancelled' }}
if: ${{ needs.supported.result == 'cancelled' || needs.unsupported-check.result == 'cancelled' || needs.check-bsd-vm.result == 'cancelled' }}
run: |
echo "CI workflow was cancelled.";
exit 1;
+36
View File
@@ -0,0 +1,36 @@
#!/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 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
pkg_add rust rust-rustfmt
. "$HOME/.cargo/env"
cargo fmt --all -- --check
# Note this only tests the default features, but I think that's fine.
# We also do not run clippy because OpenBSD tends to lag behind due to
# 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."
exit 1
fi