-
Notifications
You must be signed in to change notification settings - Fork 17
168 lines (153 loc) · 5.82 KB
/
ci.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
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
---
#
# Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
name: CI/CD pipeline for rshim - deb and rpm for amd64 and arm64
on:
push:
branches:
- '**'
tags:
- '*'
permissions:
contents: write
jobs:
build-and-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- name: Install dependencies (for .deb)
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential debhelper devscripts fakeroot git \
libpci-dev libusb-1.0-0-dev libfuse-dev pkg-config
- name: Prepare release body
id: changelog
run: |
body=$(./scripts/get-changelog debian/changelog)
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "${body}" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create source tarball
run: |
[ -d dist ] || mkdir -p dist
version="$(./scripts/get-ver)"
tarball="rshim-src-${version}.tar.gz"
git archive --format=tar.gz -o "$tarball" HEAD
mv -v "$tarball" dist/
ls -lh dist
- name: Build & Test x86_64 .deb package
run: |
version="$(./scripts/get-ver)"
sed -i "1s/(\(.*\))/($version)/" debian/changelog
DEB_BUILD_OPTIONS="nocheck nostrip" dpkg-buildpackage \
-us -uc -a amd64
mkdir -p dist
mv -v ../*.deb dist/
ls -lh dist
sudo dpkg -i dist/*.deb || sudo apt-get -f install -y
echo "Running rshim --version:"
rshim --version
- name: Capture UID/GID for Docker
id: uidgid
run: |
echo "HOST_UID=$(id -u)" >> $GITHUB_ENV
echo "HOST_GID=$(id -g)" >> $GITHUB_ENV
- name: Build & Test ARM64 .deb package in Docker
run: |
docker run --rm --privileged multiarch/qemu-user-static \
--reset -p yes
docker run --rm --platform linux/arm64 \
-e HOST_UID="${{ env.HOST_UID }}" \
-e HOST_GID="${{ env.HOST_GID }}" \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
arm64v8/ubuntu:22.04 \
/bin/bash -c "
apt-get update && \
apt-get install -y build-essential debhelper devscripts \
fakeroot gcc git libpci-dev libusb-1.0-0-dev libfuse-dev \
pkg-config && \
git config --global --add safe.directory /workspace && \
version=\$(/workspace/scripts/get-ver) && \
sed -i \"1s/(\(.*\))/(\$version)/\" \
/workspace/debian/changelog && \
mkdir -p /workspace/build && \
DEB_BUILD_OPTIONS='nocheck nostrip' dpkg-buildpackage \
-us -uc -a arm64 && \
mv -v ../*.deb /workspace/build/ && \
apt-get install -y libpci3 libusb-1.0-0 fuse || true && \
dpkg -i /workspace/build/*.deb || apt-get -f install -y && \
echo 'Running rshim --version:' && \
rshim --version && \
chown -R \$HOST_UID:\$HOST_GID /workspace
"
mkdir -p dist
mv -v build/*.deb dist/
ls -lh dist
- name: Build & Test x86_64 RPM using Rocky Linux
run: |
docker run --rm \
-e HOST_UID="${{ env.HOST_UID }}" \
-e HOST_GID="${{ env.HOST_GID }}" \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
quay.io/rockylinux/rockylinux:8 \
/bin/bash -c "
yum -y install gcc make rpm-build git autoconf automake \
libtool pkgconfig pciutils-devel libusb1-devel fuse-devel && \
git config --global --add safe.directory /workspace && \
ARCH=x86_64 ./scripts/build-rpm && \
yum localinstall -y /workspace/rpmbuild/RPMS/x86_64/*.rpm && \
echo 'Running rshim --version:' && \
rshim --version && \
chown -R \$HOST_UID:\$HOST_GID /workspace
"
mkdir -p dist
mv -v $(find rpmbuild/RPMS -name '*.rpm') dist/
ls -lh dist
- name: Build & Test arm64 RPM using Rocky Linux
run: |
docker run --rm --privileged multiarch/qemu-user-static \
--reset -p yes
docker run --rm --platform linux/arm64 \
-e HOST_UID="${{ env.HOST_UID }}" \
-e HOST_GID="${{ env.HOST_GID }}" \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
quay.io/rockylinux/rockylinux:8 \
/bin/bash -c "
yum -y install gcc make rpm-build git autoconf automake \
libtool pkgconfig pciutils-devel libusb1-devel fuse-devel && \
git config --global --add safe.directory /workspace && \
ARCH=aarch64 ./scripts/build-rpm && \
yum localinstall -y /workspace/rpmbuild/RPMS/aarch64/*.rpm && \
echo 'Running rshim --version:' && \
rshim --version && \
chown -R \$HOST_UID:\$HOST_GID /workspace
"
mkdir -p dist
mv -v $(find rpmbuild/RPMS -name '*.rpm') dist/
ls -lh dist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: rshim-packages
path: dist/*
- name: Create GitHub Release
if: startsWith(github.ref_name, 'rshim-')
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.body }}
draft: false
prerelease: false
artifacts: |
dist/*