-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
151 lines (133 loc) · 4.48 KB
/
action.yml
File metadata and controls
151 lines (133 loc) · 4.48 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: "Hyperlight Workflow Setup"
description: "Common setup steps for GitHub workflows in the Hyperlight project"
inputs:
rust-toolchain:
description: "(Default: 1.86.0) Rust toolchain specification to install - see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification"
required: false
default: "1.86.0"
just-version:
description: '(Default: 1.41) Version of just to install.'
required: false
default: '1.41'
runs:
using: composite
steps:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ inputs.rust-toolchain }}
components: clippy, rustfmt
- uses: extractions/setup-just@v3
with:
just-version: ${{ inputs.just-version }}
### Linux setup ###
- name: Install clang-tools (Linux mariner)
if: ${{ (runner.os == 'Linux') }}
run: |
if command -v dnf > /dev/null 2>&1; then
if command -v clang > /dev/null 2>&1; then
echo "clang already installed"
else
sudo dnf remove clang -y || true
sudo dnf install clang -y
sudo dnf install clang-tools-extra -y
fi
if command -v lld > /dev/null 2>&1; then
echo "lld already installed"
else
sudo dnf remove lld -y || true
sudo dnf install lld -y
fi
clang --version
ld.lld --version
fi
shell: bash
- name: Install clang-tools (Linux ubuntu)
if: ${{ (runner.os == 'Linux') }}
run: |
if command -v apt > /dev/null 2>&1; then
if [ -d "/usr/lib/llvm-18" ]; then
echo "clang 18 and llvm 18 already installed"
else
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 18 clang clang-tools-extra
fi
if [ -f /usr/lib/llvm-18/bin/clang ]; then
if [ ! -L /usr/bin/clang ]; then
sudo ln -s /usr/lib/llvm-18/bin/clang /usr/bin/clang
else
echo "clang already linked"
fi
else
echo "Error: /usr/lib/llvm-18/bin/clang does not exist."
exit 1
fi
if [ -f /usr/lib/llvm-18/bin/ld.lld ]; then
if [ ! -L /usr/bin/ld.lld ]; then
sudo ln -s /usr/lib/llvm-18/bin/ld.lld /usr/bin/ld.lld
else
echo "ld.lld already linked"
fi
else
echo "Error: /usr/lib/llvm-18/bin/ld.lld does not exist."
exit 1
fi
clang --version
ld.lld --version
fi
shell: bash
# This is needed to build the rust guests
- name: Install x86_64-unknown-none target
if: ${{ (runner.os == 'Linux') }}
run: |
rustup target add x86_64-unknown-none
shell: bash
# We do this in case there is toolchain skew between repos
- name: Install older rust toolchain(s)
if: ${{ (runner.os == 'Linux') }}
run: |
rustup toolchain install 1.81.0
rustup toolchain install 1.85.0
shell: bash
- name: Set up env vars (Linux)
if: ${{ (runner.os == 'Linux') }}
run: |
set -x
if command -v dnf > /dev/null 2>&1; then
echo "Detected mariner / hyperv"
ls -al /dev/mshv
else
echo "Detected Ubuntu / kvm"
sudo ls -al /dev/kvm
fi
whoami
groups
echo "RUST_BACKTRACE=full" >> $GITHUB_ENV
shell: bash
### Windows setup ###
- name: Enable WHP on Windows
if: ${{ (runner.os == 'Windows') }}
run: Enable-WindowsOptionalFeature -Online -FeatureName HyperVisorPlatform
shell: pwsh
- name: Install x86_64-pc-windows-msvc target (Windows)
if: ${{ (runner.os == 'Windows') }}
run: |
rustup target add x86_64-pc-windows-msvc
shell: pwsh
- name: Install x86_64-unknown-none target (Windows)
if: ${{ (runner.os == 'Windows') }}
run: |
rustup target add x86_64-unknown-none
shell: pwsh
- name: Install older rust toolchain(s) (Windows)
if: ${{ (runner.os == 'Windows') }}
run: |
rustup toolchain install 1.81.0
rustup toolchain install 1.85.0
shell: pwsh
- name: Set up env vars (Windows)
if: ${{ (runner.os == 'Windows') }}
run: |
echo "RUST_BACKTRACE=full" >> $GITHUB_ENV
shell: pwsh