Skip to content

Commit

Permalink
infra: Pre-release integration tests for partner pkgs (#14687)
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan authored Dec 14, 2023
1 parent 74211aa commit ba897fc
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,15 @@ jobs:
# - Tests pass, because the dependency is present even though it wasn't specified.
# - The package is published, and it breaks on the missing dependency when
# used in the real world.
- uses: actions/setup-python@v4

- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}

- name: Test published package
- name: Import published package
shell: bash
env:
PKG_NAME: ${{ needs.build.outputs.pkg-name }}
Expand All @@ -118,7 +122,6 @@ jobs:
# (https://test.pypi.org/simple). This will include the PKG_NAME==VERSION
# package because VERSION will not have been uploaded to regular PyPI yet.
#
# TODO: add more in-depth pre-publish tests after testing that importing works
run: |
pip install \
--extra-index-url https://test.pypi.org/simple/ \
Expand All @@ -130,6 +133,31 @@ jobs:
python -c "import $IMPORT_NAME; print(dir($IMPORT_NAME))"
- name: Import test dependencies
if: ${{ startsWith(inputs.working-directory, 'libs/partners/') }}
run: poetry install --with test,test_integration
working-directory: ${{ inputs.working-directory }}

# Overwrite the local version of the package with the test PyPI version.
- name: Import published package (again)
if: ${{ startsWith(inputs.working-directory, 'libs/partners/') }}
shell: bash
env:
PKG_NAME: ${{ needs.build.outputs.pkg-name }}
VERSION: ${{ needs.build.outputs.version }}
run: |
poetry run pip install \
--extra-index-url https://test.pypi.org/simple/ \
"$PKG_NAME==$VERSION"
- name: Run integration tests
if: ${{ startsWith(inputs.working-directory, 'libs/partners/') }}
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
run: make integration_tests
working-directory: ${{ inputs.working-directory }}


publish:
needs:
- build
Expand Down

0 comments on commit ba897fc

Please sign in to comment.