Skip to content

Commit 2a05489

Browse files
committed
Refactor github actions
1 parent 18075ae commit 2a05489

File tree

13 files changed

+239
-238
lines changed

13 files changed

+239
-238
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: 'Install CloudStack Non-OSS'
19+
description: 'Clones and installs the shapeblue/cloudstack-nonoss repository.'
20+
21+
runs:
22+
using: "composite"
23+
steps:
24+
- name: Install cloudstack-nonoss
25+
shell: bash
26+
run: |
27+
git clone --depth 1 https://github.com/shapeblue/cloudstack-nonoss.git nonoss
28+
cd nonoss
29+
bash -x install-non-oss.sh
30+
cd ..
31+
rm -fr nonoss
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: 'Setup CloudStack Environment'
19+
description: 'Sets up JDK (with Maven cache), optionally Python, and optionally APT build dependencies for CloudStack.'
20+
21+
inputs:
22+
java-version:
23+
description: 'The JDK version to use'
24+
required: false
25+
default: '17'
26+
install-python:
27+
description: 'Whether to install Python 3.10'
28+
required: false
29+
default: 'false'
30+
install-apt-deps:
31+
description: 'Whether to install CloudStack APT build dependencies'
32+
required: false
33+
default: 'false'
34+
35+
runs:
36+
using: "composite"
37+
steps:
38+
- name: Set up JDK ${{ inputs.java-version }}
39+
uses: actions/setup-java@v5
40+
with:
41+
java-version: ${{ inputs.java-version }}
42+
distribution: 'adopt'
43+
architecture: x64
44+
cache: 'maven'
45+
46+
- name: Set up Python
47+
if: ${{ inputs.install-python == 'true' }}
48+
uses: actions/setup-python@v6
49+
with:
50+
python-version: '3.10'
51+
architecture: x64
52+
53+
- name: Install Build Dependencies
54+
if: ${{ inputs.install-apt-deps == 'true' }}
55+
shell: bash
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y git uuid-runtime genisoimage netcat-openbsd ipmitool build-essential libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 libpython3-dev libssl-dev libffi-dev python3-openssl python3-dev python3-setuptools

.github/workflows/build.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,25 @@
1616
# under the License.
1717

1818
name: Build
19-
20-
on: [push, pull_request]
21-
19+
on:
20+
- push
21+
- pull_request
2222
concurrency:
2323
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24-
cancel-in-progress: true
25-
24+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2625
permissions:
2726
contents: read
28-
2927
jobs:
3028
build:
31-
runs-on: ubuntu-22.04
29+
runs-on: ubuntu-24.04
3230
steps:
3331
- uses: actions/checkout@v6
3432

35-
- name: Set up JDK 17
36-
uses: actions/setup-java@v5
37-
with:
38-
distribution: 'temurin'
39-
java-version: '17'
40-
cache: 'maven'
41-
42-
- name: Set up Python
43-
uses: actions/setup-python@v6
33+
- name: Setup Environment
34+
uses: ./.github/actions/setup-env
4435
with:
45-
python-version: '3.10'
46-
architecture: 'x64'
47-
48-
- name: Install Build Dependencies
49-
run: |
50-
sudo apt-get update
51-
sudo apt-get install -y git uuid-runtime genisoimage netcat ipmitool build-essential libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 ipmitool libpython3-dev libssl-dev libffi-dev python3-openssl python3-dev python3-setuptools
52-
36+
install-python: 'true'
37+
install-apt-deps: 'true'
5338
- name: Env details
5439
run: |
5540
uname -a
@@ -60,9 +45,8 @@ jobs:
6045
free -m
6146
nproc
6247
git status
63-
48+
- name: Install Non-OSS
49+
uses: ./.github/actions/install-nonoss
6450
- name: Noredist Build
6551
run: |
66-
git clone https://github.com/shapeblue/cloudstack-nonoss.git nonoss && cd nonoss && bash -x install-non-oss.sh && cd ..
67-
rm -fr nonoss
6852
mvn -B -P developer,systemvm -Dsimulator -Dnoredist clean install -T$(nproc)

.github/workflows/ci.yml

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,55 @@
1616
# under the License.
1717

