Skip to content

Commit

Permalink
ci: migrate FreeBSD release builds to GHA, update macOS and FreeBSD t…
Browse files Browse the repository at this point in the history
…argets (#1640)

* ci: migrate FreeBSD release builds to GHA

* fix

* ci: bump macOS image from macos-12

* fix

* fix for nightly
  • Loading branch information
ClementTsang authored Nov 29, 2024
1 parent 70d0a6c commit 1fe17dd
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 50 deletions.
16 changes: 0 additions & 16 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,6 @@ release_task:
MANPAGE_DIR: "target/tmp/bottom/manpage/"
# -PLACEHOLDER FOR CI-
matrix:
- name: "FreeBSD 14 Build"
alias: "freebsd_14_0_build"
freebsd_instance:
image_family: freebsd-14-0
env:
TARGET: "x86_64-unknown-freebsd"
NAME: "x86_64-unknown-freebsd-14-0"

- name: "FreeBSD 13 Build"
alias: "freebsd_13_3_build"
freebsd_instance:
image_family: freebsd-13-3
env:
TARGET: "x86_64-unknown-freebsd"
NAME: "x86_64-unknown-freebsd-13-3"

- name: "Legacy Linux (2.17)"
alias: "linux_2_17_build"
container:
Expand Down
103 changes: 88 additions & 15 deletions .github/workflows/build_releases.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Builds the following releases:
# - Binary releases
# - Binaries
# - Binaries via VMs
# - Cirrus binaries (currently just Linux 2.17)
# - MSI installer for Windows (.msi)
# - .deb releases
# - .rpm releases
# - MSI installer for Windows (.msi)
# - Cirrus CI binaries
# - FreeBSD (x86_64)
# - macOS (aarch64)

name: "build releases"

Expand Down Expand Up @@ -80,7 +79,7 @@ jobs:
}

# macOS (x86-64 and aarch64)
- { os: "macos-12", target: "x86_64-apple-darwin", cross: false }
- { os: "macos-13", target: "x86_64-apple-darwin", cross: false }
- { os: "macos-14", target: "aarch64-apple-darwin", cross: false }

# Windows (x86-64, x86)
Expand Down Expand Up @@ -133,12 +132,6 @@ jobs:
with:
fetch-depth: 1

- name: Checkout repository (non-GitHub container)
if: matrix.info.container != ''
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 1

- name: Set up Rust toolchain
if: matrix.info.container == ''
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
Expand Down Expand Up @@ -185,8 +178,8 @@ jobs:
shell: bash
run: |
cp target/${{ matrix.info.target }}/release/btm ./btm
tar -czvf bottom_${{ matrix.info.target }}${{ matrix.info.suffix }}.tar.gz btm completion
echo "ASSET=bottom_${{ matrix.info.target }}${{ matrix.info.suffix }}.tar.gz" >> $GITHUB_ENV
tar -czvf bottom_${{ matrix.info.target }}.tar.gz btm completion
echo "ASSET=bottom_${{ matrix.info.target }}.tar.gz" >> $GITHUB_ENV
- name: Generate artifact attestation for file
uses: actions/attest-build-provenance@6149ea5740be74af77f260b9db67e633f6b0a9a1 # v1.4.2
Expand Down Expand Up @@ -224,7 +217,87 @@ jobs:
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
retention-days: 3
name: "release-${{ matrix.info.target }}${{ matrix.info.suffix }}"
name: "release-${{ matrix.info.target }}"
path: release

