2022-06-02 09:10:17 +00:00
|
|
|
# Builds the following releases:
|
|
|
|
# - Binary releases
|
|
|
|
# - Debian releases (.deb)
|
2022-10-28 04:37:24 +00:00
|
|
|
# - MSI installer for Windows (.msi)
|
|
|
|
# - Cirrus CI binaries
|
|
|
|
# - FreeBSD (x86_64)
|
|
|
|
# - macOS (aarch64)
|
2022-06-02 09:10:17 +00:00
|
|
|
|
|
|
|
name: "Build Releases"
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
workflow_call:
|
2022-10-27 10:27:04 +00:00
|
|
|
inputs:
|
|
|
|
caller:
|
|
|
|
description: "The calling workflow."
|
|
|
|
default: ""
|
|
|
|
required: false
|
|
|
|
type: string
|
2022-06-02 09:10:17 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_INCREMENTAL: 0
|
2022-08-30 22:25:16 +00:00
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
BTM_GENERATE: true
|
|
|
|
COMPLETION_DIR: "target/tmp/bottom/completion/"
|
|
|
|
MANPAGE_DIR: "target/tmp/bottom/manpage/"
|
2022-06-02 09:10:17 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-binaries:
|
|
|
|
name: "Build binaries"
|
|
|
|
runs-on: ${{ matrix.info.os }}
|
|
|
|
container: ${{ matrix.info.container }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
info:
|
|
|
|
# ======= Supported targets =======
|
|
|
|
# Linux (x64, x86, aarch64)
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "x86_64-unknown-linux-gnu",
|
|
|
|
cross: false,
|
|
|
|
}
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "x86_64-unknown-linux-gnu",
|
|
|
|
cross: false,
|
|
|
|
container: quay.io/pypa/manylinux2014_x86_64,
|
|
|
|
suffix: "2-17",
|
|
|
|
}
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "i686-unknown-linux-gnu",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "x86_64-unknown-linux-musl",
|
|
|
|
cross: false,
|
|
|
|
}
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "i686-unknown-linux-musl",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "aarch64-unknown-linux-gnu",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "aarch64-unknown-linux-musl",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
# macOS (x64)
|
2022-10-20 10:24:04 +00:00
|
|
|
- { os: "macos-12", target: "x86_64-apple-darwin", cross: false }
|
2022-06-02 09:10:17 +00:00
|
|
|
|
|
|
|
# Windows (x64, x86)
|
|
|
|
- {
|
|
|
|
os: "windows-2019",
|
|
|
|
target: "x86_64-pc-windows-msvc",
|
|
|
|
cross: false,
|
|
|
|
}
|
|
|
|
- { os: "windows-2019", target: "i686-pc-windows-msvc", cross: false }
|
|
|
|
- {
|
|
|
|
os: "windows-2019",
|
|
|
|
target: "x86_64-pc-windows-gnu",
|
|
|
|
cross: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
# ======= Unsupported targets =======
|
|
|
|
# armv7
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "armv7-unknown-linux-gnueabihf",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "armv7-unknown-linux-musleabihf",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
# PowerPC 64 LE
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "powerpc64le-unknown-linux-gnu",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
# Risc-V 64gc
|
|
|
|
- {
|
2022-08-13 16:14:51 +00:00
|
|
|
os: "ubuntu-20.04",
|
2022-06-02 09:10:17 +00:00
|
|
|
target: "riscv64gc-unknown-linux-gnu",
|
|
|
|
cross: true,
|
|
|
|
}
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-06-02 19:05:43 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
2022-06-02 22:04:51 +00:00
|
|
|
- name: Set up Rust toolchain
|
|
|
|
if: matrix.info.container == ''
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: dtolnay/rust-toolchain@ba37adf8f94a7d9affce79bd3baff1b9e3189c33 # https://github.com/dtolnay/rust-toolchain/commit/ba37adf8f94a7d9affce79bd3baff1b9e3189c33
|
2022-06-02 22:04:51 +00:00
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: ${{ matrix.info.target }}
|
|
|
|
|
|
|
|
- name: Set up Rust toolchain (non-GitHub container)
|
|
|
|
if: matrix.info.container != ''
|
2022-10-20 10:24:04 +00:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs --output rustup.sh
|
|
|
|
sh rustup.sh --default-toolchain stable -y
|
|
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
2022-06-02 09:10:17 +00:00
|
|
|
|
|
|
|
- name: Enable Rust cache
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
key: ${{ matrix.info.target }}
|
|
|
|
|
|
|
|
- name: Build
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: ClementTsang/cargo-action@v0.0.3
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release --verbose --locked --target=${{ matrix.info.target }} --features deploy
|
|
|
|
use-cross: ${{ matrix.info.cross }}
|
2022-07-16 04:34:18 +00:00
|
|
|
cross-version: 0.2.4
|
2022-06-02 09:10:17 +00:00
|
|
|
|
2022-08-30 22:25:16 +00:00
|
|
|
- name: Move automatically generated completion/manpage
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mv "$COMPLETION_DIR" completion
|
|
|
|
mv "$MANPAGE_DIR" manpage
|
|
|
|
|
2022-06-02 09:10:17 +00:00
|
|
|
- name: Bundle release and completion (Windows)
|
|
|
|
if: matrix.info.os == 'windows-2019'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cp target/${{ matrix.info.target }}/release/btm.exe btm.exe
|
|
|
|
7z a bottom_${{ matrix.info.target }}.zip "btm.exe"
|
|
|
|
7z a bottom_${{ matrix.info.target }}.zip "completion"
|
|
|
|
echo "ASSET=bottom_${{ matrix.info.target }}.zip" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Bundle release and completion (Linux and macOS)
|
|
|
|
if: matrix.info.os != 'windows-2019'
|
|
|
|
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
|
|
|
|
|
|
|
|
- name: Create release directory for artifact, move file
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir release
|
|
|
|
mv ${{ env.ASSET }} release/
|
|
|
|
|
|
|
|
- name: Compress completion files (Linux x86-64 GNU)
|
|
|
|
if: matrix.info.target == 'x86_64-unknown-linux-gnu' && matrix.info.container == ''
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
tar -C ./completion -czvf completion.tar.gz .
|
|
|
|
mv completion.tar.gz release/
|
|
|
|
|
|
|
|
- name: Compress manpage files (Linux x86-64 GNU)
|
|
|
|
if: matrix.info.target == 'x86_64-unknown-linux-gnu' && matrix.info.container == ''
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
gzip ./manpage/btm.1
|
|
|
|
tar -C ./manpage -czvf manpage.tar.gz .
|
|
|
|
mv manpage.tar.gz release/
|
|
|
|
|
|
|
|
- name: Save release as artifact
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
retention-days: 3
|
|
|
|
name: release
|
|
|
|
path: release
|
|
|
|
|
2022-08-30 22:25:16 +00:00
|
|
|
# If I add more shared cleanup stuff in the future, I should move to a separate script, perhaps.
|
|
|
|
- name: Delete automatically generated completion/manpage to not cache
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
rm -r ./target/tmp/bottom/
|
|
|
|
|
2022-06-02 09:10:17 +00:00
|
|
|
build-msi:
|
|
|
|
name: "Build MSI installer"
|
|
|
|
runs-on: "windows-2019"
|
|
|
|
env:
|
2022-08-30 22:25:16 +00:00
|
|
|
BTM_GENERATE: ""
|
2022-06-02 09:10:17 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-06-02 19:05:43 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
|
|
|
- name: Install Net-Framework-Core
|
|
|
|
shell: powershell
|
|
|
|
run: Install-WindowsFeature Net-Framework-Core
|
|
|
|
|
|
|
|
- name: Install wixtoolset
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: crazy-max/ghaction-chocolatey@90deb87d9fbf0bb2f022b91e3bf11b4441cddda5 # 2.1.0
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
args: install -y wixtoolset
|
|
|
|
|
2022-06-02 22:04:51 +00:00
|
|
|
- name: Set up Rust toolchain
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: dtolnay/rust-toolchain@ba37adf8f94a7d9affce79bd3baff1b9e3189c33 # https://github.com/dtolnay/rust-toolchain/commit/ba37adf8f94a7d9affce79bd3baff1b9e3189c33
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
|
|
|
|
- name: Enable Rust cache
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
key: x86_64-pc-windows-msvc-msi
|
|
|
|
|
|
|
|
- name: Build MSI file
|
|
|
|
shell: powershell
|
|
|
|
run: |
|
|
|
|
cargo install cargo-wix --version 0.3.1 --locked
|
|
|
|
cargo wix init
|
|
|
|
cargo wix
|
|
|
|
|
|
|
|
- name: Create release directory for artifact, move files
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir release
|
|
|
|
mv bottom_x86_64_installer.msi release/
|
|
|
|
|
|
|
|
- name: Save release as artifact
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
retention-days: 3
|
|
|
|
name: release
|
|
|
|
path: release
|
|
|
|
|
2022-10-27 10:27:04 +00:00
|
|
|
build-cirrus:
|
|
|
|
name: "Build using Cirrus CI"
|
|
|
|
runs-on: "ubuntu-latest"
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
|
|
|
- name: Create release directory
|
|
|
|
run: |
|
|
|
|
mkdir -p release
|
|
|
|
|
|
|
|
- name: Execute Cirrus CI build script
|
|
|
|
env:
|
|
|
|
CIRRUS_KEY: ${{ secrets.CIRRUS_TOKEN }}
|
|
|
|
run: |
|
|
|
|
python ./deployment/cirrus/build.py "${{ github.ref_name }}" "release/" "${{ inputs.caller }}"
|
|
|
|
|
|
|
|
- name: Save release as artifact
|
|
|
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
|
|
|
with:
|
|
|
|
retention-days: 3
|
|
|
|
name: release
|
|
|
|
path: release
|
|
|
|
|
2022-06-02 09:10:17 +00:00
|
|
|
build-deb:
|
|
|
|
name: "Build Debian installers"
|
2022-08-13 16:14:51 +00:00
|
|
|
runs-on: "ubuntu-20.04"
|
2022-06-02 09:10:17 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
info:
|
|
|
|
- { 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",
|
|
|
|
}
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-06-02 19:05:43 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
2022-06-02 22:04:51 +00:00
|
|
|
- name: Set up Rust toolchain
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: dtolnay/rust-toolchain@ba37adf8f94a7d9affce79bd3baff1b9e3189c33 # https://github.com/dtolnay/rust-toolchain/commit/ba37adf8f94a7d9affce79bd3baff1b9e3189c33
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: ${{ matrix.info.target }}
|
|
|
|
|
2022-06-02 22:04:51 +00:00
|
|
|
- name: Enable Rust cache
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # 2.0.1
|
2022-06-02 09:10:17 +00:00
|
|
|
|
|
|
|
- name: Build
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: ClementTsang/cargo-action@v0.0.3
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release --locked --verbose --features deploy --target ${{ matrix.info.target }}
|
|
|
|
use-cross: ${{ matrix.info.cross }}
|
2022-07-16 04:34:18 +00:00
|
|
|
cross-version: 0.2.4
|
2022-06-02 09:10:17 +00:00
|
|
|
|
2022-08-30 22:25:16 +00:00
|
|
|
- name: Move automatically generated completion/manpage
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mv "$COMPLETION_DIR" completion
|
|
|
|
mv "$MANPAGE_DIR" manpage
|
|
|
|
|
2022-06-02 09:10:17 +00:00
|
|
|
- name: Zip manpage
|
|
|
|
run: |
|
|
|
|
gzip ./manpage/btm.1
|
|
|
|
|
|
|
|
- name: Build Debian release (x86-64)
|
|
|
|
if: matrix.info.cross == false
|
|
|
|
run: |
|
|
|
|
cargo install cargo-deb --version 1.38.0 --locked
|
|
|
|
cargo deb --no-build --target ${{ matrix.info.target }}
|
|
|
|
cp ./target/${{ matrix.info.target }}/debian/bottom_*.deb ./bottom_${{ matrix.info.target }}.deb
|
|
|
|
|
|
|
|
- name: Build Debian release (ARM)
|
|
|
|
if: matrix.info.cross == true
|
|
|
|
run: |
|
|
|
|
docker pull ${{ matrix.info.container }}
|
|
|
|
docker run -t --rm --mount type=bind,source="$(pwd)",target=/volume ${{ matrix.info.container }} "--variant ${{ matrix.info.dpkg }} --target ${{ matrix.info.target }} --no-build" "/volume"
|
|
|
|
cp ./target/${{ matrix.info.target }}/debian/bottom-*.deb ./bottom_${{ matrix.info.target }}.deb
|
|
|
|
|
|
|
|
- name: Test Debian release
|
|
|
|
run: |
|
|
|
|
dpkg -I ./bottom_${{ matrix.info.target }}.deb
|
|
|
|
dpkg -I ./bottom_${{ matrix.info.target }}.deb | grep ${{ matrix.info.dpkg }} && echo "Found correct architecture"
|
|
|
|
|
|
|
|
- name: Delete generated Debian folder
|
|
|
|
run: |
|
|
|
|
sudo chown $USER ./target/${{ matrix.info.target }}/debian/ 2>/dev/null || true
|
|
|
|
rm -r ./target/${{ matrix.info.target }}/debian/
|
|
|
|
|
|
|
|
- name: Create release directory for artifact, move file
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir release
|
|
|
|
mv bottom_${{ matrix.info.target }}.deb release/
|
|
|
|
|
|
|
|
- name: Save release as artifact
|
2022-10-20 10:24:04 +00:00
|
|
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
2022-06-02 09:10:17 +00:00
|
|
|
with:
|
|
|
|
retention-days: 3
|
|
|
|
name: release
|
|
|
|
path: release
|
2022-08-30 22:25:16 +00:00
|
|
|
|
|
|
|
- name: Delete automatically generated completion/manpage to not cache
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
rm -r ./target/tmp/bottom/
|