1818
name: Simulator CI
19-
20-
on: [push, pull_request]
21-
19+
on:
20+
- push
21+
- pull_request
2222
concurrency:
2323
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24-
cancel-in-progress: true
25-
24+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2625
permissions:
2726
contents: read
28-
2927
jobs:
3028
build:
3129
if: github.repository == 'apache/cloudstack'
3230
runs-on: ubuntu-24.04
33-
31+
steps:
32+
- uses: actions/checkout@v6
33+
with:
34+
fetch-depth: 0
35+
- name: Setup Environment
36+
uses: ./.github/actions/setup-env
37+
with:
38+
install-python: 'true'
39+
install-apt-deps: 'true'
40+
- name: Env details
41+
run: |
42+
uname -a
43+
whoami
44+
javac -version
45+
mvn -v
46+
python3 --version
47+
free -m
48+
nproc
49+
git status
50+
ipmitool -V
51+
- name: Build with Maven
52+
run: |
53+
mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
54+
- name: Archive artifacts
55+
run: |
56+
mkdir -p /tmp/artifacts
57+
tar -czf /tmp/artifacts/targets.tar.gz $(find . -name "target" -type d) tools/marvin/dist engine/schema/dist utils/conf
58+
tar -czf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository org/apache/cloudstack
59+
- name: Upload artifacts
60+
uses: actions/upload-artifact@v7
61+
with:
62+
name: build-artifacts
63+
path: /tmp/artifacts/
64+
test:
65+
needs: build
66+
if: github.repository == 'apache/cloudstack'
67+
runs-on: ubuntu-24.04
3468
strategy:
3569
fail-fast: false
3670
matrix:
@@ -215,30 +249,15 @@ jobs:
215249
smoke/test_list_service_offerings
216250
smoke/test_list_storage_pools
217251
smoke/test_list_volumes"]
218-
219252
steps:
220253
- uses: actions/checkout@v6
221254
with:
222255
fetch-depth: 0
223-
224-
- name: Set up JDK 17
225-
uses: actions/setup-java@v5
256+
- name: Setup Environment
257+
uses: ./.github/actions/setup-env
226258
with:
227-
distribution: 'temurin'
228-
java-version: '17'
229-
cache: 'maven'
230-
231-
- name: Set up Python
232-
uses: actions/setup-python@v6
233-
with:
234-
python-version: '3.10'
235-
architecture: 'x64'
236-
237-
- name: Install Build Dependencies
238-
run: |
239-
sudo apt-get update
240-
sudo apt-get install -y git uuid-runtime genisoimage netcat-openbsd ipmitool build-essential libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 ipmitool libpython3-dev libssl-dev libffi-dev python3-openssl python3-dev python3-setuptools
241-
259+
install-python: 'true'
260+
install-apt-deps: 'true'
242261
- name: Setup IPMI Tool for CloudStack
243262
run: |
244263
# Create cloudstack-common directory if it doesn't exist
@@ -256,28 +275,13 @@ jobs:
256275
/usr/share/cloudstack-common/ipmitool -C3 $@
257276
EOF
258277
sudo chmod 755 /usr/bin/ipmitool
259-
260278
- name: Install Python dependencies
261279
run: |
262280
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycryptodome mock flask netaddr pylint pycodestyle six astroid pynose
263-
264281
- name: Install jacoco dependencies
265282
run: |
266283
wget https://github.com/jacoco/jacoco/releases/download/v0.8.10/jacoco-0.8.10.zip
267284
unzip jacoco-0.8.10.zip -d jacoco
268-
269-
- name: Env details
270-
run: |
271-
uname -a
272-
whoami
273-
javac -version
274-
mvn -v
275-
python3 --version
276-
free -m
277-
nproc
278-
git status
279-
ipmitool -V
280-
281285
- name: Setup MySQL Server
282286
run: |
283287
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#mysql
@@ -286,25 +290,28 @@ jobs:
286290
sudo mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; FLUSH PRIVILEGES;"
287291
sudo systemctl restart mysql
288292
sudo mysql -uroot -e "SELECT VERSION();"
289-
290-
- name: Build with Maven
293+
- name: Download artifacts
294+
uses: actions/download-artifact@v8
295+
with:
296+
name: build-artifacts
297+
path: /tmp/artifacts/
298+
- name: Extract artifacts
291299
run: |
292-
mvn -B -P developer,systemvm -Dsimulator clean install -DskipTests=true -T$(nproc)
293-
300+
tar -xzf /tmp/artifacts/targets.tar.gz
301+
mkdir -p ~/.m2/repository
302+
tar -xzf /tmp/artifacts/m2-cloudstack.tar.gz -C ~/.m2/repository
294303
- name: Setup Simulator Prerequisites
295304
run: |
296305
sudo python3 -m pip install --upgrade netaddr mysql-connector-python
297306
python3 -m pip install --user --upgrade tools/marvin/dist/[mM]arvin-*.tar.gz
298307
mvn -q -Pdeveloper -pl developer -Ddeploydb
299308
mvn -q -Pdeveloper -pl developer -Ddeploydb-simulator
300-
301309
- name: Generate jacoco-coverage.sh
302310
run: |
303311
echo "java -jar jacoco/lib/jacococli.jar report jacoco-it.exec \\" > jacoco-report.sh
304312
find . | grep "target/classes" | sed 's/\/classes\//\/classes /g' | awk '{print "--classfiles", $1, "\\"}' | sort |uniq >> jacoco-report.sh
305313
find . | grep "src/main/java" | sed 's/\/java\//\/java /g' | awk '{print "--sourcefiles", $1, "\\"}' | sort | uniq >> jacoco-report.sh
306314
echo "--xml jacoco-coverage.xml" >> jacoco-report.sh
307-
308315
- name: Start CloudStack Management Server with Simulator
309316
run: |
310317
export MAVEN_OPTS="-Xmx4096m -XX:MaxMetaspaceSize=800m -Djava.security.egd=file:/dev/urandom -javaagent:jacoco/lib/jacocoagent.jar=address=*,port=36320,output=tcpserver --add-opens=java.base/java.lang=ALL-UNNAMED --add-exports=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED"
@@ -315,7 +322,6 @@ jobs:
315322
set -e
316323
echo -e "\nStarting Advanced Zone DataCenter deployment"
317324
python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advdualzone.cfg 2>&1 || true
318-
319325
- name: Run Integration Tests with Simulator
320326
run: |
321327
mkdir -p integration-test-results/smoke/misc
@@ -335,13 +341,11 @@ jobs:
335341
bash jacoco-report.sh
336342
mvn -Dsimulator -pl client jetty:stop 2>&1
337343
find /tmp//MarvinLogs -type f -exec echo -e "Printing marvin logs {} :\n" \; -exec cat {} \;
338-
339344
- name: Integration Tests Result
340345
run: |
341346
echo -e "Simulator CI Test Results: (only failures listed)\n"
342347
python3 ./tools/marvin/xunit-reader.py integration-test-results/
343-
344-
- uses: codecov/codecov-action@v4
348+
- uses: codecov/codecov-action@v5
345349
with:
346350
files: jacoco-coverage.xml
347351
fail_ci_if_error: true

.github/workflows/codecov.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)