bottom/.github/workflows/nightly.yml

390 lines
12 KiB
YAML
Raw Normal View History

2021-02-18 06:18:04 +00:00
# Creates nightly deployment builds for main targets. Note this does not cover package distribution channels,
# such as choco.
2021-02-18 06:18:04 +00:00
2021-02-18 06:18:53 +00:00
name: nightly
2021-02-18 06:18:04 +00:00
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
isMock:
description: "Replace to trigger a non-mock run."
default: "mock"
required: false
2021-02-18 06:18:04 +00:00
jobs:
initialize-job:
name: initialize-job
2021-02-18 06:18:04 +00:00
runs-on: ubuntu-latest
steps:
- name: Check if mock
run: |
echo "${{ github.event.inputs.isMock }}";
if [[ -z "${{ github.event.inputs.isMock }}" ]]; then
echo "This is a scheduled nightly run."
elif [[ "${{ github.event.inputs.isMock }}" == "mock" ]]; then
echo "This is a mock run."
else
echo "This is NOT a mock run. Watch for the generated files!"
fi
2021-02-18 06:18:04 +00:00
- name: Save version number to artifact
run: echo "nightly" > release-version
2021-02-18 06:18:04 +00:00
- name: Upload release-version as artifact
uses: actions/upload-artifact@v2
2021-02-18 06:18:04 +00:00
with:
retention-days: 1
name: release-version
path: release-version
2021-02-18 06:18:04 +00:00
build-release:
name: build-release
needs: [initialize-job]
2021-02-18 06:18:04 +00:00
runs-on: ${{ matrix.triple.os }}
container: ${{ matrix.triple.container }}
2021-02-18 06:18:04 +00:00
env:
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
triple:
# Standard x86-64 stuff, stable
- {
os: "ubuntu-18.04",
2021-02-18 06:18:04 +00:00
target: "x86_64-unknown-linux-gnu",
cross: false,
strip: true,
2021-02-18 06:18:04 +00:00
}
- {
os: "ubuntu-18.04",
target: "x86_64-unknown-linux-gnu",
cross: false,
container: quay.io/pypa/manylinux2014_x86_64,
suffix: "2-17",
strip: true,
}
2021-02-18 06:18:04 +00:00
- {
os: "ubuntu-18.04",
2021-02-18 06:18:04 +00:00
target: "i686-unknown-linux-gnu",
cross: true,
strip: true,
2021-02-18 06:18:04 +00:00
}
- {
os: "ubuntu-18.04",
target: "x86_64-unknown-linux-musl",
cross: false,
strip: true,
2021-02-18 06:18:04 +00:00
}
- {
os: "ubuntu-18.04",
target: "i686-unknown-linux-musl",
cross: true,
strip: true,
}
- {
os: "macOS-latest",
target: "x86_64-apple-darwin",
cross: false,
strip: true,
2021-02-18 06:18:04 +00:00
}
- {
os: "windows-2019",
target: "x86_64-pc-windows-msvc",
cross: false,
}
- { os: "windows-2019", target: "i686-pc-windows-msvc", cross: false }
2021-02-18 06:18:04 +00:00
- {
os: "windows-2019",
target: "x86_64-pc-windows-gnu",
cross: false,
}
# aarch64
- {
os: "ubuntu-18.04",
target: "aarch64-unknown-linux-gnu",
cross: true,
}
# armv7
- {
os: "ubuntu-18.04",
target: "armv7-unknown-linux-gnueabihf",
cross: true,
}
# PowerPC 64 LE
- {
os: "ubuntu-18.04",
target: "powerpc64le-unknown-linux-gnu",
cross: true,
}
# Risc-V 64gc
- {
os: "ubuntu-18.04",
target: "riscv64gc-unknown-linux-gnu",
cross: true,
}
2021-02-18 06:18:04 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install toolchain
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746 # https://github.com/actions-rs/toolchain/commit/88dc2356392166efad76775c878094f4e83ff746
2021-02-18 06:18:04 +00:00
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.triple.target }}
- uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # 1.3.0
with:
key: ${{ matrix.triple.target }}
2021-02-18 06:18:04 +00:00
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --verbose --target=${{ matrix.triple.target }} --features "battery"
2021-02-18 06:18:04 +00:00
use-cross: ${{ matrix.triple.cross }}
- name: Move autocomplete to working directory
shell: bash
run: |
mkdir completion
cp -r ./target/${{ matrix.triple.target }}/release/build/bottom-*/out/. completion
2021-02-18 06:18:04 +00:00
- name: Strip release binary (macOS or Linux x86-64/i686)
if: matrix.triple.strip == true
2021-02-18 06:18:04 +00:00
run: |
strip target/${{ matrix.triple.target }}/release/btm
# TODO: Strip ARM
- name: Bundle release and completion (Windows)
if: matrix.triple.os == 'windows-2019'
shell: bash
run: |
cp target/${{ matrix.triple.target }}/release/btm.exe btm.exe
7z a bottom_${{ matrix.triple.target }}.zip "btm.exe"
7z a bottom_${{ matrix.triple.target }}.zip "completion"
2021-02-18 06:18:04 +00:00
echo "ASSET=bottom_${{ matrix.triple.target }}.zip" >> $GITHUB_ENV
- name: Bundle release and completion (Linux and macOS)
if: matrix.triple.os != 'windows-2019'
shell: bash
run: |
cp target/${{ matrix.triple.target }}/release/btm ./btm
tar -czvf bottom_${{ matrix.triple.target }}${{ matrix.triple.suffix }}.tar.gz btm completion
echo "ASSET=bottom_${{ matrix.triple.target }}${{ matrix.triple.suffix }}.tar.gz" >> $GITHUB_ENV
2021-02-18 06:18:04 +00:00
- name: Create release directory for artifact, move file
shell: bash
run: |
mkdir release
mv ${{ env.ASSET }} release/
2021-02-18 06:18:04 +00:00
- name: Compress completion files (Linux x86-64 GNU)
if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == ''
shell: bash
run: |
tar -C ./completion -czvf completion.tar.gz .
mv completion.tar.gz release/
- name: Save release files as artifacts
uses: actions/upload-artifact@v2
with:
retention-days: 1
name: release
path: release
build-msi:
name: build-msi
needs: [initialize-job]
runs-on: "windows-2019"
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Get release version
uses: actions/download-artifact@v2
with:
name: release-version
path: release-version
- name: Set release version
shell: bash
run: |
release_version="$(cat ./release-version/release-version)"
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- name: Validate release version
run: |
echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Install Net-Framework-Core
shell: powershell
run: Install-WindowsFeature Net-Framework-Core
- name: Install wixtoolset
uses: crazy-max/ghaction-chocolatey@87d06bbbd2cfb1835f1820042d356aef4875fb5f # 1.6.0
with:
args: install -y wixtoolset
- name: Install toolchain
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746 # https://github.com/actions-rs/toolchain/commit/88dc2356392166efad76775c878094f4e83ff746
with:
profile: minimal
toolchain: stable
override: true
target: x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # 1.3.0
with:
key: x86_64-pc-windows-msvc-msi
- name: Build msi file
2021-02-18 06:18:04 +00:00
shell: powershell
run: |
cargo install cargo-wix --version 0.3.1 --locked
2021-02-18 06:18:04 +00:00
cargo wix init
cargo wix
- name: Create release directory for artifact, move file
shell: bash
run: |
mkdir release
mv bottom_x86_64_installer.msi release/
- name: Save msi file as artifacts
uses: actions/upload-artifact@v2
2021-02-18 06:18:04 +00:00
with:
retention-days: 1
name: release
path: release
2021-02-18 06:18:04 +00:00
build-deb:
name: build-deb
needs: [initialize-job]
runs-on: "ubuntu-18.04"
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Get release version
uses: actions/download-artifact@v2
with:
name: release-version
path: release-version
- name: Set release version
shell: bash
run: |
release_version="$(cat ./release-version/release-version)"
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- name: Validate release version
run: |
echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Install toolchain
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746 # https://github.com/actions-rs/toolchain/commit/88dc2356392166efad76775c878094f4e83ff746
with:
profile: minimal
toolchain: stable
override: true
target: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # 1.3.0
with:
key: x86_64-unknown-linux-gnu-deb
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --verbose --features "battery"
- name: Move autocomplete to working directory
shell: bash
run: |
mkdir completion
cp -r ./target/release/build/bottom-*/out/. completion
- name: Build Debian release
2021-02-18 06:18:04 +00:00
run: |
cargo install cargo-deb --version 1.34.0 --locked
cargo deb --no-build
2021-02-18 06:18:04 +00:00
cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb
- name: Test Debian release
run: sudo dpkg -i ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb
- name: Create release directory for artifact, move file
shell: bash
run: |
mkdir release
mv bottom_${{ env.RELEASE_VERSION }}_amd64.deb release/
- name: Save Debian file as artifacts
uses: actions/upload-artifact@v2
with:
retention-days: 1
name: release
path: release
upload-release:
name: upload-release
runs-on: ubuntu-latest
needs: [build-release, build-deb, build-msi]
steps:
- name: Get release artifacts
uses: actions/download-artifact@v2
with:
name: release
path: release
- name: Print out all release files
run: |
echo "Generated $(ls ./release | wc -l) files:"
ls ./release
- name: Delete tag and release
uses: dev-drprasad/delete-tag-and-release@085c6969f18bad0de1b9f3fe6692a3cd01f64fe5 # 0.2.0
if: github.event.inputs.isMock != 'mock'
with:
delete_release: true
tag_name: nightly
2021-02-18 06:18:04 +00:00
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'
- name: Upload all saved release files if not mock
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a # 0.1.14
if: github.event.inputs.isMock != 'mock'
2021-02-18 06:18:04 +00:00
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
tag_name: "nightly"
draft: false
fail_on_unmatched_files: true
files: |
./release/*