-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (129 loc) · 5.86 KB
/
fedora38.yaml
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
name: Fedora 38
on:
push:
branches:
- main
paths:
- openzfs
- fedora38
workflow_dispatch:
inputs:
zfs-version:
required: true
kernel-version:
required: true
kernel-release:
required: true
kernel-headers-version:
required: true
kernel-headers-release:
required: true
permissions:
contents: write
jobs:
build:
name: Build RPMs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Check OpenZFS trigger
id: trigger-openzfs
run: |
set -x
if [ $(git diff --name-only HEAD^..HEAD|grep -e ^openzfs$) ]; then
echo '::set-output name=build::true'
else
echo '::set-output name=build::false'
fi
- name: Check Kernel trigger
id: trigger-kernel
run: |
set -x
if [ $(git diff --name-only HEAD^..HEAD|grep -e ^fedora38$) ]; then
echo '::set-output name=build::true'
else
echo '::set-output name=build::false'
fi
- name: Download OpenZFS source
run: |
source ./openzfs
curl -sLO https://github.com/openzfs/zfs/releases/download/zfs-${ZFS_VERSION}/zfs-${ZFS_VERSION}.tar.gz
tar xf zfs-${ZFS_VERSION}.tar.gz
- name: Pull conainer image
run: |
docker pull registry.fedoraproject.org/fedora:38
- name: Run conainer
run: |
source ./openzfs
docker run -d -v $(pwd)/zfs-${ZFS_VERSION}:/srv/zfs --name builder registry.fedoraproject.org/fedora:38 sleep 60m
- name: Update conainer
run: |
docker exec builder dnf -qy update
- name: Install kernel
run: |
source ./fedora38
docker exec builder dnf -y install\
https://kojipkgs.fedoraproject.org/packages/kernel/${KERNEL_VERSION}/${KERNEL_RELEASE}/x86_64/kernel-devel-${KERNEL_VERSION}-${KERNEL_RELEASE}.x86_64.rpm\
https://kojipkgs.fedoraproject.org/packages/kernel-headers/${KERNEL_HEADERS_VERSION}/${KERNEL_HEADERS_RELEASE}/x86_64/kernel-headers-${KERNEL_HEADERS_VERSION}-${KERNEL_HEADERS_RELEASE}.x86_64.rpm
- name: Install build dependencies
run: |
docker exec builder dnf -y install $(cat dependencies/fedora38)
- name: Add build user
run: |
docker exec builder useradd mockbuild
- name: Fix files ownership
run: |
docker exec builder chown -R mockbuild:mockbuild /srv/zfs
- name: Configure OpenZFS
run: |
docker exec -u mockbuild -w /srv/zfs builder ./configure
- name: Build utils RPMs
if: ${{ steps.trigger-openzfs.outputs.build == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
docker exec -u mockbuild -w /srv/zfs builder make -j1 rpm-utils
docker exec -w /srv/zfs builder bash -c "rm -f ./*.src.rpm"
- name: Build zfs-container RPM
if: ${{ steps.trigger-openzfs.outputs.build == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
source ./openzfs
sed -i "s/ZFS_VERSION/${ZFS_VERSION}/g" zfs-container.spec
docker cp zfs-container.spec builder:/home/mockbuild/zfs-container.spec
docker exec -u mockbuild -w /home/mockbuild builder rpmbuild -bb zfs-container.spec
docker exec -u mockbuild -w /home/mockbuild builder mv ./rpmbuild/RPMS/noarch/zfs-container-${ZFS_VERSION}-1.fc38.noarch.rpm /srv/zfs/
- name: Add utils release
if: ${{ steps.trigger-openzfs.outputs.build == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
source ./openzfs
source ./fedora38
gh release create -t "OpenZFS ${ZFS_VERSION}: Fedora 38" --target ${GITHUB_SHA} v${ZFS_VERSION}-fedora38 zfs-${ZFS_VERSION}/zfs*.rpm zfs-${ZFS_VERSION}/lib*.rpm zfs-${ZFS_VERSION}/python*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build kmod RPMs
if: ${{ steps.trigger-openzfs.outputs.build == 'true' || steps.trigger-kernel.outputs.build == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
source ./openzfs
source ./fedora38
docker exec -u mockbuild -w /srv/zfs builder make -j1 rpm-kmod
docker exec -w /srv/zfs builder bash -c "rm -f ./*.src.rpm"
- name: Build kernel-zfs RPM
if: ${{ steps.trigger-openzfs.outputs.build == 'true' || steps.trigger-kernel.outputs.build == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
source ./openzfs
source ./fedora38
KERNEL_RELEASE_SHORT=$(echo ${KERNEL_RELEASE}|sed 's/\.fc38//')
sed -i "s/ZFS_VERSION/${ZFS_VERSION}/g" kernel-zfs.spec
sed -i "s/KERNEL_VERSION/${KERNEL_VERSION}/g" kernel-zfs.spec
sed -i "s/KERNEL_RELEASE_SHORT/${KERNEL_RELEASE_SHORT}/g" kernel-zfs.spec
docker cp kernel-zfs.spec builder:/home/mockbuild/kernel-zfs.spec
docker exec -u mockbuild -w /home/mockbuild builder rpmbuild -bb kernel-zfs.spec
docker exec -u mockbuild -w /home/mockbuild builder mv ./rpmbuild/RPMS/noarch/kernel-zfs-${ZFS_VERSION}-${KERNEL_VERSION}-${KERNEL_RELEASE_SHORT}.fc38.noarch.rpm /srv/zfs/
- name: Add kmod release
if: ${{ steps.trigger-openzfs.outputs.build == 'true' || steps.trigger-kernel.outputs.build == 'true' || github.event_name == 'workflow_dispatch' }}
run: |
source ./openzfs
source ./fedora38
gh release create -t "OpenZFS ${ZFS_VERSION}: Fedora 38 ${KERNEL_VERSION}-${KERNEL_RELEASE}" --target ${GITHUB_SHA} v${ZFS_VERSION}-fedora38-${KERNEL_VERSION}-${KERNEL_RELEASE} zfs-${ZFS_VERSION}/kmod*.rpm zfs-${ZFS_VERSION}/zfs-kmod*.rpm zfs-${ZFS_VERSION}/kernel-zfs*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}