AJ-1157: Spring Boot 3.2.1 #1029
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, test and publish Python client to PyPI | |
on: | |
pull_request: | |
workflow_call: | |
inputs: | |
new-tag: | |
required: true | |
type: string | |
secrets: | |
PYPI_API_TOKEN: | |
required: true | |
jobs: | |
build-n-publish: | |
name: Build, test and publish Python client to PyPI | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: [ "5432:5432" ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Use Node.js ${{matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install openapi-generator-cli | |
run: npm install @openapitools/openapi-generator-cli -g | |
- name: set version to 4.3.1 | |
run: openapi-generator-cli version-manager set 4.3.1 | |
- name: Generate Python client | |
run: | | |
openapi-generator-cli generate \ | |
-i service/src/main/resources/static/swagger/openapi-docs.yaml \ | |
-g python \ | |
-o wds-client \ | |
--additional-properties=projectName=wds-client,packageName=wds_client,packageVersion=${{ inputs.new-tag }},httpUserAgent=wds-client/${{ inputs.new-tag }}/python \ | |
--skip-validate-spec | |
- name: Install python package locally | |
working-directory: ./wds-client | |
run: | | |
pip install wheel | |
pip install . | |
- name: Initialize Postgres DB | |
env: | |
PGPASSWORD: postgres | |
run: psql -h 127.0.0.1 -U postgres -f ./local-dev/local-postgres-init.sql | |
- name: Mock Sam via command-line docker run | |
run: | | |
docker run -v ${{ github.workspace }}/service/src/test/resources/nginx.conf:/etc/nginx/nginx.conf:ro -p 9889:80 -d nginx:1.23.3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Run WDS service and tests | |
run: | | |
export SAM_URL=http://localhost:9889 | |
export DATA_REPO_URL=http://localhost:9889 | |
export WORKSPACE_MANAGER_URL=http://localhost:9889 | |
export WORKSPACE_ID=123e4567-e89b-12d3-a456-426614174000 | |
./gradlew --build-cache build -x test | |
./gradlew bootRun & | |
count=20 | |
until $(curl --output /dev/null --silent --head --fail http://localhost:8080/status); do | |
printf '.' | |
sleep 1 | |
count=$(expr $count - 1) | |
if [ "$count" -eq "0" ]; then | |
echo "WDS is not responding, exit action." | |
exit | |
fi | |
done | |
pip install pytest | |
pytest service/src/test/python/test.py | |
- name: Install pypa/build | |
if: ${{ github.ref_name == 'main' }} | |
working-directory: ./wds-client | |
run: >- | |
python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
if: ${{ github.ref_name == 'main' }} | |
working-directory: ./wds-client | |
run: >- | |
python -m build --sdist --wheel --outdir dist/ . | |
- name: Publish distribution to PyPI | |
if: ${{ github.ref_name == 'main' }} | |
uses: broadinstitute/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: ./wds-client/dist | |
skip_existing: true |