ci: add FreeBSD and macOS M1 builds (#845)

* add OS to fingerprint cache

* simplify cirrus test script

* cleanup and add start of build script

* add nightly cron job to CCI build, add artifact

* add docs

* avoid test task if cron
This commit is contained in:
Clement Tsang 2022-10-21 10:47:55 -04:00 committed by GitHub
parent f9732bbb9e
commit 3fdd7cd48e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 51 deletions

View File

@ -1,68 +1,50 @@
# Configuration for CirrusCI. This is primarily used for # Configuration for CirrusCI. This is primarily used for
# FreeBSD and macOS M1 tests and builds. # FreeBSD and macOS M1 tests and builds.
env: setup_template: &SETUP_TEMPLATE
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_HUSKY_DONT_INSTALL_HOOKS: true
task:
name: "FreeBSD 13 Test"
only_if: $CIRRUS_BRANCH == "master" || $CIRRUS_PR != ""
freebsd_instance:
image_family: freebsd-13-1
setup_script: setup_script:
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
- sh rustup.sh --default-toolchain stable -y - sh rustup.sh --default-toolchain stable -y
- . $HOME/.cargo/env
- rustc --version cache_template: &CACHE_TEMPLATE
registry_cache: registry_cache:
folder: $HOME/.cargo/registry folder: $HOME/.cargo/registry
reupload_on_changes: true reupload_on_changes: true
fingerprint_script: md5 Cargo.lock fingerprint_script:
- md5 Cargo.lock
- echo $CIRRUS_OS
- echo $CIRRUS_TASK_NAME
target_cache: target_cache:
folder: target folder: target
reupload_on_changes: true reupload_on_changes: true
fingerprint_script: fingerprint_script:
- . $HOME/.cargo/env && rustc --version - . $HOME/.cargo/env && rustc --version
- md5 Cargo.lock - md5 Cargo.lock
test_all_feature_script: - echo $CIRRUS_OS
- . $HOME/.cargo/env - echo $CIRRUS_TASK_NAME
- cargo fmt --all -- --check
- cargo test --no-run --locked --all-features cleanup_template: &CLEANUP_TEMPLATE
- cargo test --no-fail-fast --all-features -- --nocapture --quiet
- cargo clippy --all-targets --workspace --all-features -- -D warnings
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
before_cache_script: before_cache_script:
- rm -rf $HOME/.cargo/registry/index - rm -rf $HOME/.cargo/registry/index
- rm -f ./target/.rustc_info.json - rm -f ./target/.rustc_info.json
- find ./target/debug -maxdepth 1 -type f -delete # Delete stray files - find ./target/debug -maxdepth 1 -type f -delete # Delete stray files
task: env:
name: "macOS M1 Test" CARGO_INCREMENTAL: 0
only_if: $CIRRUS_BRANCH == "master" || $CIRRUS_PR != "" CARGO_PROFILE_DEV_DEBUG: 0
macos_instance: CARGO_HUSKY_DONT_INSTALL_HOOKS: true
image: ghcr.io/cirruslabs/macos-monterey-base:latest
setup_script: test_task:
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh only_if: $CIRRUS_CRON == "" && ($CIRRUS_BRANCH == "master" || $CIRRUS_PR != "")
- sh rustup.sh --default-toolchain stable -y matrix:
- source $HOME/.cargo/env - name: "FreeBSD 13 Test"
- rustc --version freebsd_instance:
registry_cache: image_family: freebsd-13-1
folder: $HOME/.cargo/registry - name: "macOS M1 Test"
reupload_on_changes: true macos_instance:
fingerprint_script: md5 Cargo.lock image: ghcr.io/cirruslabs/macos-monterey-base:latest
target_cache: <<: *SETUP_TEMPLATE
folder: target <<: *CACHE_TEMPLATE
reupload_on_changes: true
fingerprint_script:
- source $HOME/.cargo/env && rustc --version
- md5 Cargo.lock
test_all_feature_script: test_all_feature_script:
- . $HOME/.cargo/env - . $HOME/.cargo/env
- cargo fmt --all -- --check - cargo fmt --all -- --check
@ -75,7 +57,34 @@ task:
- cargo test --no-run --locked --no-default-features - cargo test --no-run --locked --no-default-features
- cargo test --no-fail-fast --no-default-features -- --nocapture --quiet - cargo test --no-fail-fast --no-default-features -- --nocapture --quiet
- cargo clippy --all-targets --workspace --no-default-features -- -D warnings - cargo clippy --all-targets --workspace --no-default-features -- -D warnings
before_cache_script: <<: *CLEANUP_TEMPLATE
- rm -rf $HOME/.cargo/registry/index
- rm -f ./target/.rustc_info.json build_task:
- find ./target/debug -maxdepth 1 -type f -delete # Delete stray files only_if: $CIRRUS_RELEASE != "" || $CIRRUS_CRON == "nightly"
env:
BTM_GENERATE: true
COMPLETION_DIR: "target/tmp/bottom/completion/"
MANPAGE_DIR: "target/tmp/bottom/manpage/"
matrix:
- name: "FreeBSD 13 Build"
freebsd_instance:
image_family: freebsd-13-1
env:
TARGET: "x86_64-unknown-freebsd"
- name: "macOS M1 Build"
macos_instance:
image: ghcr.io/cirruslabs/macos-monterey-base:latest
env:
TARGET: "aarch64-apple-darwin"
<<: *SETUP_TEMPLATE
<<: *CACHE_TEMPLATE
build_script:
- . $HOME/.cargo/env
- cargo build --release --verbose --locked --features deploy
- mv ./target/release/btm ./
- mv "$COMPLETION_DIR" completion
- mv "$MANPAGE_DIR" manpage
- tar -czvf bottom_$TARGET.tar.gz btm completion
binaries_artifacts:
path: bottom_$TARGET.tar.gz
<<: *CLEANUP_TEMPLATE

View File

@ -283,6 +283,7 @@ You can also try to use the generated release binaries and manually install on y
- [Latest stable release](https://github.com/ClementTsang/bottom/releases/latest), generated off of the release branch - [Latest stable release](https://github.com/ClementTsang/bottom/releases/latest), generated off of the release branch
- [Latest nightly release](https://github.com/ClementTsang/bottom/releases/tag/nightly), generated daily off of the master branch at 00:00 UTC - [Latest nightly release](https://github.com/ClementTsang/bottom/releases/tag/nightly), generated daily off of the master branch at 00:00 UTC
- FreeBSD and ARM macOS binaries are generated via Cirrus CI, and for now, can be found [here](https://cirrus-ci.com/github/ClementTsang/bottom).
#### Auto-completion #### Auto-completion