Skip to content

Commit

Permalink
Run integration tests in CI (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbornet authored Mar 14, 2024
1 parent bf03ed5 commit ba300ed
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/_integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Integration tests

on:
workflow_call:
inputs:
working-directory:
required: true
type: string

env:
POETRY_VERSION: "1.7.1"

jobs:
build:
defaults:
run:
working-directory: ${{ inputs.working-directory }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
# - "3.8"
- "3.11"
name: "make integration_tests #${{ matrix.python-version }}"
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
shell: bash
run: poetry install --with test,test_integration

- name: Run integration tests
shell: bash
env:
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}
ASTRA_DB_KEYSPACE: ${{ secrets.ASTRA_DB_KEYSPACE }}
run: |
make integration_tests
- name: Ensure the tests did not create any additional files
shell: bash
run: |
set -eu
STATUS="$(git status)"
echo "$STATUS"
# grep will exit non-zero if the target message isn't found,
# and `set -e` above will cause the step to fail.
echo "$STATUS" | grep 'nothing to commit, working tree clean'
15 changes: 14 additions & 1 deletion .github/workflows/check_diffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ jobs:
working-directory: ${{ matrix.working-directory }}
secrets: inherit

integration-tests:
name: cd ${{ matrix.working-directory }}
needs: [ build ]
if: ${{ needs.build.outputs.dirs-to-test != '[]' }}
strategy:
matrix:
working-directory: ${{ fromJson(needs.build.outputs.dirs-to-test) }}
uses: ./.github/workflows/_integration_test.yml
with:
working-directory: ${{ matrix.working-directory }}
secrets: inherit

compile-integration-tests:
name: cd ${{ matrix.working-directory }}
needs: [ build ]
Expand All @@ -70,9 +82,10 @@ jobs:
with:
working-directory: ${{ matrix.working-directory }}
secrets: inherit

ci_success:
name: "CI Success"
needs: [build, lint, test, compile-integration-tests]
needs: [build, lint, test, compile-integration-tests, integration-tests]
if: |
always()
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion libs/astradb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ build-backend = "poetry.core.masonry.api"
#
# https://github.com/tophat/syrupy
# --snapshot-warn-unused Prints a warning on unused snapshots rather than fail the test suite.
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5"
addopts = "--snapshot-warn-unused --strict-markers --strict-config --durations=5 -vv"
# Registering custom markers.
# https://docs.pytest.org/en/7.1.x/example/markers.html#registering-markers
markers = [
Expand Down

0 comments on commit ba300ed

Please sign in to comment.