Skip to content

Commit c914b07

Browse files
authored
feat(ci): adjust worfklows for the java sdk (#188)
1 parent 59af887 commit c914b07

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,35 @@ jobs:
121121
run: |
122122
. .venv/bin/activate
123123
make test
124+
125+
main-java:
126+
name: CI [Java]
127+
runs-on: ubuntu-latest
128+
strategy:
129+
matrix:
130+
java-version: ["11", "17", "21"]
131+
steps:
132+
- name: Install SSH Key
133+
uses: shimataro/ssh-key-action@v2
134+
with:
135+
key: ${{ secrets.SSH_PRIVATE_KEY }}
136+
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }}
137+
- name: Install Java
138+
uses: actions/setup-java@v4
139+
with:
140+
distribution: "temurin"
141+
java-version: ${{ matrix.java-version }}
142+
- name: Checkout
143+
uses: actions/checkout@v5
144+
- name: Download OAS
145+
run: make download-oas
146+
- name: Generate SDK
147+
run: make generate-sdk
148+
env:
149+
LANGUAGE: java
150+
- name: Lint
151+
working-directory: ./sdk-repo-updated
152+
run: make lint
153+
- name: Test
154+
working-directory: ./sdk-repo-updated
155+
run: make test

.github/workflows/sdk-pr.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,35 @@ jobs:
7878
poetry config virtualenvs.create false
7979
(cd ./sdk-repo-updated && make install-dev)
8080
scripts/sdk-create-pr.sh "generator-bot-${{ github.run_id }}" "Generated from GitHub run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" "git@github.com:stackitcloud/stackit-sdk-python.git" "python"
81+
82+
main-java:
83+
name: "[Java] Update SDK Repo"
84+
runs-on: ubuntu-latest
85+
permissions:
86+
pull-requests: write
87+
contents: write
88+
steps:
89+
- name: Install SSH Key
90+
uses: shimataro/ssh-key-action@v2
91+
with:
92+
key: ${{ secrets.SSH_PRIVATE_KEY }}
93+
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }}
94+
- name: Install Java
95+
uses: actions/setup-java@v4
96+
with:
97+
distribution: "temurin"
98+
java-version: ${{ env.JAVA_VERSION }}
99+
- name: Checkout
100+
uses: actions/checkout@v5
101+
- name: Download OAS
102+
run: make download-oas
103+
- name: Generate SDK
104+
run: make generate-sdk
105+
env:
106+
LANGUAGE: java
107+
- name: Push SDK
108+
env:
109+
GH_REPO: "stackitcloud/stackit-sdk-java"
110+
GH_TOKEN: ${{ secrets.SDK_PR_TOKEN }}
111+
run: |
112+
scripts/sdk-create-pr.sh "generator-bot-${{ github.run_id }}" "Generated from GitHub run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" "git@github.com:stackitcloud/stackit-sdk-java.git" "java"

scripts/generate-sdk/languages/java.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ generate_java_sdk() {
4040
GIT_REPO_ID="stackit-sdk-java"
4141
fi
4242

43+
# TODO: Change to use the https url when repo is public
4344
if [[ -z ${SDK_REPO_URL} ]]; then
4445
echo "SDK_REPO_URL not specified, default will be used."
45-
SDK_REPO_URL="https://github.com/stackitcloud/stackit-sdk-java.git"
46+
SDK_REPO_URL="git@github.com:stackitcloud/stackit-sdk-java.git"
4647
fi
4748

4849
# Prepare folders

scripts/project.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ elif [ "$action" = "tools" ]; then
2626
go install golang.org/x/tools/cmd/goimports@latest
2727
elif [ "${LANGUAGE}" == "python" ]; then
2828
pip install black==24.8.0 isort~=5.13.2 autoimport~=1.6.1
29+
elif [ "${LANGUAGE}" == "java" ]; then
30+
echo "No additional project setup for java needed"
2931
else
3032
echo "! Invalid language: $($LANGUAGE), please use $0 help for help"
3133
fi

0 commit comments

Comments
 (0)