-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (123 loc) · 4.92 KB
/
main.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name : Main pipeline
on:
workflow_dispatch:
push:
branches:
- main
- ci/create-rpm-package
pull_request:
env:
os: RHEL
os_version: 93
jobs:
parsing:
runs-on: ubuntu-latest
outputs:
compvers: ${{ steps.params.outputs.compvers }}
compname: ${{ steps.params.outputs.compname }}
comparch: ${{ steps.params.outputs.comparch }}
steps:
- uses: actions/checkout@v4
with:
fetch-tags: 'true'
- name: Setup for alumet
run: |
mkdir -p alumet
- name: Checkout alumet
uses: actions/checkout@v4
with:
repository: alumet-dev/alumet
path: "alumet"
- name: Parse alumet version
id: params
run: |
compname=$(awk '/Name/ { print $2 }' ./specs/alumet.spec)
comparch=$(awk '/BuildArch/ { print $2 }' ./specs/alumet.spec)
cd alumet/app-agent/
cargo generate-lockfile
compvers=$(cargo pkgid | cut -d "#" -f2)
echo "compvers=$compvers" >> $GITHUB_OUTPUT
echo "compname=$compname" >> $GITHUB_OUTPUT
echo "comparch=$comparch" >> $GITHUB_OUTPUT
echo "Pipeline will build [$compname] in version [$compvers] for the architecture [$comparch]" >> $GITHUB_STEP_SUMMARY
packaging:
runs-on: ubuntu-latest
needs:
- parsing
strategy:
fail-fast: false
matrix:
os: ["fedora:40", "fedora:41", "fedora:42", "quay.io/centos/centos:stream8", "quay.io/centos/centos:stream9"]
env:
name: ${{ needs.parsing.outputs.compname }}
compvers: ${{ needs.parsing.outputs.compvers }}
arch: ${{ needs.parsing.outputs.comparch }}
container:
image: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Export good OS version
run: |
echo "OS=$(echo ${{ matrix.os }} | sed 's/:/-/g')" >> $GITHUB_ENV
- name: Install RPM on Fedora
if: contains(matrix.os, 'fedora')
run: |
sudo dnf install rust cargo -y
export PATH=$PATH:$HOME/.cargo/bin/
sudo dnf install rpm-build rpmdevtools -y
sudo dnf install cargo-rpm-macros -y
sudo dnf install openssl-devel -y
- name: Install RPM on Centos
if: contains(matrix.os, 'centos')
run: |
yum install rust cargo -y
export PATH=$PATH:$HOME/.cargo/bin/
yum install rpm-build rpmdevtools -y
yum install openssl-devel -y
- name: Install cargo lock2rpm and protoc
run: |
cargo install cargo-lock2rpmprovides
PROTOC_ZIP=protoc-28.0-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v28.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc || unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*' || unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
- name: Setup for alumet
run: |
mkdir -p alumet
mkdir -p /etc/alumet
- name: Checkout alumet
uses: actions/checkout@v4
with:
repository: alumet-dev/alumet
path: "alumet"
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-targets: "alumet"
- name: get Spec settings
id: get-spec-settings
env:
build_dir: "$(pwd)/build"
run: |
mkdir -p ${{ env.build_dir }}/SOURCES
tar --exclude=".[^/]*" --exclude="./build" --transform 's|.|alumet|' -zcvf ${{ env.build_dir }}/SOURCES/alumet.tar.gz .
rpmbuild -ba -vv --define "_topdir ${{ env.build_dir }}" --define "release ${{env.os}}${{env.os_version}}" --define "version ${{ env.compvers }}" specs/alumet.spec
- name: Upload artifact local agent
uses: actions/upload-artifact@v4
with:
name: alumet-local-agent-${{ env.name }}-${{env.os}}${{ env.OS }}.${{ env.arch }}.rpm
path: |
./build/RPMS/${{ env.arch }}/${{ env.name }}-alumet-local-agent-${{ env.compvers }}-${{env.os}}${{env.os_version}}.${{ env.arch }}.rpm
- name: Upload artifact relay client
uses: actions/upload-artifact@v4
with:
name: alumet-relay-client-${{ env.name }}-${{env.os}}${{ env.OS }}.${{ env.arch }}.rpm
path: |
./build/RPMS/${{ env.arch }}/${{ env.name }}-alumet-relay-client-${{ env.compvers }}-${{env.os}}${{env.os_version}}.${{ env.arch }}.rpm
- name: Upload artifact relay server
uses: actions/upload-artifact@v4
with:
name: alumet-relay-server-${{ env.name }}-${{env.os}}${{ env.OS }}.${{ env.arch }}.rpm
path: |
./build/RPMS/${{ env.arch }}/${{ env.name }}-alumet-relay-server-${{ env.compvers }}-${{env.os}}${{env.os_version}}.${{ env.arch }}.rpm