Skip to content

Commit

Permalink
build of sdk moved to sdk repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ossaleon committed May 28, 2024
1 parent c59b1ad commit 9ed0249
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 84 deletions.
23 changes: 0 additions & 23 deletions .bin/json_merge_generator.py

This file was deleted.

71 changes: 10 additions & 61 deletions .github/workflows/update_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,89 +7,38 @@ on:
- main
paths:
- "api/**"
pull_request:
types: [closed]
paths:
- "api/**"

jobs:
run-commands:
update_api:
# Define the OS and environment the job will run on
runs-on: ubuntu-latest

# Define the steps in the job
steps:
# Step 1: Checkout the first repository
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: wordlift/docs
path: "./docs"
uses: actions/checkout@v4

# Step 2: Checkout the second repository
- name: Checkout second repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: wordlift/wordlift-sdk
path: "./wordlift-sdk"
repository: wordlift/python-client
path: "./python-client"

# step 3: Patch middleware api specification
- name: Apply patch to middleware.yaml
run: |
cd docs
git apply fix_middleware_spec.patch
cd ..
# Step 4: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18" # Specify the Node.js version to use

# Step 5: Install openapi-merge-cli and openapi-generator-cli
- name: Install openapi-merge-cli
run: |
npm i openapi-merge-cli
npm i @openapitools/openapi-generator-cli
run: git apply ./patch/fix_middleware_spec.patch

# Step 6: Set up Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

# Step 7: Install Python dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
# Step 8: Run the Python script to generate json for openApi-merge
- name: generate json for openApi-merge
run: python3 ./docs/bin/json_merge_generator.py

# Step 9: Merge the YAML files
- name: Merge the yaml files
run: npx openapi-merge-cli --config ./openapi-merge.json

# Step 10: Generate the SDK
- name: Generate the SDK
run: npx @openapitools/openapi-generator-cli generate -i ./wordliftApiSpec.yaml -o ./wordlift-sdk -g python --package-name 'Wordlift_client' --library 'asyncio' --additional-properties='generateSourceCodeOnly=true'

# Step 11: Run tests
- name: Run tests
run: |
cd docs
pytest
cd ..
- name: Copy content from current repo to another repo
run: cp api/* python-client/api

# Step 12: Commit and push the changes to the repository
- name: Commit and push changes
run: |
cd wordlift-sdk
cd python-client
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Updated SDK"
git commit -m "Update api"
git push origin main

0 comments on commit 9ed0249

Please sign in to comment.