Skip to content

Commit 541ed18

Browse files
committed
feat: init
0 parents  commit 541ed18

File tree

257 files changed

+43160
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+43160
-0
lines changed

.github/dependabot.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
cooldown:
8+
default-days: 7
9+
commit-message:
10+
prefix: chore
11+
include: scope
12+
- package-ecosystem: "gomod"
13+
directory: "/codegen"
14+
schedule:
15+
interval: "weekly"
16+
cooldown:
17+
default-days: 7
18+
commit-message:
19+
prefix: chore
20+
include: scope
21+
- package-ecosystem: "github-actions"
22+
directory: "/"
23+
schedule:
24+
interval: "weekly"
25+
cooldown:
26+
default-days: 7
27+
commit-message:
28+
prefix: chore
29+
include: scope

.github/workflows/ci.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
codegen-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.2.0
17+
with:
18+
go-version-file: codegen/go.mod
19+
20+
- name: Go unit tests
21+
run: go -C codegen test ./...
22+
23+
codegen-sdk:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.2.0
30+
with:
31+
go-version-file: codegen/go.mod
32+
33+
- name: Generate SDK
34+
run: go -C codegen run . generate
35+
36+
- name: Set up Java
37+
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.4.0
38+
with:
39+
distribution: temurin
40+
java-version: '21'
41+
cache: gradle
42+
43+
- name: Format SDK code
44+
run: ./gradlew spotlessApply
45+
46+
- name: Ensure clean working tree
47+
run: git diff --exit-code
48+
49+
java:
50+
runs-on: ubuntu-latest
51+
needs:
52+
- codegen-tests
53+
- codegen-sdk
54+
strategy:
55+
matrix:
56+
java-version:
57+
- '17'
58+
- '21'
59+
- '25'
60+
steps:
61+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
62+
63+
- name: Install test JVM ${{ matrix.java-version }}
64+
id: setup-test-java
65+
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.4.0
66+
with:
67+
distribution: temurin
68+
java-version: ${{ matrix.java-version }}
69+
cache: gradle
70+
set-java-home: false
71+
72+
- name: Set up Java for Gradle
73+
id: setup-gradle-java
74+
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.4.0
75+
with:
76+
distribution: temurin
77+
java-version: '21'
78+
cache: gradle
79+
80+
- name: Configure toolchain paths
81+
run: |
82+
echo "JAVA_TEST_HOME=${{ steps.setup-test-java.outputs.path }}" >> $GITHUB_ENV
83+
echo "ORG_GRADLE_JAVA_INSTALLATIONS_PATHS=${{ steps.setup-test-java.outputs.path }}:${{ steps.setup-gradle-java.outputs.path }}" >> $GITHUB_ENV
84+
85+
- name: Test
86+
run: ./gradlew test -PtestJavaVersion=${{ matrix.java-version }}
87+
88+
- name: Build
89+
run: ./gradlew build -PtestJavaVersion=${{ matrix.java-version }}
90+
91+
release-please:
92+
name: Prepare release
93+
runs-on: ubuntu-latest
94+
if: github.ref == 'refs/heads/main'
95+
permissions:
96+
contents: write
97+
pull-requests: write
98+
steps:
99+
- name: Checkout code
100+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
101+
102+
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
103+
with:
104+
token: ${{ secrets.GITHUB_TOKEN }}
105+
target-branch: ${{ github.ref_name }}

