Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for release-0.0.7 #67

Closed
wants to merge 109 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
d3fc08f
Updating Definitions (#10)
hareskoug Sep 25, 2023
a891481
on pr merged (#11)
hareskoug Sep 25, 2023
328391d
Updating Definitions (#12)
hareskoug Oct 3, 2023
0086b47
remove legacy tenant admin file (#13)
hareskoug Oct 6, 2023
a099b33
Updating Definitions (#14)
hareskoug Oct 11, 2023
767a3c5
Js generation (#15)
hareskoug Oct 12, 2023
c438cc2
Updating Definitions (#16)
hareskoug Oct 17, 2023
e201403
Updating Definitions (#17)
hareskoug Oct 24, 2023
d372d4b
Updating Definitions (#18)
hareskoug Nov 1, 2023
b4355ca
Updating Definitions (#19)
hareskoug Nov 6, 2023
bb6138f
Updating Definitions (#20)
hareskoug Nov 15, 2023
79a5663
Updating Definitions (#21)
hareskoug Nov 21, 2023
efa3f56
Updating Definitions (#22)
hareskoug Nov 29, 2023
931bda8
Updating Definitions (#23)
hareskoug Dec 7, 2023
026e47f
remove superseded definitions (#24)
hareskoug Dec 7, 2023
1de2ac3
Updating Definitions (#25)
hareskoug Dec 12, 2023
04f4c29
Updating Definitions (#26)
hareskoug Dec 19, 2023
9728144
Updating Definitions (#27)
hareskoug Jan 8, 2024
096a916
initial test
hareskoug Jan 11, 2024
c542694
Driver SDK gen and test
hareskoug Jan 11, 2024
276ac15
Update python setup action version from v2 -> v4
hareskoug Jan 11, 2024
2861c4c
Updating Definitions (#28)
hareskoug Jan 16, 2024
d8cb531
Updating Definitions (#30)
hareskoug Jan 23, 2024
deb11b8
Updating Definitions (#31)
hareskoug Jan 30, 2024
f777d60
Updating Definitions (#32)
hareskoug Feb 6, 2024
c6324d8
Updating Definitions
Visier-Build-Team Feb 13, 2024
300b085
Merge pull request #34 from visier/release-22222222.99201.1151
cszhu Feb 13, 2024
98ce993
Updating Definitions (#35)
hareskoug Feb 20, 2024
ddc6901
Updating Definitions (#36)
hareskoug Mar 12, 2024
199f52b
Updating Definitions (#37)
hareskoug Mar 26, 2024
6387e0f
Updating Definitions (#38)
hareskoug Apr 2, 2024
cdac421
Updating Definitions (#39)
hareskoug Apr 9, 2024
e382c20
Updating Definitions (#40)
hareskoug Apr 16, 2024
a4be7d7
Updating Definitions (#41)
hareskoug Apr 23, 2024
133d6d0
Updating Definitions (#42)
hareskoug Apr 30, 2024
bed1775
Updating Definitions (#43)
hareskoug May 7, 2024
5e789aa
Updating Definitions (#44)
hareskoug May 14, 2024
5c480ed
Updating Definitions (#45)
hareskoug May 21, 2024
35df93d
Updating Definitions (#46)
hareskoug May 28, 2024
c1f9953
Updating Definitions (#47)
hareskoug Jun 4, 2024
31eef86
Updating Definitions (#48)
hareskoug Jun 11, 2024
bff564a
Updating Definitions (#49)
hareskoug Jun 18, 2024
3e5b6f0
Updating Definitions (#50)
hareskoug Jun 24, 2024
fa23638
[VAN-122986] Created first version of python skd
Jun 29, 2024
bb81c54
Updating Definitions (#51)
hareskoug Jul 2, 2024
0530e92
Merge branch 'refs/heads/main' into feature/VAN-122986-poc-python
Jul 4, 2024
94cbe75
Merge branch 'refs/heads/main' into feature/VAN-122986-poc-python
Jul 5, 2024
a9ae961
[VAN-122986] Created first version of python sdk
Jul 7, 2024
8a0e5ca
[VAN-122986] Created first version of python sdk
Jul 7, 2024
4a06539
[VAN-122986] removed old one sample
Jul 7, 2024
4181622
[VAN-122986] removed old one sample
Jul 7, 2024
70303f2
[VAN-122986] removed old one sample
Jul 8, 2024
16d65d4
[VAN-122986] updated questions list
Jul 8, 2024
5d4d215
Updating Definitions (#52)
hareskoug Jul 9, 2024
9ac7004
[VAN-122986] Changed folder structure
Jul 10, 2024
deb647d
[VAN-122986] Temporary manual fix specification
Jul 10, 2024
bc49c9a
[VAN-123987] Added specification preprocessor script to update operat…
Jul 11, 2024
daeee4c
Merge branch 'refs/heads/main' into feature/VAN-123987-templates-for-…
Jul 11, 2024
dc4557e
[VAN-123987] Added configuration mustache to repo.
Jul 11, 2024
de43007
[VAN-123987] Typo fix in template
Jul 11, 2024
ab90d58
[VAN-123987] Saving python api client changes before moving to template
Jul 15, 2024
08cbcee
[VAN-123987] Added oauth using redirect callback.
Jul 16, 2024
5a58835
Updating Definitions (#53)
hareskoug Jul 16, 2024
a11a52a
[VAN-123987] Temporary added code to git, not to lose it.
Jul 16, 2024
dca1d6d
[VAN-123987] Updates in code to refresh token
Jul 17, 2024
f7de349
[VAN-123987] Updated code for auth
Jul 17, 2024
96dade8
[VAN-123987] Uploaded default mustache configs
Jul 17, 2024
178c01b
[VAN-123987] Updated code before moving to template
Jul 17, 2024
8897c9e
[VAN-123987] Working asid token auth
Jul 17, 2024
50951d3
[VAN-123987] Updated config templage
Jul 17, 2024
4eb801c
[VAN-123987] Updated template to handle token expiration
Jul 17, 2024
483f94e
[VAN-123987] Updated template to handle token expiration
Jul 17, 2024
2dbcb12
[VAN-123987] Fixed default scope value
Jul 17, 2024
a5325ce
[VAN-123987] Removed redundant code
Jul 17, 2024
edebd48
[VAN-123987] Removed redundant code
Jul 17, 2024
46caaf5
[VAN-123987] Added generated sdks to repo
Jul 17, 2024
a4a9c16
[VAN-123987] Added generated sdks to repo
Jul 17, 2024
763d34c
Merge branch 'refs/heads/main' into feature/VAN-123987-templates-for-…
Jul 17, 2024
7f90fcb
[VAN-123987] Removed requests from config
Jul 18, 2024
bfdd737
[VAN-123987] Removed requests from config
Jul 18, 2024
120c250
[VAN-123987] Removed generated python clients
Jul 18, 2024
1827b56
[VAN-123987] Removed redundant sample files
Jul 19, 2024
3b52a6e
[VAN-123987] Removed idea(pyharm) files
Jul 20, 2024
be55659
[VAN-123987] removed openapitools.json
Jul 20, 2024
60caf0a
[VAN-123987] Update generate python action to preprocess specificatio…
Jul 22, 2024
9221d5f
Updating Definitions (#55)
hareskoug Jul 23, 2024
e25bbe8
[VAN-122988] Added tox and mustache templates
Jul 24, 2024
8fbb449
Merge branch 'refs/heads/main' into feature/VAN-122988-publish-python…
Jul 24, 2024
c4138af
[VAN-122988] Added .actrc to simplify act usage
Jul 24, 2024
7d56654
[VAN-122988] Added .actrc to simplify act usage
Jul 25, 2024
496a084
[VAN-122988] matrix.driver replaced with env.SPECIFICATIONS to run in…
Jul 25, 2024
7206998
[VAN-122988] matrix.driver replaced with env.SPECIFICATIONS to run in…
Jul 25, 2024
d4b54b4
[VAN-122988] Comit working version.
Jul 25, 2024
77cf45b
[VAN-122988] Updated Version for test
Jul 26, 2024
b019f90
[VAN-124790] Replace granular specifications with combined.
Jul 26, 2024
00c1fbf
[VAN-124790] Updated script to get spec version for package
Jul 27, 2024
360f4d1
[VAN-124790] Updated specification
Jul 27, 2024
3be6bbd
[VAN-124790] Updated specification
Jul 27, 2024
4ed0bce
[VAN-122988] Fixed generating python sdk
Jul 30, 2024
02097d1
Merge pull request #56 from visier/release-22222222.99201.1418
Shmalikov Jul 30, 2024
9d38b94
Merge branch 'refs/heads/main' into feature/VAN-122988-publish-python…
Jul 30, 2024
df66655
[VAN-122983] Split workflow in main and python.
Jul 31, 2024
2532bd3
[VAN-122988] spec_preprocessing.py renamed to preprocessing.py
Jul 31, 2024
e882118
[VAN-122988] Added base branch for Python sdk checkout
Jul 31, 2024
ba99052
[VAN-122988] Reduced tox parallel count
Jul 31, 2024
43b63d3
[VAN-122988] Added create and merge PR for release in open-api branch
Jul 31, 2024
24d55b3
[VAN-122988] Updated openapi-clients merge PR step.
Jul 31, 2024
f6f3485
version updated to run test
Jul 31, 2024
105c607
One more test with new version
Jul 31, 2024
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
147 changes: 147 additions & 0 deletions .github/workflows/generate-python-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Generate Python SDK

on:
workflow_call:
inputs:
python_sdk_pr_base_branch:
description: 'The base branch for the Python SDK PR'
required: true
type: string
default: 'main'

env:
SPEC_DIR: ${{ github.workspace }}/specs_preprocessed
PYTHON_DIR: ${{ github.workspace }}/sdk-blueprints/python
SPECIFICATIONS: |
administration-apis,
analytic-model-apis,
data-in-apis,
data-out-apis

jobs:
generate-python-sdk:
name: Generate Python SDK
runs-on: ubuntu-22.04
env:
PACKAGE_PREFIX: visier.sdk.api
PACKAGE_DIR: ${{ github.workspace }}/specs_preprocessed
SDK_REPO_DIR: ${{ github.workspace }}/sdk-blueprints/generated

steps:
- name: Set up Corretto JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'corretto'

- name: Set up Python versions
uses: actions/setup-python@v4
with:
python-version: |
3.8
3.9
3.10
3.11
3.12

- name: Install openapi-generator-cli and tox
run: |
npm install @openapitools/openapi-generator-cli -g
pip install tox

- name: Checkout workflow repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Download openapi specifications artifact
uses: actions/download-artifact@v4
with:
name: processed-specs-${{ github.ref_name }}
path: ${{ env.SPEC_DIR }}

- name: Create a token
id: create-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: python-sdk

- name: Checkout Python SDK repository
uses: actions/checkout@v4
with:
repository: visier/python-sdk
token: ${{ steps.create-token.outputs.token }}
path: ${{ env.SDK_REPO_DIR }}
persist-credentials: false
ref: ${{ inputs.python_sdk_pr_base_branch }}

- name: Create locale Python SDK branch
env:
GITHUB_TOKEN: ${{ steps.create-token.outputs.token }}
run: |
cd $SDK_REPO_DIR
git checkout -b ${{ github.ref_name }}

- name: Generate Python SDK for all specifications
shell: bash
run: |
SPECIFICATION_LIST=$(echo $SPECIFICATIONS | tr ',' '\n')
for specification in $SPECIFICATION_LIST; do
echo "Processing $specification"
spec_file="$SPEC_DIR/${specification}.yaml"
package_name="$PACKAGE_PREFIX.$(echo "$specification" | sed 's/-apis$//; s/-/_/g')"
output_dir="$SDK_REPO_DIR/src/$package_name"
spec_version=$(awk '/version:/ {gsub(/"| /, "", $2); print $2}' "$spec_file")

mkdir -p $output_dir
openapi-generator-cli generate \
-i "$spec_file" \
-g python \
-t $PYTHON_DIR/templates \
--package-name "$package_name" \
-o "$output_dir" \
--skip-validate-spec \
--additional-properties=packageVersion="$spec_version"
done

# Pushing before tests to have the code available for debugging
- name: Push Python SDK branch
env:
GITHUB_TOKEN: ${{ steps.create-token.outputs.token }}
shell: bash
run: |
cd $SDK_REPO_DIR
git config user.name "Visier-Build-Team"
git config user.email "action@github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/visier/python-sdk.git
git add .
git commit -m "Autogenerated Python SDK"
git push origin ${{ github.ref_name }}

- name: Run tox tests
shell: bash
run: |
error_flag=0
find "$SDK_REPO_DIR/src/" -type d -name "${PACKAGE_PREFIX}*" -print |
while read -r dir; do
(cd "$dir" && tox -p 3)
if [ $? -ne 0 ]; then
error_flag=1
fi
done
exit $error_flag

- name: Create Pull Request for python-sdk
shell: bash
env:
GH_TOKEN: ${{ steps.create-token.outputs.token }}
run: |
cd $SDK_REPO_DIR
gh pr create \
--title "Auto-generated SDK" \
--body "This PR includes the autogenerated SDKs." \
--head "${{ github.ref_name }}" \
--base "${{ inputs.python_sdk_pr_base_branch }}"
91 changes: 91 additions & 0 deletions .github/workflows/generate-sdks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Generate SDKs

on:
workflow_dispatch:
push:
branches:
- 'release-**'

jobs:
preprocess-specifications:
name: Preprocess OpenAPI specifications
runs-on: ubuntu-22.04
env:
ORIG_SPEC_DIR: ${{ github.workspace }}/res
SPEC_DIR: ${{ github.workspace }}/specs_preprocessed
PREPROCESSING_DIR: ${{ github.workspace }}/sdk-blueprints/preprocessing

steps:
- name: Checkout workflow repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Preprocess OpenAPI specifications
id: preprocess
run: |
python3 -m pip install -r $PREPROCESSING_DIR/requirements.txt
python3 $PREPROCESSING_DIR/preprocessing.py $ORIG_SPEC_DIR $SPEC_DIR

- name: Upload preprocessed specifications as artifact
uses: actions/upload-artifact@v4
with:
name: processed-specs-${{ github.ref_name }}
path: ${{ env.SPEC_DIR }}
retention-days: 7

generate-python-sdk:
name: Generate Python SDK
needs: preprocess-specifications
uses: ./.github/workflows/generate-python-sdk.yml
secrets: inherit
with:
python_sdk_pr_base_branch: ${{ vars.PYTHON_SDK_PR_BASE_BRANCH }}

create-and-merge-pr:
name: Create and Merge Pull Request for release
needs: generate-python-sdk
runs-on: ubuntu-22.04
env:
OPENAPI_CLIENT_PR_BASE_BRANCH: ${{ vars.OPENAPI_CLIENT_PR_BASE_BRANCH }}
permissions:
contents: write
pull-requests: write
outputs:
pr_number: ${{ steps.create_pr.outputs.pr_number }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create a token
id: create-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Create Pull Request for openapi-clients
id: create_pr
env:
GH_TOKEN: ${{ steps.create-token.outputs.token }}
run: |
pr_output=$(gh pr create \
--title "PR for ${{ github.ref_name }}" \
--body "This PR created automatically after pushing changes to language-sdk repos." \
--head "${{ github.ref_name }}" \
--base "${{ env.OPENAPI_CLIENT_PR_BASE_BRANCH }}")
pr_number=$(echo "$pr_output" | grep -oE '[0-9]+$')
echo "Pull Request #$pr_number created successfully."
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT


- name: Merge Pull Request
env:
GH_TOKEN: ${{ steps.create-token.outputs.token }}
run: |
gh pr merge ${{ steps.create_pr.outputs.pr_number }} \
--squash \
--delete-branch \
--subject "Auto-merge: Update openapi"
19 changes: 12 additions & 7 deletions .github/workflows/publish-json.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
name: Publish JSON package

on:
push:
pull_request:
branches:
- main
types:
- closed

jobs:
build-json-archive:
name: Generate and package JSON files
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Target directory
run: mkdir json
run: mkdir json js
- name: Transform to JSON
run: for f in res/*.yaml; do fn=${f##*/}; yq -o json < $f > json/${fn%.*}.json; done
- name: Transform to JS spec assignment
run: for f in json/*.json; do fn=${f##*/}; echo "const spec = $(cat $f)" > js/${fn%.*}.js; done
- name: Make a release archive
run: tar -czf ${{ github.ref_name }}.tar.gz json/
run: tar -czf ${{ github.head_ref }}.tar.gz json/ js/
- name: Create release and upload
uses: ncipollo/release-action@v1
with:
artifacts: ${{ github.ref_name }}.tar.gz
tag: ${{ github.ref_name }}
omitBody: true
artifacts: ${{ github.head_ref }}.tar.gz
tag: ${{ github.head_ref }}
omitBody: true
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log

/.idea
/specs_preprocessed
/sdks/python/generated
.actrc
Loading
Loading