-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (130 loc) · 5.91 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
on: [push]
jobs:
test:
# Make sure that everything works on the newest Ubuntu.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
cache-all-crates: true
cache-on-failure: true
- 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
build:
# Applications linked against glibc only work on that version of glibc
# (or newer ones), so this is effectively the oldest version the release
# is going to run on.
# In theory, this should be the oldest supported version of Ubuntu
# according to <https://github.com/actions/runner-images#available-images>,
# but Ubuntu 20.04 has OpenSSL 1.1 which newer ones don't have, so we need
# to go with at least 22.04.
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
cache-all-crates: true
cache-on-failure: true
- name: Build for i686
uses: clechasseur/rs-cargo@v2
with:
command: build
args: --package towboot --target i686-unknown-uefi
- name: Upload i686 artifact
uses: actions/upload-artifact@v4
with:
name: towboot-debug-i686.efi
path: target/i686-unknown-uefi/debug/towboot.efi
- name: Build for x86_64
uses: clechasseur/rs-cargo@v2
with:
command: build
args: --package towboot --target x86_64-unknown-uefi
- name: Upload x86_64 artifact
uses: actions/upload-artifact@v4
with:
name: towboot-debug-x86_64.efi
path: target/x86_64-unknown-uefi/debug/towboot.efi
- 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
- name: Upload x86_64-linux artifact
uses: actions/upload-artifact@v4
with:
name: towbootctl-debug-x86_64-linux
path: target/x86_64-unknown-linux-gnu/debug/towbootctl
- name: Install compiler for x86_64-windows
run: sudo apt-get update && sudo apt-get install gcc-mingw-w64-x86-64-win32
- 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
- name: Upload x86_64-windows artifact
uses: actions/upload-artifact@v4
with:
name: towbootctl-debug-x86_64-windows.exe
path: target/x86_64-pc-windows-gnu/debug/towbootctl.exe
build-mac:
# 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: test
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: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-${{ hashFiles('**/Cargo.lock') }}
cache-all-crates: true
cache-on-failure: true
- 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
- name: Build towbootctl for aarch64-apple
uses: clechasseur/rs-cargo@v2
with:
command: build
args: --package towbootctl --target aarch64-apple-darwin --features=binary
- name: Build universal binary for macOS
run: mkdir -p target/apple-darwin/debug && lipo -create -output target/apple-darwin/debug/towbootctl target/x86_64-apple-darwin/debug/towbootctl target/aarch64-apple-darwin/debug/towbootctl
- name: Upload apple artifact
uses: actions/upload-artifact@v4
with:
name: towbootctl-debug-macos
path: target/apple-darwin/debug/towbootctl