build-vm:
name: "Build binaries via VMs"
runs-on: "ubuntu-latest"
timeout-minutes: 12
strategy:
fail-fast: false
matrix:
info:
# 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
#
# Alas, that's why we do it with VMs.
- {
type: "freebsd",
os_release: "15.0",
target: "x86_64-unknown-freebsd",
}
- {
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
if: matrix.info.container == ''
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 1

- name: Build (FreeBSD)
if: ${{ matrix.info.type == 'freebsd' }}
uses: vmactions/freebsd-vm@debf37ca7b7fa40e19c542ef7ba30d6054a706a4 # v1.1.5
with:
release: "${{ matrix.info.os_release }}"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS COMPLETION_DIR MANPAGE_DIR"
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"
BTM_GENERATE=true BTM_BUILD_RELEASE_CALLER=${{ inputs.caller }} cargo build --release --verbose --locked --target=${{ matrix.info.target }} --features deploy
- name: Move automatically generated completion/manpage
shell: bash
run: |
mv "$COMPLETION_DIR" completion
mv "$MANPAGE_DIR" manpage
- name: Bundle release and completion
shell: bash
run: |
cp target/${{ matrix.info.target }}/release/btm ./btm
tar -czvf bottom_${{ matrix.info.target }}-${{ matrix.info.os_release }}.tar.gz btm completion
echo "ASSET=bottom_${{ matrix.info.target }}-${{ matrix.info.os_release }}.tar.gz" >> $GITHUB_ENV
- name: Generate artifact attestation for file
uses: actions/attest-build-provenance@6149ea5740be74af77f260b9db67e633f6b0a9a1 # v1.4.2
with:
subject-path: ${{ env.ASSET }}

- name: Create release directory for artifact, move file
shell: bash
run: |
mkdir release
mv ${{ env.ASSET }} release/
- name: Save release as artifact
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
retention-days: 3
name: "release-${{ matrix.info.target }}-${{ matrix.info.os_release }}"
path: release

build-msi:
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
target: "aarch64-unknown-linux-gnu",
cross: true,
}
- { os: "macos-12", target: "x86_64-apple-darwin", cross: false }
- { os: "macos-13", target: "x86_64-apple-darwin", cross: false }
- { os: "macos-14", target: "aarch64-apple-darwin", cross: false }
- {
os: "windows-2019",
Expand Down Expand Up @@ -177,8 +177,8 @@ jobs:
rust: "beta",
}
- {
os: "macos-12",
target: "x86_64-apple-darwin",
os: "macos-14",
target: "aarch64-apple-darwin",
cross: false,
rust: "beta",
}
Expand Down Expand Up @@ -274,11 +274,15 @@ jobs:
fail-fast: false
matrix:
info:
# Seems like cross' FreeBSD image is a bit broken? I
# get build errors, may be related to this issue:
# 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
#
# Alas, that's why we do it with VMs.
- {
type: "freebsd",
os_release: "15.0",
target: "x86_64-unknown-freebsd",
}
- {
type: "freebsd",
os_release: "14.1",
Expand All @@ -295,12 +299,6 @@ jobs:
with:
fetch-depth: 1

- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17
with:
toolchain: ${{ matrix.info.rust || 'stable' }}
target: ${{ matrix.info.target }}

- 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
Expand All @@ -310,10 +308,10 @@ jobs:

- name: Clippy (FreeBSD)
if: ${{ matrix.info.type == 'freebsd' }}
uses: vmactions/freebsd-vm@v1.0.8
uses: vmactions/freebsd-vm@debf37ca7b7fa40e19c542ef7ba30d6054a706a4 # v1.1.5
with:
release: "${{ matrix.info.os_release }}"
envs: "CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
envs: "RUST_BACKTRACE CARGO_INCREMENTAL CARGO_PROFILE_DEV_DEBUG CARGO_HUSKY_DONT_INSTALL_HOOKS"
usesh: true
prepare: |
pkg install -y curl bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
matrix:
info:
- { os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu" }
- { os: "macos-12", target: "x86_64-apple-darwin" }
- { os: "macos-14", target: "aarch64-apple-darwin", cross: false }
- { os: "windows-2019", target: "x86_64-pc-windows-msvc" }
steps:
- name: Checkout repository
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ jobs:
du -h -d 0 ./release/*
- name: Delete tag and release if not mock
if: github.event.inputs.isMock != 'mock'
if: github.event.inputs.isMock != 'true'
run: gh release delete nightly --cleanup-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Sleep for a few seconds to prevent timing issues between the deletion and creation of the release
run: sleep 10
if: github.event.inputs.isMock != 'mock'
if: github.event.inputs.isMock != 'true'

- name: Add all release files and create nightly release if not mock
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # 2.0.8
if: github.event.inputs.isMock != 'mock'
if: github.event.inputs.isMock != 'true'
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
Expand Down
2 changes: 0 additions & 2 deletions scripts/cirrus/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

# Form of each task is (TASK_ALIAS, FILE_NAME).
TASKS: List[Tuple[str, str]] = [
("freebsd_13_3_build", "bottom_x86_64-unknown-freebsd-13-3.tar.gz"),
("freebsd_14_0_build", "bottom_x86_64-unknown-freebsd-14-0.tar.gz"),
("linux_2_17_build", "bottom_x86_64-unknown-linux-gnu-2-17.tar.gz"),
]
URL = "https://api.cirrus-ci.com/graphql"
Expand Down

0 comments on commit 1fe17dd

Please sign in to comment.