-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
183 lines (155 loc) · 5.26 KB
/
ci-archlinux.yml
File metadata and controls
183 lines (155 loc) · 5.26 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
name: CI-Archlinux
permissions: {}
on:
workflow_call:
inputs:
release_commit:
required: true
type: string
release_version:
required: true
type: string
jobs:
build_archlinux:
name: Archlinux
env:
_use_cuda: true
_run_unit_tests: true
_support_headless_testing: true
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ inputs.release_version }}
CLONE_URL: ${{ github.event.repository.clone_url }}
COMMIT: ${{ inputs.release_commit }}
permissions:
contents: read
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:base-devel
options: --cpus 4 --memory 8g
steps:
- name: Update keyring
shell: bash
run: |
# Update keyring to avoid signature errors, and update system
pacman -Syy --disable-download-timeout --needed --noconfirm \
archlinux-keyring
pacman -Syu --disable-download-timeout --noconfirm
pacman -Scc --noconfirm
- name: Setup builder user
shell: bash
run: |
# arch prevents running makepkg as root
useradd -m builder
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
- name: Patch build flags
shell: bash
run: |
# shellcheck disable=SC2016
sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf
- name: Install dependencies
shell: bash
run: |
pacman -Syu --disable-download-timeout --needed --noconfirm \
base-devel \
cmake \
cuda \
git \
namcap \
xorg-server-xvfb
pacman -Scc --noconfirm
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Fix workspace permissions
shell: bash
run: |
# Give builder user ownership of the workspace
chown -R builder:builder "${GITHUB_WORKSPACE}"
- name: Configure PKGBUILD
shell: bash
run: |
# Calculate sub_version
sub_version=""
if [[ "${BRANCH}" != "master" ]]; then
sub_version=".r${COMMIT}"
fi
# Configure PKGBUILD file (as root)
mkdir -p build
cd build
cmake \
-DSUNSHINE_CONFIGURE_ONLY=ON \
-DSUNSHINE_CONFIGURE_PKGBUILD=ON \
-DSUNSHINE_SUB_VERSION="${sub_version}" \
..
# Make sure builder can read from build directory
chmod -R a+rX "${GITHUB_WORKSPACE}/build"
- name: Prepare PKGBUILD Package
shell: bash
run: |
# Create pkg directory and move files (as root)
mkdir -p pkg
mv build/PKGBUILD pkg/
mv build/sunshine.install pkg/
# Change ownership to builder
chown -R builder:builder pkg
# Run makepkg as builder user
cd pkg
sudo -u builder makepkg --printsrcinfo | tee .SRCINFO
# create a PKGBUILD archive
cd ..
tar -czf sunshine.pkg.tar.gz -C pkg .
- name: Build PKGBUILD
env:
DISPLAY: :1
id: build
shell: bash
working-directory: pkg
run: |
# Add problem matcher
echo "::add-matcher::.github/matchers/gcc.json"
source /etc/profile # ensure cuda is in the PATH
# Run Xvfb for headless testing
Xvfb "${DISPLAY}" -screen 0 1024x768x24 &
# Check PKGBUILD
sudo -u builder namcap -i PKGBUILD
# Export PKGBUILD options so they're available to makepkg
export _use_cuda="${_use_cuda}"
export _run_unit_tests="${_run_unit_tests}"
export _support_headless_testing="${_support_headless_testing}"
# Build the package as builder user (pass through environment variables)
sudo -u builder env \
_use_cuda="${_use_cuda}" \
_run_unit_tests="${_run_unit_tests}" \
_support_headless_testing="${_support_headless_testing}" \
makepkg -si --noconfirm
# Remove debug package
rm -f sunshine-debug*.pkg.tar.zst
# Remove problem matcher
echo "::remove-matcher owner=gcc::"
- name: Upload coverage artifact
if: >-
always() &&
(steps.build.outcome == 'success' || steps.build.outcome == 'failure')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-Archlinux
path: |
pkg/src/build/coverage.xml
pkg/src/build/tests/test_results.xml
if-no-files-found: error
- name: Copy Artifacts
shell: bash
run: |
# create artifacts directory
mkdir -p artifacts
# Copy built packages to artifacts
cp pkg/sunshine*.pkg.tar.zst artifacts/
cp sunshine.pkg.tar.gz artifacts/
# List artifacts
ls -la artifacts/
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-Archlinux
path: artifacts/
if-no-files-found: error