[CORE-69]: Bump the minor-and-patch-updates group across 1 directory with 2 updates #3158
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@v5 | |
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 7.8.0 | |
run: openapi-generator-cli version-manager set 7.8.0 | |
- 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 || '0.0.0' }},httpUserAgent=wds-client/${{ inputs.new-tag || '0.0.0'}}/python | |
- 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 APIs via command-line docker run | |
run: | | |
docker run -v ${{ github.workspace }}/service/src/test/resources/nginx.conf:/etc/nginx/nginx.conf:ro -v ${{ github.workspace }}/service/src/test/resources:/usr/share/nginx/html -p 9889:80 -d nginx:1.23.3 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Run WDS service and tests | |
run: | | |
export SAM_URL=http://localhost:9889 | |
export WORKSPACE_MANAGER_URL=http://localhost:9889 | |
export WORKSPACE_ID=123e4567-e89b-12d3-a456-426614174000 | |
export SPRING_PROFILES_ACTIVE=data-plane,local | |
./gradlew --build-cache build -x test | |
# Allow http imports from localhost to test with files from resources served by the mock API server | |
./gradlew bootRun --args='--twds.data-import.require-validation=false' & | |
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 |