-
Notifications
You must be signed in to change notification settings - Fork 27
213 lines (186 loc) · 5.79 KB
/
build.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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
LD_LIBRARY_PATH: /usr/local/opt/curl/lib:$LD_LIBRARY_PATH
PYCURL_SSL_LIBRARY: openssl
GEN_DOC_DIR: html
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: centos-stream-9
shortcut: c9s
container-name: el9stream
name: ${{ matrix.name }}
env:
ARTIFACTS_DIR: exported-artifacts
container:
image: quay.io/ovirt/buildcontainer:${{ matrix.container-name }}
steps:
- name: Prepare build environment
run: |
# Install oVirt repositories
dnf copr enable -y ovirt/ovirt-master-snapshot centos-stream-9
dnf install -y ovirt-release-master
- name: Install required packages
run: |
dnf install \
createrepo_c \
dnf-utils \
gcc \
git \
gzip \
openssl-devel \
libcurl-devel \
libxml2-devel \
libxslt-devel \
python3-devel \
python3-nose \
python3-pip \
python3-pycodestyle \
python3-pycurl \
python3-pygments \
python3-pyflakes \
python3-six \
python3-wheel \
rpm-build \
tar \
-y
- name: Checkout sources
uses: ovirt/checkout-action@main
- name: Run build for version
run: |
.automation/build-rpm.sh $ARTIFACTS_DIR
- name: Create DNF repository
run: |
createrepo_c $ARTIFACTS_DIR
- name: Upload RPM artifacts
uses: ovirt/upload-rpms-action@main
with:
directory: ${{ env.ARTIFACTS_DIR }}
- name: Checkout target repository
if: ${{ matrix.shortcut == 'c9s' }}
uses: actions/checkout@v4
with:
path: ovirt-engine-sdk
ref: 'gh-pages'
generate_documentation:
runs-on: ubuntu-20.04
steps:
- name: Install Dependencies
# This step installs dependencies for python-sdk and pdoc
run: |
sudo apt update &&
sudo apt install -y git \
python2 \
python2-dev \
curl \
asciidoctor \
gcc \
libxml2-dev \
libcurl4-openssl-dev \
libexpat1-dev \
gettext \
libz-dev \
libssl-dev \
libgnutls28-dev
- name: Checkout sources
uses: actions/checkout@v4
- name: Install pip2.7
# This step installs pip2.7, which will be needed later
run: |
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python2 get-pip.py
- name: Install Python-SDK with Python 2.7
# This step installs the python-sdk with python2.7, as the extension of pdoc,
# which is subsequently installed, doesn't have python3 support.
run: |
pip2.7 install setuptools
bash .automation/generate-setup-files.sh
python2.7 setup.py install --user --prefix=
shell: bash
- name: Install Pdoc
# This steps installs an extension of pdoc which supports asciidoc
# (this extension runs on python2).
run: |
git clone https://github.com/machacekondra/pdoc
cd pdoc
pip2.7 install -U .
- name: Install pygments
run: pip2.7 install pygments
- name: Generate documentation
run: pdoc ovirtsdk4 --html --html-dir=html
- name: Upload generated documentation artifacts
uses: actions/upload-artifact@v4
with:
name: generated-documentation
path: ${{ env.GEN_DOC_DIR }}/*
publish-doc:
permissions:
contents: write
needs: generate_documentation
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
container:
image: quay.io/centos/centos:stream9
steps:
- name: Download generated documentation artifacts
uses: actions/download-artifact@v4
with:
name: generated-documentation
path: ${{ env.GEN_DOC_DIR }}
- name: Install package dependencies
run: |
dnf install \
git \
python3-devel \
python3-pip \
-y
- name: Set git defaults
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Checkout target repository
uses: actions/checkout@v4
with:
path: ovirt-engine-sdk
ref: 'gh-pages'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set FOLDER variable according to pushed branch
run: |
IFS="/" read _ type value <<< ${GITHUB_REF}
if [[ ${type} == "heads" ]];
then
if [[ ${value} == "main" ]]
then
echo "FOLDER=master" >> $GITHUB_ENV;
else
echo "FOLDER=${value: -3}" >> $GITHUB_ENV;
fi
elif [[ ${type} == "tags" ]]
then
echo "FOLDER=${value:0:3}" >> $GITHUB_ENV;
fi
- name: Move created documentation to gh-pages
run: |
mkdir -p ./ovirt-engine-sdk/${{env.FOLDER}}/
cp ./html/ovirtsdk4/* ./ovirt-engine-sdk/${{env.FOLDER}}/
- name: Push changes to gh-pages
run: |
cd ovirt-engine-sdk
commit=$(git log --format="%H" -n 1)
description=$(git describe --always)
if git status --porcelain 2>/dev/null| grep -E "^??|^M"
then
git add .
git commit -m "gh-pages ${description} ${commit}"
git push
fi