Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}

- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -32,11 +32,11 @@ jobs:
- name: Install project tools and dependencies
shell: bash
run: make project-tools

- name: Download OAS
shell: bash
run: make download-oas

- name: Generate SDK
shell: bash
run: make generate-go-sdk
Expand All @@ -54,45 +54,50 @@ jobs:
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}


- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION_BUILD }}

- name: Checkout
uses: actions/checkout@v4

- name: install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.10.4"

- name: Install project tools and dependencies
shell: bash
run: |
python -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
make project-tools LANGUAGE=python
- name: Download OAS
shell: bash
run: make download-oas

- name: Generate SDK
shell: bash
run: make generate-python-sdk

- name: install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.10.4"
python-version: ${{ matrix.python-version }}

- name: Install SDK
working-directory: ./sdk-repo-updated
run: make install-dev

- name: Lint
working-directory: ./sdk-repo-updated
run: make lint

- name: Test
working-directory: ./sdk-repo-updated
run: make test
Expand All @@ -109,20 +114,25 @@ jobs:
with:
distribution: "temurin"
java-version: ${{ matrix.java-version }}


- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION_BUILD }}

- name: Checkout
uses: actions/checkout@v5

- name: Download OAS
run: make download-oas

- name: Generate SDK
run: make generate-java-sdk

- name: Lint
working-directory: ./sdk-repo-updated
run: make lint

- name: Test
working-directory: ./sdk-repo-updated
run: make test
56 changes: 33 additions & 23 deletions .github/workflows/sdk-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
main-go:
name: "[Go] Update SDK Repo"
runs-on: ubuntu-latest
permissions:
permissions:
pull-requests: write
contents: write
steps:
Expand All @@ -23,44 +23,44 @@ jobs:
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }}

- name: Install Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}

- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Install project tools and dependencies
shell: bash
run: make project-tools

- name: Download OAS
shell: bash
run: make download-oas

- name: Generate SDK
shell: bash
run: make generate-sdk

- name: Push SDK
env:
GH_REPO: "stackitcloud/stackit-sdk-go"
GH_TOKEN: ${{ secrets.SDK_PR_TOKEN }}
run: |
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 }})"

main-python:
name: "[Python] Update SDK Repo"
runs-on: ubuntu-latest
permissions:
permissions:
pull-requests: write
contents: write
steps:
Expand All @@ -69,37 +69,42 @@ jobs:
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }}

- name: Install Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}


- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout
uses: actions/checkout@v4

- name: Install project tools and dependencies
shell: bash
run: |
python -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
make project-tools LANGUAGE=python

- name: install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.10.4"

- name: Download OAS
shell: bash
run: make download-oas

- name: Generate SDK
shell: bash
run: make generate-sdk LANGUAGE=python

- name: Push SDK
env:
GH_REPO: "stackitcloud/stackit-sdk-python"
Expand All @@ -111,7 +116,7 @@ jobs:
main-java:
name: "[Java] Update SDK Repo"
runs-on: ubuntu-latest
permissions:
permissions:
pull-requests: write
contents: write
steps:
Expand All @@ -120,24 +125,29 @@ jobs:
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }}


- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}

- name: Checkout
uses: actions/checkout@v5

- name: Download OAS
run: make download-oas

- name: Generate SDK
run: make generate-sdk
env:
LANGUAGE: java

- name: Push SDK
env:
GH_REPO: "stackitcloud/stackit-sdk-java"
Expand Down
40 changes: 40 additions & 0 deletions scripts/build/delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package main

import (
"context"
"flag"
"fmt"
"strings"
)

func runDelete(ctx context.Context, args []string, io IO) bool {
deleteFlags := flag.NewFlagSet("delete", flag.ContinueOnError)
deleteFlags.SetOutput(io.Err)

var planPath string
deleteFlags.StringVar(&planPath, "plan", "", "path to the generation plan")
if err := deleteFlags.Parse(args); err != nil {
return false
}
if len(deleteFlags.Args()) != 0 {
fmt.Fprintf(io.Err, "unexpected arguments: %s\n", strings.Join(deleteFlags.Args(), " "))
return false
}
if planPath == "" {
fmt.Fprintln(io.Err, "--plan is required")
return false
}

plan, err := readPlan(io.FS, planPath)
if err != nil {
fmt.Fprintf(io.Err, "read generation plan: %v\n", err)
return false
}

for _, service := range plan.Services {
if service.Action == "delete" {
fmt.Fprintln(io.Out, service.Service)
}
}
return true
}
34 changes: 34 additions & 0 deletions scripts/build/delete_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"bytes"
"context"
"testing"
"testing/fstest"
)

func TestRunDeletePrintsServicesMarkedForDeletion(t *testing.T) {
filesystem := fstest.MapFS{
"generation-plan.json": {Data: []byte(`{
"services": [
{"service": "blocked", "oas_service": "blocked", "action": "block"},
{"service": "foo", "oas_service": "foo-bar", "action": "generate"},
{"service": "obsolete", "action": "delete"},
{"service": "service2", "action": "delete"}
]
}`)},
}
var stdout, stderr bytes.Buffer

ok := runDelete(context.Background(), []string{"--plan", "generation-plan.json"}, IO{
Out: &stdout,
Err: &stderr,
FS: readOnlyFileSystem{FileSystem: filesystem},
})
if !ok {
t.Fatalf("runDelete returned false: %s", stderr.String())
}
if got, want := stdout.String(), "obsolete\nservice2\n"; got != want {
t.Errorf("stdout = %q, want %q", got, want)
}
}
Loading
Loading