-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (127 loc) · 4.4 KB
/
build-addon.yml
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
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: CC0-1.0
name: Build addons
on:
push:
pull_request:
branches: ["main"]
env:
registry: ghcr.io/dsd-dbs/capella-addons/
addons: rest-api
JVM_DIR: /usr/lib/jvm
jobs:
# test:
# name: Test
# runs-on: ubuntu-latest
# steps:
# - name: Test
# run: |-
quality:
name: Ensure code quality
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install pre-commit
run: |-
python -m pip install pre-commit
- name: Run pre-commit
run: |-
pre-commit run --all-files
setup-build-environment:
strategy:
matrix:
capella:
- version: "6.0.0"
jdk:
name: "jdk-17.0.6+10"
url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%2B10/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.6_10.tar.gz"
# url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%2B10/OpenJDK17U-jdk_x64_linux_hotspot_17.0.6_10.tar.gz"
# - version: "6.1.0"
# jdk:
# name: "jdk-17.0.6+10"
# url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%2B10/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.6_10.tar.gz"
# - version: "7.0.0"
# jdk:
# name: "jdk-17.0.11+9"
# url: "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.11_9.tar.gz"
name: Setup build environment for Capella ${{ matrix.capella.version }}
# needs: [quality]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install `capella-addons` CLI tool
run: |-
pip install .
pip show capella-addons
- name: Install Capella from capelladocker-images
run: |-
docker pull ghcr.io/dsd-dbs/capella-dockerimages/capella/remote:${{ matrix.capella.version }}-selected-dropins-main
if [ ! -d /tmp/capella_${{ matrix.capella.version }} ]; then
docker run --rm -v /tmp:/tmp --entrypoint="" --user=root \
ghcr.io/dsd-dbs/capella-dockerimages/capella/remote:${{ matrix.capella.version }}-selected-dropins-main \
bash -c "cp -r /opt/capella /tmp/capella_${{ matrix.capella.version }}"
fi
- name: Install JDKs
run: |-
JVM_DIR=/usr/lib/jvm
TMP_JDK=/tmp/jdk.tar.gz
mkdir -p $JVM_DIR
cd $JVM_DIR
URL="${{ matrix.capella.jdk.url }}"
[[ -f $TMP_JDK ]] && rm $TMP_JDK
curl -Lo $TMP_JDK $URL
JDK_DIR_NAME=$(tar tf $TMP_JDK | head -n 1)
[[ -d $JDK_DIR_NAME ]] && rm -rf $JDK_DIR_NAME
tar xzf $TMP_JDK
mv $JVM_DIR/jdk-* /usr/lib/jvm/jdk
rm $TMP_JDK
# done
- name: Install Eclipse JDT language server
run: |-
if [ ! -d /tmp/jdtls ]; then mkdir /tmp/jdtls; fi
cd /tmp/jdtls
if [ ! -f jdtls.tar.gz ]; then
curl -Lo jdtls.tar.gz \
https://download.eclipse.org/jdtls/milestones/1.40.0/jdt-language-server-1.40.0-202409261450.tar.gz
fi
tar xzf jdtls.tar.gz
rm *.tar.gz
build-addons:
name: Build addons
needs: [setup-build-environment]
runs-on: ubuntu-latest
strategy:
matrix:
capella_version:
- '6.0.0'
# - '6.1.0'
# - '7.0.0'
addon:
- rest-api
steps:
- name: Build `.classpath` file
run: |-
cd ${{ matrix.addon }}
python -m capella_addons build-classpath \
--java-execution-environment=JavaSE-17 \
$(find . -type f -name "Main.java") \
/tmp/capella_${{ matrix.capella_version }}
cat .classpath
- name: Build workspace
run: |-
cd ${{ matrix.addon }}
rm -rf target
python -m capella_addons -v \
build-workspace \
--java-execution-environment=JavaSE-17 \
/usr/lib/jvm/jdk-17.0.6+10 \
/tmp/jdtls