-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (118 loc) · 4.97 KB
/
build-test-release.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
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: CC0-1.0
on:
push:
tags: ["*/v*.*.*"] # tags must be <addon-name>/v<version>
pull_request:
branches: [main]
jobs:
build-test-release:
runs-on: ubuntu-latest
strategy:
matrix:
# capella-version: [6.0.0]
capella-version: [6.0.0, 7.0.0]
include:
- capella-version: 6.0.0
jdk-version: 17.0.6+10
java-execution-environment: JavaSE-17
- capella-version: 7.0.0
jdk-version: 17.0.11+9
java-execution-environment: JavaSE-17
steps:
- name: Identify addon
id: identify_addon
run: |
if [ ${{ github.event_name }} == "pull_request" ]; then
echo "Identifying addon from pull request"
ADDON=${{ github.event.pull_request.base.ref }}
elif [ ${{ github.event_name }} == "push" ]; then
echo "Identifying addon from push"
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "This push is a tag: ${GITHUB_REF#refs/tags/}"
ADDON=$(echo "$GITHUB_REF" | sed -E 's|refs/tags/([^/]+)/.*|\1|')
else
echo "This push is not a tag."
ADDON=$(echo "${GITHUB_REF}" | sed -E 's|refs/heads/([^/]+)|\1|')
fi
fi
echo "addon=${ADDON}" >> $GITHUB_OUTPUT
- name: Generate OpenAPI code
if: steps.identify_addon.outputs.addon == 'rest-api'
run: |
echo "Generating OpenAPI code for ${ADDON}"
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.12"
# - name: Set up `capella-addons` CLI tool
# run: pip install . && pip show capella-addons
# - name: Set up Capella from ghcr.io/dsd-dbs/capella-dockerimages/capella/remote:${{ matrix.capella-version }}-selected-dropins-main
# 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 --platform=linux/x86_64 --rm -v /tmp:/tmp --entrypoint="" --user=root \
# ghcr.io/dsd-dbs/capella-dockerimages/capella/remote:${{ matrix.capella-version }}-selected-dropins-main \
# bash -c "[[ -d /tmp/capella_${{ matrix.capella-version }} ]] || cp -r /opt/capella /tmp/capella_${{ matrix.capella-version }}"
# fi
# - name: Set up Eclipse Temurin JDK ${{ matrix.jdk-version }}
# uses: actions/setup-java@v3
# with:
# java-version: ${{ matrix.jdk-version }}
# distribution: 'temurin'
# java-package: "jdk"
# - name: Set up Eclipse JDT language server 1.40.0
# 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
# - name: Build `.classpath` file
# run: |-
# cd ${{ steps.identify_addon.outputs.addon }}
# python -m capella_addons build-classpath \
# --java-execution-environment=${{ matrix.java-execution-environment }} \
# $(find src -type f -name "Main.java") \
# /tmp/capella_${{ matrix.capella-version }}
# - name: Build workspace
# run: |-
# cd ${{ steps.identify_addon.outputs.addon }}
# rm -rf target
# python -m capella_addons -v \
# build-workspace \
# --java-execution-environment=${{ matrix.java-execution-environment }} \
# $JAVA_HOME /tmp/jdtls
# - name: Package addon
# run: |-
# cd ${{ steps.identify_addon.outputs.addon }}
# python -m capella_addons -v \
# package \
# $JAVA_HOME \
# /tmp/capella_${{ matrix.capella-version }}
# - name: Create release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ env.addon }}.${{ github.ref }}
# release_name: ${{ env.addon }} ${{ github.ref }}
# draft: false
# prerelease: false
# - name: Publish release
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ${{ env.addon }}/target/com.deutschebahn.rest-api_0.0.1.jar
# asset_name: com.deutschebahn.${{ env.addon }}_${{ github.ref }}.jar
# asset_content_type: application/java-archive