-
Notifications
You must be signed in to change notification settings - Fork 3
127 lines (94 loc) · 2.91 KB
/
sh-build-iso-rocm.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
name: Build ISO on selfhosted runner (ROCm, normal)
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
vm-start:
if: always()
runs-on: ubuntu-latest
steps:
- name: Save ssh configuration
run: |
# Create ssh directory
mkdir ~/.ssh
# Save ssh config
echo "${{ secrets.SSH_CONFIG }}" | base64 -d > ~/.ssh/config
# Save ssh known hosts
echo "${{ secrets.SSH_KNOWN_HOSTS }}" | base64 -d > ~/.ssh/known_hosts
# Save ssh private key
echo "${{ secrets.SSH_PRIVATE_KEY }}" | base64 -d > /tmp/private.key
# Fix permissions for private key
chmod 600 /tmp/private.key
- name: Start Github Actions Runner VM
run: |
ssh runner "virsh start GithubActions"
build:
needs: vm-start
runs-on: self-hosted
steps:
- name: Remove previous artifacts
run: |
sudo rm -fr out/
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build image
uses: addnab/docker-run-action@v3
with:
image: archlinux:latest
options: --privileged --rm --volume ${{ github.workspace }}:/workspace
run: |
# Exit on error
set -eu
# Enter project directory
pushd /workspace
# Install dependencies
.ci/dependencies.sh
# Patch mkarchiso
.ci/mkarchiso.sh
# Configure to use ROCm
.ci/configure.py rocm normal
popd
# Build image
mkarchiso -v -m iso -w /_work -o /workspace/out /workspace
- name: Create summary
run: |
# Exit on error
set -eu
# Print checksums to summary
sha256sum out/* > "$GITHUB_STEP_SUMMARY"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: archiso-output
path: out/
vm-stop:
if: always()
needs: build
runs-on: ubuntu-latest
steps:
- name: Save ssh configuration
run: |
# Create ssh directory
mkdir ~/.ssh
# Save ssh config
echo "${{ secrets.SSH_CONFIG }}" | base64 -d > ~/.ssh/config
# Save ssh known hosts
echo "${{ secrets.SSH_KNOWN_HOSTS }}" | base64 -d > ~/.ssh/known_hosts
# Save ssh private key
echo "${{ secrets.SSH_PRIVATE_KEY }}" | base64 -d > /tmp/private.key
# Fix permissions for private key
chmod 600 /tmp/private.key
- name: Stop Github Actions Runner VM
run: |
# Invoke regular shutdown
ssh runner "virsh shutdown GithubActions"
# Wait 2 minutes
sleep 120
# Force terminate if needed
ssh runner "virsh destroy GithubActions" || true