.github/workflows/generate.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Generate
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
paths:
7+
- openapi.json
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: generate-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
generate:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
23+
with:
24+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
25+
ref: ${{ github.event.pull_request.head.ref || github.ref }}
26+
persist-credentials: false
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.2.0
30+
with:
31+
go-version-file: codegen/go.mod
32+
33+
- name: Generate SDK
34+
run: go -C codegen run . generate
35+
36+
- name: Set up Java
37+
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.4.0
38+
with:
39+
distribution: temurin
40+
java-version: '21'
41+
cache: gradle
42+
43+
- name: Format SDK code
44+
run: ./gradlew spotlessApply
45+
46+
- name: Build
47+
run: ./gradlew build
48+
49+
- name: Create GitHub App token
50+
id: app-token
51+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
52+
with:
53+
app-id: ${{ secrets.SUMUP_BOT_APP_ID }}
54+
private-key: ${{ secrets.SUMUP_BOT_PRIVATE_KEY }}
55+
56+
- name: Get GitHub App User ID
57+
id: get-user-id
58+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
59+
env:
60+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
61+
62+
- name: Configure git
63+
run: |
64+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
65+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
66+
67+
- name: Commit changes
68+
id: commit
69+
run: |
70+
git add .
71+
if git diff --cached --quiet; then
72+
echo "changed=false" >> "$GITHUB_OUTPUT"
73+
else
74+
git commit -m "chore: generate code"
75+
echo "changed=true" >> "$GITHUB_OUTPUT"
76+
fi
77+
78+
- name: Push changes
79+
if: steps.commit.outputs.changed == 'true'
80+
env:
81+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
82+
TARGET_REPO: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
83+
TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
84+
run: |
85+
git push "https://x-access-token:${GH_TOKEN}@github.com/${TARGET_REPO}.git" "HEAD:${TARGET_REF}"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Github Actions
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/**'
7+
8+
defaults:
9+
run:
10+
working-directory: ./.github
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
actionlint:
17+
name: Lint
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
21+
with:
22+
persist-credentials: false
23+
sparse-checkout: |
24+
.github
25+
26+
- uses: reviewdog/action-actionlint@83e4ed25b168066ad8f62f5afbb29ebd8641d982 # v1.69.1
27+
with:
28+
filter_mode: nofilter
29+
fail_on_error: true
30+
reporter: github-pr-check

.github/workflows/lint-pr.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
permissions:
12+
pull-requests: read
13+
checks: write
14+
15+
jobs:
16+
main:
17+
name: Validate PR title
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
with:
24+
ignoreLabels: |
25+
release
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Release PR Maintenance
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, labeled]
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: write
11+
pull-requests: read
12+
13+
jobs:
14+
bump-readme:
15+
if: startsWith(github.event.pull_request.head.ref, 'release-please--')
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout release branch
19+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.1
20+
with:
21+
ref: ${{ github.event.pull_request.head.ref }}
22+
fetch-depth: 0
23+
24+
- name: Sync README dependency versions
25+
id: sync
26+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
27+
with:
28+
script: |
29+
const fs = require('fs');
30+
const core = require('@actions/core');
31+
const version = fs.readFileSync('VERSION', 'utf8').trim();
32+
if (!version) {
33+
throw new Error('VERSION file is empty');
34+
}
35+
36+
const readmePath = 'README.md';
37+
const original = fs.readFileSync(readmePath, 'utf8');
38+
39+
const gradlePattern = /(implementation\("com\.sumup:sumup-sdk:)([^"]+)("\))/;
40+
let gradleUpdated = false;
41+
const afterGradle = original.replace(gradlePattern, (_, prefix, _current, suffix) => {
42+
gradleUpdated = true;
43+
return `${prefix}${version}${suffix}`;
44+
});
45+
if (!gradleUpdated) {
46+
throw new Error('Gradle dependency snippet not found in README.md');
47+
}
48+
49+
const mavenPattern = /(<version>)([^<]+)(<\/version>)/;
50+
let mavenUpdated = false;
51+
const updated = afterGradle.replace(mavenPattern, (_, prefix, _current, suffix) => {
52+
mavenUpdated = true;
53+
return `${prefix}${version}${suffix}`;
54+
});
55+
if (!mavenUpdated) {
56+
throw new Error('Maven dependency snippet not found in README.md');
57+
}
58+
59+
if (updated === original) {
60+
core.setOutput('updated', 'false');
61+
return;
62+
}
63+
64+
fs.writeFileSync(readmePath, updated);
65+
core.setOutput('updated', 'true');
66+
67+
- name: Commit changes
68+
if: steps.sync.outputs.updated == 'true'
69+
run: |
70+
git config user.name "github-actions[bot]"
71+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
72+
git add README.md
73+
git commit -m "chore: update README dependency versions"
74+
75+
- name: Push changes
76+
if: steps.sync.outputs.updated == 'true'
77+
run: git push

0 commit comments

Comments
 (0)