CI: Disable cache for release #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
tags: 'v*' | |
jobs: | |
test: | |
# The 64-bit tests don't work on Ubuntu 20.04. | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install qemu | |
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-system-x86 | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ | |
- name: Run tests | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: test | |
args: --package tests --release | |
release: | |
# This is the oldest supported version of Ubuntu according to | |
# <https://github.com/actions/runner-images#available-images>. This is | |
# because applications linked against glibc only work on that version of | |
# glibc (or newer ones). | |
runs-on: ubuntu-20.04 | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build for i686 | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: build | |
args: --package towboot --target i686-unknown-uefi --release | |
- name: Build for x86_64 | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: build | |
args: --package towboot --target x86_64-unknown-uefi --release | |
- name: Build towbootctl for x86_64-linux | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: build | |
args: --package towbootctl --target x86_64-unknown-linux-gnu --features=binary --release | |
- name: Install compiler for x86_64-windows | |
run: sudo apt-get update && sudo apt-get install gcc-mingw-w64-x86-64 | |
- name: Install Rust for x86_64-windows | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: x86_64-pc-windows-gnu | |
- name: Build towbootctl for x86_64-windows | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: build | |
args: --package towbootctl --target x86_64-pc-windows-gnu --features=binary --release | |
- name: Rename files (1) | |
run: cp target/i686-unknown-uefi/release/towboot.efi towboot-$(git describe --always --tags)-i686.efi | |
- name: Rename files (2) | |
run: cp target/x86_64-unknown-uefi/release/towboot.efi towboot-$(git describe --always --tags)-x86_64.efi | |
- name: Rename files (2) | |
run: cp target/x86_64-unknown-linux-gnu/release/towbootctl towbootctl-$(git describe --always --tags)-x86_64-linux | |
- name: Rename files (3) | |
run: cp target/x86_64-pc-windows-gnu/release/towbootctl.exe towbootctl-$(git describe --always --tags)-x86_64-windows.exe | |
- name: Publish release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
towboot-*-i686.efi | |
towboot-*-x86_64.efi | |
towbootctl-*-x86_64-linux | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release-macos: | |
# We could cross-compile from Linux instead, | |
# but we'd still need the Xcode Command Line Tools. | |
# Downloading them requires logging in with an Apple ID, | |
# which is not possible in the CI. The macOS runners include it. | |
runs-on: macos-latest | |
needs: release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust for x86_64-apple and aarch64-apple | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: x86_64-apple-darwin, aarch64-apple-darwin | |
- name: Build towbootctl for x86_64-apple | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: build | |
args: --package towbootctl --target x86_64-apple-darwin --features=binary --release | |
- name: Build towbootctl for aarch64-apple | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: build | |
args: --package towbootctl --target aarch64-apple-darwin --features=binary --release | |
- name: Build universal binary for macOS | |
run: mkdir -p target/apple-darwin/release && lipo -create -output target/apple-darwin/release/towbootctl target/x86_64-apple-darwin/release/towbootctl target/aarch64-apple-darwin/release/towbootctl | |
- name: Upload macOS binary to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/apple-darwin/release/towbootctl | |
asset_name: towbootctl-$(git describe --always --tags)-macos | |
tag: ${{ github.ref }} |