deployment: add aarch64/armv7 gnu .deb generation (#739)

Adds .deb generation for aarch64 and armv7 gnu targets in the nightly and deploy workflows.
This commit is contained in:
Clement Tsang 2022-05-28 16:14:25 -04:00 committed by GitHub
parent 42909dba35
commit 96d5b9b87d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 40 deletions

View File

@ -54,6 +54,7 @@ jobs:
container: ${{ matrix.triple.container }} container: ${{ matrix.triple.container }}
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
BTM_GENERATE: true
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -162,11 +163,6 @@ jobs:
args: --release --verbose --locked --target=${{ matrix.triple.target }} --features deploy args: --release --verbose --locked --target=${{ matrix.triple.target }} --features deploy
use-cross: ${{ matrix.triple.cross }} use-cross: ${{ matrix.triple.cross }}
- name: Build autocompletion and manpage
shell: bash
run: |
GENERATE=true cargo build
- name: Bundle release and completion (Windows) - name: Bundle release and completion (Windows)
if: matrix.triple.os == 'windows-2019' if: matrix.triple.os == 'windows-2019'
shell: bash shell: bash
@ -287,8 +283,26 @@ jobs:
name: build-deb name: build-deb
needs: [initialize-release-job] needs: [initialize-release-job]
runs-on: "ubuntu-18.04" runs-on: "ubuntu-18.04"
strategy:
fail-fast: false
matrix:
tuple:
- { target: "x86_64-unknown-linux-gnu", cross: false, dpkg: amd64 }
- {
target: "aarch64-unknown-linux-gnu",
cross: true,
dpkg: arm64,
container: "ghcr.io/clementtsang/cargo-deb-aarch64-unknown-linux-gnu",
}
- {
target: "armv7-unknown-linux-gnueabihf",
cross: true,
dpkg: armhf,
container: "ghcr.io/clementtsang/cargo-deb-armv7-unknown-linux-gnueabihf",
}
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
BTM_GENERATE: true
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -317,38 +331,46 @@ jobs:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
override: true override: true
target: x86_64-unknown-linux-gnu target: ${{ matrix.tuple.target }}
- uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # 1.4.0 - uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # 1.4.0
with:
key: x86_64-unknown-linux-gnu-deb
- name: Build - name: Build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --release --locked --verbose --features deploy args: --release --locked --verbose --features deploy --target ${{ matrix.tuple.target }}
use-cross: ${{ matrix.tuple.cross }}
- name: Build autocompletion and manpage - name: Zip manpage
shell: bash shell: bash
run: | run: |
GENERATE=true cargo build
gzip ./manpage/btm.1 gzip ./manpage/btm.1
- name: Build Debian release - name: Build Debian release (x86-64)
if: matrix.tuple.cross == false
run: | run: |
cargo install cargo-deb --version 1.37.0 --locked cargo install cargo-deb --version 1.38.0 --locked
cargo deb --no-build cargo deb --no-build --target ${{ matrix.tuple.target }}
cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb cp ./target/${{ matrix.tuple.target }}/debian/bottom_*.deb ./bottom_${{ matrix.tuple.target }}.deb
- name: Build Debian release (ARM)
if: matrix.tuple.cross == true
run: |
docker pull ${{ matrix.tuple.container }}
docker run -t --rm --mount type=bind,source="$(pwd)",target=/volume ${{ matrix.tuple.container }} "--variant ${{ matrix.tuple.dpkg }} --target ${{ matrix.tuple.target }} --no-build" "/volume"
cp ./target/${{ matrix.tuple.target }}/debian/bottom-*.deb ./bottom_${{ matrix.tuple.target }}.deb
- name: Test Debian release - name: Test Debian release
run: sudo dpkg -i ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb run: |
dpkg -I ./bottom_${{ matrix.tuple.target }}.deb
dpkg -I ./bottom_${{ matrix.tuple.target }}.deb | grep ${{ matrix.tuple.dpkg }} && echo "Found correct architecture"
- name: Create release directory for artifact, move file - name: Create release directory for artifact, move file
shell: bash shell: bash
run: | run: |
mkdir release mkdir release
mv bottom_${{ env.RELEASE_VERSION }}_amd64.deb release/ mv bottom_${{ matrix.tuple.target }}.deb release/
- name: Save release as artifact - name: Save release as artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2

View File

@ -50,6 +50,7 @@ jobs:
container: ${{ matrix.triple.container }} container: ${{ matrix.triple.container }}
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
BTM_GENERATE: true
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -158,11 +159,6 @@ jobs:
args: --release --locked --verbose --target=${{ matrix.triple.target }} --features deploy args: --release --locked --verbose --target=${{ matrix.triple.target }} --features deploy
use-cross: ${{ matrix.triple.cross }} use-cross: ${{ matrix.triple.cross }}
- name: Build autocompletion and manpage
shell: bash
run: |
GENERATE=true cargo build
- name: Bundle release and completion (Windows) - name: Bundle release and completion (Windows)
if: matrix.triple.os == 'windows-2019' if: matrix.triple.os == 'windows-2019'
shell: bash shell: bash
@ -281,8 +277,26 @@ jobs:
name: build-deb name: build-deb
needs: [initialize-job] needs: [initialize-job]
runs-on: "ubuntu-18.04" runs-on: "ubuntu-18.04"
strategy:
fail-fast: false
matrix:
tuple:
- { target: "x86_64-unknown-linux-gnu", cross: false, dpkg: amd64 }
- {
target: "aarch64-unknown-linux-gnu",
cross: true,
dpkg: arm64,
container: "ghcr.io/clementtsang/cargo-deb-aarch64-unknown-linux-gnu",
}
- {
target: "armv7-unknown-linux-gnueabihf",
cross: true,
dpkg: armhf,
container: "ghcr.io/clementtsang/cargo-deb-armv7-unknown-linux-gnueabihf",
}
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
BTM_GENERATE: true
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -311,38 +325,46 @@ jobs:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
override: true override: true
target: x86_64-unknown-linux-gnu target: ${{ matrix.tuple.target }}
- uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # 1.4.0 - uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # 1.4.0
with:
key: x86_64-unknown-linux-gnu-deb
- name: Build - name: Build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: build command: build
args: --release --locked --verbose --features deploy args: --release --locked --verbose --features deploy --target ${{ matrix.tuple.target }}
use-cross: ${{ matrix.tuple.cross }}
- name: Build autocompletion and manpage - name: Zip manpage
shell: bash shell: bash
run: | run: |
GENERATE=true cargo build
gzip ./manpage/btm.1 gzip ./manpage/btm.1
- name: Build Debian release - name: Build Debian release (x86-64)
if: matrix.tuple.cross == false
run: | run: |
cargo install cargo-deb --version 1.37.0 --locked cargo install cargo-deb --version 1.38.0 --locked
cargo deb --no-build cargo deb --no-build --target ${{ matrix.tuple.target }}
cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb cp ./target/${{ matrix.tuple.target }}/debian/bottom_*.deb ./bottom_${{ matrix.tuple.target }}.deb
- name: Build Debian release (ARM)
if: matrix.tuple.cross == true
run: |
docker pull ${{ matrix.tuple.container }}
docker run -t --rm --mount type=bind,source="$(pwd)",target=/volume ${{ matrix.tuple.container }} "--variant ${{ matrix.tuple.dpkg }} --target ${{ matrix.tuple.target }} --no-build" "/volume"
cp ./target/${{ matrix.tuple.target }}/debian/bottom-*.deb ./bottom_${{ matrix.tuple.target }}.deb
- name: Test Debian release - name: Test Debian release
run: sudo dpkg -i ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb run: |
dpkg -I ./bottom_${{ matrix.tuple.target }}.deb
dpkg -I ./bottom_${{ matrix.tuple.target }}.deb | grep ${{ matrix.tuple.dpkg }} && echo "Found correct architecture"
- name: Create release directory for artifact, move file - name: Create release directory for artifact, move file
shell: bash shell: bash
run: | run: |
mkdir release mkdir release
mv bottom_${{ env.RELEASE_VERSION }}_amd64.deb release/ mv bottom_${{ matrix.tuple.target }}.deb release/
- name: Save Debian file as artifacts - name: Save Debian file as artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2

View File

@ -119,6 +119,12 @@ If one is not specified it will fall back to defaults. If a config file does no
exist at the specified or default location, a blank one will be created for the user. exist at the specified or default location, a blank one will be created for the user.
""" """
[package.metadata.deb.variants.arm64]
depends = "libc6:arm64 (>= 2.28)"
[package.metadata.deb.variants.armhf]
depends = "libc6:armhf (>= 2.28)"
[package.metadata.wix] [package.metadata.wix]
output = "bottom_x86_64_installer.msi" output = "bottom_x86_64_installer.msi"

2
Cross.toml Normal file
View File

@ -0,0 +1,2 @@
[build.env]
passthrough = ["RUST_BACKTRACE", "BTM_GENERATE"]

View File

@ -27,7 +27,7 @@
- [Installation](#installation) - [Installation](#installation)
- [Cargo](#cargo) - [Cargo](#cargo)
- [Arch Linux](#arch-linux) - [Arch Linux](#arch-linux)
- [Debian/Ubuntu (x86-64)](#debianubuntu-x86-64) - [Debian/Ubuntu](#debianubuntu)
- [Snap](#snap) - [Snap](#snap)
- [Fedora/CentOS](#fedoracentos) - [Fedora/CentOS](#fedoracentos)
- [Gentoo](#gentoo) - [Gentoo](#gentoo)
@ -126,15 +126,21 @@ There is an official package that can be installed with `pacman`:
sudo pacman -Syu bottom sudo pacman -Syu bottom
``` ```
### Debian/Ubuntu (x86-64) ### Debian/Ubuntu
A `.deb` file is provided on each [release](https://github.com/ClementTsang/bottom/releases/latest): <!-- FIXME: Update this when bumping version, as the format has changed. -->
A `.deb` file is provided on each [release](https://github.com/ClementTsang/bottom/releases/latest) (currently only for x86-64):
```bash ```bash
curl -LO https://github.com/ClementTsang/bottom/releases/download/0.6.8/bottom_0.6.8_amd64.deb curl -LO https://github.com/ClementTsang/bottom/releases/download/0.6.8/bottom_0.6.8_amd64.deb
sudo dpkg -i bottom_0.6.8_amd64.deb sudo dpkg -i bottom_0.6.8_amd64.deb
``` ```
For ARM (aarch64 and armv7), for now, releases are currently only provided on
[nightly builds](https://github.com/ClementTsang/bottom/releases/tag/nightly), but will be provided alongside the
x86-64 builds in future releases.
### Snap ### Snap
bottom is available as a [snap](https://snapcraft.io/install/bottom/ubuntu): bottom is available as a [snap](https://snapcraft.io/install/bottom/ubuntu):

View File

@ -23,7 +23,7 @@ fn create_dir(dir: &Path) -> Result<()> {
} }
fn main() -> Result<()> { fn main() -> Result<()> {
if env::var_os("GENERATE").is_some() { if env::var_os("BTM_GENERATE").is_some() {
// OUT_DIR is where extra build files are written to for Cargo. // OUT_DIR is where extra build files are written to for Cargo.
let completion_out_dir = PathBuf::from("completion"); let completion_out_dir = PathBuf::from("completion");
let manpage_out_dir = PathBuf::from("manpage"); let manpage_out_dir = PathBuf::from("manpage");
@ -49,7 +49,7 @@ fn main() -> Result<()> {
println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=./src/clap.rs"); println!("cargo:rerun-if-changed=./src/clap.rs");
println!("cargo:rerun-if-env-changed=GENERATE"); println!("cargo:rerun-if-env-changed=BTM_GENERATE");
Ok(()) Ok(())
} }