Skip to content
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Python Library Services Generation

on: [ workflow_dispatch ]

jobs:
generate:
runs-on: ubuntu-latest
name: Generate Services
steps:
- uses: actions/checkout@v3
- run: make all
- name: Set PR variables
id: vars
run: |
echo ::set-output name=pr_title::"Update services"
echo ::set-output name=pr_body::"OpenAPI spec or templates produced new services on $(date +%d-%m-%Y) \
by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))."
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
base: develop
branch: automation/services
title: ${{ steps.vars.outputs.pr_title }}
body: ${{ steps.vars.outputs.pr_body }}
add-paths: Adyen/services
41 changes: 23 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ coverage:


generator:=python
openapi-generator-cli:=java -jar build/openapi-generator-cli.jar
openapi-generator-version:=6.0.1
openapi-generator-url:=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$(openapi-generator-version)/openapi-generator-cli-$(openapi-generator-version).jar
openapi-generator-jar:=build/openapi-generator-cli.jar
openapi-generator-cli:=java -jar $(openapi-generator-jar)
output:=build/out
services:=balancePlatform checkout legalEntityManagement management payments payouts platformsAccount platformsFund platformsHostedOnboardingPage platformsNotificationConfiguration transfers
smallServices:=balanceControlService binlookup dataProtection recurring storedValue terminal

all: $(services) $(smallServices)

binlookup: spec=BinLookupService-v52
checkout: spec=CheckoutService-v70
dataProtection: spec=DataProtectionService-v1
Expand All @@ -31,55 +37,54 @@ platformsHostedOnboardingPage: spec=HopService-v6
transfers: spec=TransferService-v3
balanceControlService: spec=BalanceControlService-v1

$(services): build/spec
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar -O build/openapi-generator-cli.jar
rm -rf Adyen/services/$@
$(services): build/spec $(openapi-generator-jar)
rm -rf Adyen/services/$@ $(output)
$(openapi-generator-cli) generate \
-i build/spec/json/$(spec).json \
-g $(generator) \
-c ./templates/config.yaml \
-o build \
-o $(output) \
--global-property apis,apiTests=false,apiDocs=false,supportingFiles=api-single.py\
--additional-properties serviceName=$@\
--skip-validate-spec
mkdir -p Adyen/services
cp -r build/openapi_client/api Adyen/services/$@
cp -r $(output)/openapi_client/api Adyen/services/$@
rm -f Adyen/services/$@/*-small.py
cp build/api/api-single.py Adyen/services/$@/__init__.py
rm -rf build
cp $(output)/api/api-single.py Adyen/services/$@/__init__.py


$(smallServices): build/spec
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar -O build/openapi-generator-cli.jar
rm -rf Adyen/services/$@
$(smallServices): build/spec $(openapi-generator-jar)
rm -rf Adyen/services/$@ $(output)
$(openapi-generator-cli) generate \
-i build/spec/json/$(spec).json \
-g $(generator) \
-c ./templates/config.yaml \
-o build \
-o $(output) \
--global-property apis,apiTests=false,apiDocs=false\
--additional-properties serviceName=$@\
--skip-validate-spec
mkdir -p Adyen/services
cp build/openapi_client/api/general_api-small.py Adyen/services/$@.py
rm -rf build
cp $(output)/openapi_client/api/general_api-small.py Adyen/services/$@.py



build/spec:
git clone https://github.com/Adyen/adyen-openapi.git build/spec
perl -i -pe's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/json/*.json

# Download the generator
$(openapi-generator-jar):
wget --quiet -o /dev/null $(openapi-generator-url) -O $(openapi-generator-jar)


generateCheckoutTest: build/spec
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar -O build/openapi-generator-cli.jar
generateCheckoutTest: build/spec $(openapi-generator-jar)
$(openapi-generator-cli) generate \
-i build/spec/json/CheckoutService-v70.json \
-g $(generator) \
-c ./templates/config.yaml \
-o build \
-o $(output) \
--global-property apis,apiTests=false,supportingFiles=api-test.py\
--additional-properties serviceName=checkout \
--skip-validate-spec
cp build/api/api-test.py test/methodNamesTests/checkoutTest.py
cp $(output)/api/api-test.py test/methodNamesTests/checkoutTest.py
rm -rf build