Add addon rest-api
#19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | |
# SPDX-License-Identifier: CC0-1.0 | |
name: Build addons | |
on: | |
pull_request: | |
push: | |
branches: ["main"] | |
tags: ["v*.*.*"] | |
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 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
fetch-depth: 0 | |
- 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 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
fetch-depth: 0 | |
- 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 |