Skip to content

Change life time of AWS servers from 4 to 6 years (#354) (#357) #29

Change life time of AWS servers from 4 to 6 years (#354) (#357)

Change life time of AWS servers from 4 to 6 years (#354) (#357) #29

name: build_client_sdk_with_poetry
on:
push:
tags:
- '*'
paths-ignore:
- 'docs/**'
- 'test/**'
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'
- 'Dockerfile'
- 'CITATION'
- 'book.toml'
- 'CONTRIBUTING.md'
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build_python_client_sdk
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pipenv
run: |
python -m pip install --upgrade poetry wheel twine
- id: cache-pipenv
uses: actions/cache@v4
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
make install
- name: Build local api package
run: make build
- name: Build the api Docker image
run: docker build --build-arg VERSION=$(poetry version -s) . --file Dockerfile --tag boaviztapi:latest
- name: Run the API locally
run: |
docker run -p "5000:5000" --name=boaviztapi -tid boaviztapi:latest
- name: Get logs from the API container in case of a failure
run: |
docker logs boaviztapi
- name: Get the openapi.json definition and generate the code
run: |
while [[ ! $(docker ps | grep boaviztapi) ]]; do sleep 1; echo "Waiting for BoaviztAPI container to boot"; done
wget http://127.0.0.1:5000/openapi.json
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i /local/openapi.json -g python -o /local/boaviztapi_sdk --package-name boaviztapi_sdk
# Publish client SDK package
- name: Build the pip package and push it
run: |
sudo chown -R $(whoami) boaviztapi_sdk
SDK_VERSION=$(poetry version -s)
echo "SDK_VERSION == ${SDK_VERSION}"
cd boaviztapi_sdk
sed -i "s/^VERSION.*/VERSION = \"${SDK_VERSION}\"/" setup.py
sed -i "s/^ long_description=.*/ long_description='Python SDK for boaviztAPI',/" setup.py
sed -i '/ <p>.*/d' setup.py
sed -i '/ """.*/d' setup.py
python3 setup.py sdist
# Publish
pip3 install pipenv twine
pipenv run twine upload --repository pypi --username __token__ --password ${{ secrets.BPETIT_SECRET_PYPI_TOKEN }} dist/*