forked from kamailio/kamailio
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (174 loc) · 5.46 KB
/
rpm.yml
File metadata and controls
188 lines (174 loc) · 5.46 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
184
185
186
187
188
---
name: build_rpm
'on':
schedule:
- cron: '41 6 * * 0'
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# is required nightly build?
# More info at https://stackoverflow.com/questions/63014786/how-to-schedule-a-github-actions-nightly-build-but-run-it-only-when-there-where
# looking commit_id of the last successful daily build
check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: octokit/request-action@v2.x
id: check_last_run
with:
route: GET /repos/{owner}/{repo}/actions/workflows/rpm.yml/runs?per_page=1&status=success
owner: ${{ github.repository_owner }}
repo: kamailio
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Show last execution info
run: |
echo "Last daily build: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}"
outputs:
last_sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}
build:
needs: [check]
if: needs.check.outputs.last_sha != github.sha
strategy:
matrix:
os:
- alma-10
- centos-10
- rhel-10
- rocky-10
- alma-9
- centos-9
- rhel-9
- rocky-9
- alma-8
- centos-8
- rhel-8
- rocky-8
arch:
- x86_64
- aarch64
- ppc64le
- s390x
include:
# setting image platform
- platform: linux/amd64
arch: x86_64
- platform: linux/arm64/v8
arch: aarch64
- platform: linux/ppc64le
arch: ppc64le
- platform: linux/s390x
arch: s390x
# setting runner
- runner: ubuntu-latest
- runner: ubuntu-24.04-arm
arch: aarch64
exclude:
# We does build for ppc64le because RedHat does not have CodeReady repo for ppc64le.
# more info at https://access.redhat.com/solutions/5500841
- os: rhel-10
arch: ppc64le
- os: rhel-9
arch: ppc64le
- os: rhel-8
arch: ppc64le
# also Codeready repo does not exist for rhel-9 and 10, s390x arch
- os: rhel-10
arch: s390x
- os: rhel-9
arch: s390x
# s390x arch does not exist for rhel 8, centos 8, rocky 8. For alma-8 cannot be compiled libphonenumber
- os: alma-8
arch: s390x
- os: centos-8
arch: s390x
- os: rhel-8
arch: s390x
- os: rocky-8
arch: s390x
# ppc64le arch does not exist for rocky 8
- os: rocky-8
arch: ppc64le
runs-on: ${{ matrix.runner }}
permissions:
contents: write
steps:
- name: checkout sources
uses: actions/checkout@v6
- name: print commit info
id: init
run: |
echo ${{ github.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: "! contains(fromJson('[\"x86_64\", \"aarch64\"]'), matrix.arch)"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build rpm files
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/sergey-safarov/pkg-kamailio-docker:${{ matrix.os }}
options: --platform ${{ matrix.platform }} -v ${{ github.workspace }}:/usr/src/kamailio
run: |
cd /usr/src/kamailio
make cfg
make -C pkg/kamailio src.rpm
rpmbuild --undefine=__cmake_in_source_build -ra /usr/src/kamailio/kamailio*.src.rpm
os_folder=$(echo "${{ matrix.os }}" | sed -e 's|-|/|')
ref_folder=$(echo "${{ github.ref_name }}" | sed -E -e 's/([0-9]+.[0-9]+).*/\1/')
mkdir -p RPMS/${os_folder}/${ref_folder}/${{ github.ref_name }}/${{ matrix.arch }}
cp -R /deps RPMS/${os_folder}/${ref_folder}/${{ github.ref_name }}/${{ matrix.arch }}
mv ~/rpmbuild/SRPMS/* RPMS/${os_folder}/${ref_folder}/${{ github.ref_name }}/${{ matrix.arch }}
mv ~/rpmbuild/RPMS/*/* RPMS/${os_folder}/${ref_folder}/${{ github.ref_name }}/${{ matrix.arch }}
- name: Push artifacts
uses: actions/upload-artifact@v6
with:
name: kamailio-${{ matrix.os }}-${{ github.ref_name }}-${{ matrix.arch }}.rpm
path: |
RPMS/*
release:
name: Relase rpm files
if: github.ref_type == 'tag'
strategy:
max-parallel: 1
matrix:
os:
- alma-10
- centos-10
- rhel-10
- rocky-10
- alma-9
- centos-9
- rhel-9
- rocky-9
- alma-8
- centos-8
- rhel-8
- rocky-8
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifact images
uses: actions/download-artifact@v7
with:
pattern: kamailio-${{ matrix.os }}-${{ github.ref_name }}-*.rpm
path: ${{ runner.temp }}/repo
merge-multiple: true
- name: create archive
run: |
tar czf rpms-${{ matrix.os }}-${{ github.ref_name }}.tar.gz --directory=${{ runner.temp }} repo
ls -l rpms-${{ matrix.os }}-${{ github.ref_name }}.tar.gz
- name: upload artifacts
uses: softprops/action-gh-release@v2
with:
files: |
rpms-${{ matrix.os }}-${{ github.ref_name }}.tar.gz