Skip to content

Commit 388af20

Browse files
committed
Refactor github actions
1 parent 7ad68aa commit 388af20

File tree

8 files changed

+248
-430
lines changed

8 files changed

+248
-430
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@v4
40+
with:
41+
java-version: ${{ inputs.java-version }}
42+
distribution: 'temurin'
43+
architecture: x64
44+
cache: 'maven'
45+
46+
- name: Set up Python
47+
if: ${{ inputs.install-python == 'true' }}
48+
uses: actions/setup-python@v5
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: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,24 @@
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:
3129
runs-on: ubuntu-22.04
3230
steps:
3331
- uses: actions/checkout@v5
34-
35-
- name: Set up JDK 17
36-
uses: actions/setup-java@v5
32+
- name: Setup Environment
33+
uses: ./.github/actions/setup-env
3734
with:
38-
distribution: 'temurin'
39-
java-version: '17'
40-
cache: 'maven'
41-
42-
- name: Set up Python
43-
uses: actions/setup-python@v6
44-
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-
35+
install-python: 'true'
36+
install-apt-deps: 'true'
5337
- name: Env details
5438
run: |
5539
uname -a
@@ -60,9 +44,8 @@ jobs:
6044
free -m
6145
nproc
6246
git status
63-
47+
- name: Install Non-OSS
48+
uses: ./.github/actions/install-nonoss
6449
- name: Noredist Build
6550
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
6851
mvn -B -P developer,systemvm -Dsimulator -Dnoredist clean install -T$(nproc)

0 commit comments

Comments
 (0)