mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-23 20:53:07 +00:00
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:
parent
21a09fd6bc
commit
1a715206be
5 changed files with 128 additions and 50 deletions
29
.cirrus.yml
29
.cirrus.yml
|
@ -39,35 +39,6 @@ env:
|
||||||
CARGO_PROFILE_DEV_DEBUG: "0"
|
CARGO_PROFILE_DEV_DEBUG: "0"
|
||||||
CARGO_HUSKY_DONT_INSTALL_HOOKS: "true"
|
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:
|
release_task:
|
||||||
auto_cancellation: "false"
|
auto_cancellation: "false"
|
||||||
only_if: $CIRRUS_BUILD_SOURCE == "api" && $BTM_BUILD_RELEASE_CALLER == "ci"
|
only_if: $CIRRUS_BUILD_SOURCE == "api" && $BTM_BUILD_RELEASE_CALLER == "ci"
|
||||||
|
|
28
.github/workflows/build_releases.yml
vendored
28
.github/workflows/build_releases.yml
vendored
|
@ -120,6 +120,10 @@ jobs:
|
||||||
target: "riscv64gc-unknown-linux-gnu",
|
target: "riscv64gc-unknown-linux-gnu",
|
||||||
cross: true,
|
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:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
if: matrix.info.container == ''
|
if: matrix.info.container == ''
|
||||||
|
@ -272,6 +276,30 @@ jobs:
|
||||||
name: "release-build-msi"
|
name: "release-build-msi"
|
||||||
path: release
|
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:
|
build-cirrus:
|
||||||
name: "Build using Cirrus CI"
|
name: "Build using Cirrus CI"
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
|
|
112
.github/workflows/ci.yml
vendored
112
.github/workflows/ci.yml
vendored
|
@ -227,12 +227,91 @@ jobs:
|
||||||
cross: true,
|
cross: true,
|
||||||
cross-version: "git:cabfc3b02d1edec03869fabdabf6a7f8b0519160",
|
cross-version: "git:cabfc3b02d1edec03869fabdabf6a7f8b0519160",
|
||||||
no-default-features: true,
|
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:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
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
|
- name: Set up Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
|
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
|
||||||
with:
|
with:
|
||||||
|
@ -243,30 +322,27 @@ jobs:
|
||||||
uses: Swatinem/rust-cache@9bdad043e88c75890e36ad3bbc8d27f0090dd609 # 2.7.3
|
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
|
if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }} # If it is a PR, only if not a fork
|
||||||
with:
|
with:
|
||||||
key: ${{ matrix.info.target }}
|
key: ${{ matrix.info.target }}-${{ matrix.info.os_release }}
|
||||||
cache-all-crates: true
|
cache-all-crates: true
|
||||||
|
|
||||||
- name: Try building with only default features enabled
|
- name: Test FreeBSD
|
||||||
uses: ClementTsang/cargo-action@v0.0.5
|
if: ${{ matrix.info.type == 'freebsd' }}
|
||||||
if: ${{ matrix.info.no-default-features != true }}
|
uses: vmactions/freebsd-vm@v1.0.8
|
||||||
with:
|
with:
|
||||||
command: build
|
release: "${{ matrix.info.os_release }}"
|
||||||
args: --all-targets --verbose --target=${{ matrix.info.target }} --locked
|
envs: "CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
|
||||||
use-cross: ${{ matrix.info.cross }}
|
usesh: true
|
||||||
cross-version: ${{ matrix.info.cross-version || '0.2.5' }}
|
prepare: |
|
||||||
|
pkg install -y curl bash
|
||||||
- name: Try building with no features enabled
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
|
||||||
uses: ClementTsang/cargo-action@v0.0.5
|
sh rustup.sh --default-toolchain stable -y
|
||||||
if: ${{ matrix.info.no-default-features == true }}
|
run: |
|
||||||
with:
|
. "$HOME/.cargo/env"
|
||||||
command: build
|
cargo clippy --all-targets --workspace -- -D warnings
|
||||||
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' }}
|
|
||||||
|
|
||||||
completion:
|
completion:
|
||||||
name: "CI Pass Check"
|
name: "CI Pass Check"
|
||||||
needs: [supported, other-check]
|
needs: [supported, other-check, vm-check]
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
|
|
7
.github/workflows/nightly.yml
vendored
7
.github/workflows/nightly.yml
vendored
|
@ -9,9 +9,10 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
isMock:
|
isMock:
|
||||||
description: "Replace with any word other than 'mock' to trigger a non-mock run."
|
description: "Mock run"
|
||||||
default: "mock"
|
default: true
|
||||||
required: false
|
required: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
|
@ -43,7 +44,7 @@ jobs:
|
||||||
echo "${{ github.event.inputs.isMock }}";
|
echo "${{ github.event.inputs.isMock }}";
|
||||||
if [[ -z "${{ github.event.inputs.isMock }}" ]]; then
|
if [[ -z "${{ github.event.inputs.isMock }}" ]]; then
|
||||||
echo "This is a scheduled nightly run."
|
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."
|
echo "This is a mock run."
|
||||||
else
|
else
|
||||||
echo "This is NOT a mock run. Watch for the generated files!"
|
echo "This is NOT a mock run. Watch for the generated files!"
|
||||||
|
|
|
@ -206,6 +206,8 @@ impl DataCollection {
|
||||||
self.timed_data_vec.shrink_to_fit();
|
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>) {
|
pub fn eat_data(&mut self, harvested_data: Box<Data>) {
|
||||||
let harvested_time = harvested_data.collection_time;
|
let harvested_time = harvested_data.collection_time;
|
||||||
let mut new_entry = TimedData::default();
|
let mut new_entry = TimedData::default();
|
||||||
|
|
Loading…
Reference in a new issue