ci: try using GHA instead of Cirrus for FreeBSD in basic CI (#1577)

Ideally we minimize our usage of Cirrus CI, especially for typical PR CI workflows, since it's a bit cludgy to work with. This method is also more extendable to things like OpenBSD.

Fine for deploys I guess since that's not super frequent and at this point I have that working fairly well when automated + I don't usually have to wait for it.
This commit is contained in:
Clement Tsang 2024-09-03 04:33:13 -04:00 committed by GitHub
parent 21a09fd6bc
commit 1a715206be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 128 additions and 50 deletions

View file

@ -39,35 +39,6 @@ env:
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_HUSKY_DONT_INSTALL_HOOKS: "true"
test_task:
auto_cancellation: "false" # We set this to false to prevent nightly builds from affecting this
only_if: $CIRRUS_BUILD_SOURCE != "api" && ($CIRRUS_BRANCH == "main" || $CIRRUS_PR != "")
timeout_in: "15m"
skip: "!changesInclude('.cargo/**', 'sample_configs/**', 'scripts/cirrus/**', 'src/**', 'tests/**', '.cirrus.yml', 'build.rs', 'Cargo.lock', 'Cargo.toml', 'clippy.toml', 'rustfmt.toml')"
matrix:
- name: "FreeBSD 14 Test"
freebsd_instance:
image_family: freebsd-14-0
- name: "FreeBSD 13 Test"
freebsd_instance:
image_family: freebsd-13-3
<<: *SETUP_TEMPLATE
<<: *CACHE_TEMPLATE
test_no_feature_script:
- . $HOME/.cargo/env
- cargo fmt --all -- --check
- cargo test --no-run --locked --no-default-features
- cargo test --no-fail-fast --no-default-features -- --nocapture --quiet
- cargo clippy --all-targets --workspace --no-default-features -- -D warnings
test_all_feature_script:
- . $HOME/.cargo/env
- cargo fmt --all -- --check
- cargo test --no-run --locked --all-features
- cargo test --no-fail-fast --all-features -- --nocapture --quiet
- cargo clippy --all-targets --workspace --all-features -- -D warnings
<<: *CLEANUP_TEMPLATE
release_task:
auto_cancellation: "false"
only_if: $CIRRUS_BUILD_SOURCE == "api" && $BTM_BUILD_RELEASE_CALLER == "ci"

View file

@ -120,6 +120,10 @@ jobs:
target: "riscv64gc-unknown-linux-gnu",
cross: true,
}
# Seems like cross' FreeBSD image is a bit broken? I
# get build errors, may be related to this issue:
# https://github.com/cross-rs/cross/issues/1291
steps:
- name: Checkout repository
if: matrix.info.container == ''
@ -272,6 +276,30 @@ jobs:
name: "release-build-msi"
path: release
# build-vm:
# name: "Build using VMs"
# runs-on: "ubuntu-latest"
# timeout-minutes: 30
# strategy:
# fail-fast: false
# matrix:
# info:
# - {
# type: "freebsd",
# os_release: "14.1",
# target: "x86_64-unknown-freebsd",
# }
# - {
# type: "freebsd",
# os_release: "13.3",
# target: "x86_64-unknown-freebsd",
# }
# steps:
# - name: Checkout repository
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# with:
# fetch-depth: 1
build-cirrus:
name: "Build using Cirrus CI"
runs-on: "ubuntu-latest"

View file

@ -227,12 +227,91 @@ jobs:
cross: true,
cross-version: "git:cabfc3b02d1edec03869fabdabf6a7f8b0519160",
no-default-features: true,
no-clippy: true,
}
# Seems like cross' FreeBSD image is a bit broken? I
# get build errors, may be related to this issue:
# https://github.com/cross-rs/cross/issues/1291
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
with:
toolchain: ${{ matrix.info.rust || 'stable' }}
target: ${{ matrix.info.target }}
components: "clippy"
- name: Enable Rust cache
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609 # 2.7.3
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 }}
cache-all-crates: true
- name: Test (default features)
uses: ClementTsang/cargo-action@v0.0.5
if: ${{ matrix.info.no-default-features != true }}
with:
command: test
args: --all-targets --workspace --target=${{ matrix.info.target }} --locked
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
- name: Test (no features enabled)
uses: ClementTsang/cargo-action@v0.0.5
if: ${{ matrix.info.no-default-features == true }}
with:
command: test
args: --all-targets --workspace --target=${{ matrix.info.target }} --locked --no-default-features
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
- name: Check (default features)
uses: ClementTsang/cargo-action@v0.0.5
if: ${{ matrix.info.no-default-features != true }}
with:
command: clippy
args: --all-targets --workspace --target=${{ matrix.info.target }} --locked
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
- name: Check (no features enabled)
uses: ClementTsang/cargo-action@v0.0.5
if: ${{ matrix.info.no-default-features == true }}
with:
command: clippy
args: --all-targets --workspace --target=${{ matrix.info.target }} --locked --no-default-features
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
vm-check:
name: "Test using VMs"
needs: pre-job
runs-on: "ubuntu-latest"
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
info:
- {
type: "freebsd",
os_release: "14.1",
target: "x86_64-unknown-freebsd",
}
- {
type: "freebsd",
os_release: "13.3",
target: "x86_64-unknown-freebsd",
}
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 1
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
with:
@ -243,30 +322,27 @@ jobs:
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609 # 2.7.3
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 }}
key: ${{ matrix.info.target }}-${{ matrix.info.os_release }}
cache-all-crates: true
- name: Try building with only default features enabled
uses: ClementTsang/cargo-action@v0.0.5
if: ${{ matrix.info.no-default-features != true }}
- name: Test FreeBSD
if: ${{ matrix.info.type == 'freebsd' }}
uses: vmactions/freebsd-vm@v1.0.8
with:
command: build
args: --all-targets --verbose --target=${{ matrix.info.target }} --locked
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
- name: Try building with no features enabled
uses: ClementTsang/cargo-action@v0.0.5
if: ${{ matrix.info.no-default-features == true }}
with:
command: build
args: --all-targets --verbose --target=${{ matrix.info.target }} --locked --no-default-features
use-cross: ${{ matrix.info.cross }}
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
release: "${{ matrix.info.os_release }}"
envs: "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 clippy --all-targets --workspace -- -D warnings
completion:
name: "CI Pass Check"
needs: [supported, other-check]
needs: [supported, other-check, vm-check]
if: ${{ always() }}
runs-on: "ubuntu-latest"
steps:

View file

@ -9,9 +9,10 @@ on:
workflow_dispatch:
inputs:
isMock:
description: "Replace with any word other than 'mock' to trigger a non-mock run."
default: "mock"
description: "Mock run"
default: true
required: false
type: boolean
env:
CARGO_INCREMENTAL: 0
@ -43,7 +44,7 @@ jobs:
echo "${{ github.event.inputs.isMock }}";
if [[ -z "${{ github.event.inputs.isMock }}" ]]; then
echo "This is a scheduled nightly run."
elif [[ "${{ github.event.inputs.isMock }}" == "mock" ]]; then
elif [[ ${{ github.event.inputs.isMock }} == true ]]; then
echo "This is a mock run."
else
echo "This is NOT a mock run. Watch for the generated files!"

View file

@ -206,6 +206,8 @@ impl DataCollection {
self.timed_data_vec.shrink_to_fit();
}
// Clippy allow to avoid warning on certain platforms (e.g. 32-bit).
#[allow(clippy::boxed_local)]
pub fn eat_data(&mut self, harvested_data: Box<Data>) {
let harvested_time = harvested_data.collection_time;
let mut new_entry = TimedData::default();