Skip to content

Add a 30 minute timeout to FreeBSD tests #3278

Add a 30 minute timeout to FreeBSD tests

Add a 30 minute timeout to FreeBSD tests #3278

Workflow file for this run

name: checks
permissions:
contents: read
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches-ignore:
- 'release/**'
schedule:
- cron: '0 4 * * *'
jobs:
build-ubuntu:
name: Build+test ubuntu
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust:
- stable
- beta
- 1.66.0
target:
- ""
features:
- ""
- "--features ntpv5"
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install ${{ matrix.rust }} toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e
with:
tool: cargo-llvm-cov
- name: cargo build
run: cargo build ${{ matrix.features }}
- name: cargo test
run: cargo llvm-cov ${{ matrix.features }} --lcov --output-path lcov.info
env:
RUST_BACKTRACE: 1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
files: lcov.info
fail_ci_if_error: false
build-musl:
name: Build+test-musl
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust:
- stable
target:
- "x86_64-unknown-linux-musl"
os: [ubuntu-latest]
features:
- ""
- "--features ntpv5"
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install ${{ matrix.rust }} toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: ${{ matrix.rust }}
override: true
- name: cargo build
run: cargo build ${{ matrix.features }}
- name: cargo test
run: cargo test
env:
RUST_BACKTRACE: 1
build-macos:
name: Build+test macos
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
rust:
- stable
target:
- ""
features:
- ""
- "--features ntpv5"
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install ${{ matrix.rust }} toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: ${{ matrix.rust }}
override: true
- name: cargo build
run: cargo build ${{ matrix.features }}
- name: cargo test
run: cargo test
env:
RUST_BACKTRACE: 1
test-freebsd:
# see https://github.com/actions/runner/issues/385
# use https://github.com/vmactions/freebsd-vm for now
name: test on freebsd
runs-on: macos-12
timeout-minutes: 30
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- name: test on freebsd
uses: vmactions/freebsd-vm@v0
with:
usesh: true
mem: 4096
copyback: false
prepare: |
pkg install -y curl
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile default --default-toolchain stable # cannot use `--profile minimal` because of clippy
echo "~~~~ rustc --version ~~~~"
$HOME/.cargo/bin/rustc --version
echo "~~~~ freebsd-version ~~~~"
freebsd-version
run: $HOME/.cargo/bin/cargo clippy --workspace --all-targets -- -D warnings && $HOME/.cargo/bin/cargo build --all-targets && $HOME/.cargo/bin/cargo test
unused:
name: Unused dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install nightly toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: nightly
override: true
- name: Install udeps
uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e
with:
tool: cargo-udeps
- name: cargo udeps
run: cargo udeps --workspace --all-targets
- name: cargo udeps (fuzzer)
run: cargo udeps --manifest-path ./fuzz/Cargo.toml --all-targets
#note: can't validate config/nts.*.toml because of intentionally missing files
validate:
name: Validate configs
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: ./ntp.toml
run: cargo run --bin ntp-ctl -- -c ./ntp.toml validate
- name: ./ntp.server.toml
run: cargo run --bin ntp-ctl -- -c ./ntp.server.toml validate
- name: ./test-keys/unsafe.nts.client.toml
run: cargo run --bin ntp-ctl -- -c ./test-keys/unsafe.nts.client.toml validate
- name: ./test-keys/unsafe.nts.server.toml
run: cargo run --bin ntp-ctl -- -c ./test-keys/unsafe.nts.server.toml validate
- name: ./config/ntp.demobilize.toml
run: cargo run --bin ntp-ctl -- -c ./config/ntp.demobilize.toml validate
- name: ./pkg/common/ntp.toml.default
run: cargo run --bin ntp-ctl -- -c ./docs/examples/conf/ntp.toml.default validate
man-sync:
name: Precompiled man pages
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Build man pages
run: utils/generate-man.sh target/docs/man
- name: Compare generated pages with precompiled
run: diff -r -s --color "docs/precompiled/man" "target/docs/man"
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install rust toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: stable
override: true
default: true
components: rustfmt
- name: Check formatting
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
with:
command: fmt
args: --all --check
- name: Check formatting (fuzzers)
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
with:
command: fmt
args: --manifest-path ./fuzz/Cargo.toml --all --check
- name: Check formatting (fuzz_rand_shim)
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
with:
command: fmt
args: --manifest-path ./fuzz/fuzz_rand_shim/Cargo.toml --all --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install rust toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: stable
override: true
default: true
components: clippy
- name: Run clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
with:
command: clippy
args: --workspace --all-targets --all-features -- -D warnings
- name: Run clippy (fuzzers)
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
with:
command: clippy
args: --manifest-path ./fuzz/Cargo.toml --all-targets -- -D warnings
- name: Run clippy (fuzz_rand_shim)
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
with:
command: clippy
args: --manifest-path ./fuzz/fuzz_rand_shim/Cargo.toml --all-targets -- -D warnings
clippy-raspberry-pi:
name: ClippyRaspberryPi
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install rust toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: stable
override: true
default: true
components: clippy
target: armv7-unknown-linux-gnueabihf
# Use zig as our C compiler for convenient cross-compilation. We run into rustls having a dependency on `ring`.
# This crate uses C and assembly code, and because of its build scripts, `cargo clippy` needs to be able to compile
# that code for our target.
- uses: goto-bus-stop/setup-zig@6fede2f0550d71291c0accf2834b216e69a2d67a
with:
version: 0.9.0
- name: Install cargo-zigbuild
uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e
with:
tool: cargo-zigbuild
- name: Run clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
env:
TARGET_CC: "/home/runner/.cargo/bin/cargo-zigbuild zig cc -- -target arm-linux-gnueabihf -mcpu=generic+v7a+vfp3-d32+thumb2-neon -g"
with:
command: clippy
args: --target armv7-unknown-linux-gnueabihf --workspace --all-targets --all-features -- -D warnings
clippy-macos:
name: ClippyMacOS
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install rust toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: stable
override: true
default: true
components: clippy
target: x86_64-apple-darwin
# Use zig as our C compiler for convenient cross-compilation. We run into rustls having a dependency on `ring`.
# This crate uses C and assembly code, and because of its build scripts, `cargo clippy` needs to be able to compile
# that code for our target.
- uses: goto-bus-stop/setup-zig@6fede2f0550d71291c0accf2834b216e69a2d67a
with:
version: 0.9.0
- name: Install cargo-zigbuild
uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e
with:
tool: cargo-zigbuild
- name: Run clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
env:
TARGET_CC: "/home/runner/.cargo/bin/cargo-zigbuild zig cc -- -target x86_64-macos-gnu -g"
with:
command: clippy
args: --target x86_64-apple-darwin --workspace --all-targets --all-features -- -D warnings
clippy-musl:
name: ClippyMusl
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install rust toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: stable
override: true
default: true
components: clippy
target: x86_64-unknown-linux-musl
# Use zig as our C compiler for convenient cross-compilation. We run into rustls having a dependency on `ring`.
# This crate uses C and assembly code, and because of its build scripts, `cargo clippy` needs to be able to compile
# that code for our target.
- uses: goto-bus-stop/setup-zig@6fede2f0550d71291c0accf2834b216e69a2d67a
with:
version: 0.9.0
- name: Install cargo-zigbuild
uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e
with:
tool: cargo-zigbuild
- name: Run clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505
env:
TARGET_CC: "/home/runner/.cargo/bin/cargo-zigbuild zig cc -- -target x86_64-linux-musl"
with:
command: clippy
args: --target x86_64-unknown-linux-musl --workspace --all-targets --all-features -- -D warnings
fuzz:
name: Smoke-test fuzzing targets
runs-on: ubuntu-20.04
strategy:
matrix:
features:
- ""
- "--features ntpv5"
steps:
- name: Checkout sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
persist-credentials: false
- name: Install nightly toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af
with:
toolchain: nightly
override: true
default: true
- name: Install cargo fuzz
uses: taiki-e/install-action@47d27149ff6b3422864ec504071d5cc7873d642e
with:
tool: cargo-fuzz
- name: Smoke-test fuzz targets
run: |
cargo fuzz build ${{ matrix.features }}
for target in $(cargo fuzz list ${{ matrix.features }}) ; do
cargo fuzz run ${{ matrix.features }} $target -- -max_total_time=10
done
audit-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
- uses: EmbarkStudios/cargo-deny-action@1e59595bed8fc55c969333d08d7817b36888f0c5
with:
arguments: --workspace --all-features
- uses: EmbarkStudios/cargo-deny-action@1e59595bed8fc55c969333d08d7817b36888f0c5
with:
arguments: --manifest-path ./fuzz/Cargo.toml --all-features