diff --git a/.github/workflows/safe_pr_checks.yml b/.github/workflows/safe_pr_checks.yml index 6225371fc..0d7db876c 100644 --- a/.github/workflows/safe_pr_checks.yml +++ b/.github/workflows/safe_pr_checks.yml @@ -1,69 +1,40 @@ name: CI Checks - Safe -on: [ - pull_request -] +on: + push: + branches: + - main + pull_request: jobs: - Autoformat: + Check-All: runs-on: ubuntu-latest steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code + - name: Checkout uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: make black-ci - Check-Migrations: - runs-on: ubuntu-latest - steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: make init-db - - run: make check-migrations + - name: Docker Compose Build + run: make compose-build - Lint: - runs-on: ubuntu-latest - steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: make pylint + - name: Format + run: make black-ci - Check-Types: - runs-on: ubuntu-latest - steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: make mypy + - name: Lint + run: make pylint - Unit-Tests: - runs-on: ubuntu-latest - steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: make pytest + - name: Check Types + run: make mypy - Integration-Tests-Access: - runs-on: ubuntu-latest - steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: make pytest-integration-access + - name: Init DB + run: make init-db - Integration-Tests-Erasure: - runs-on: ubuntu-latest - steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code - uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: make pytest-integration-erasure + - name: Check Migrations + run: make check-migrations + + - name: Unit Tests + run: make pytest + + - name: Integration Tests (Access) + run: make pytest-integration-access + + - name: Integration Tests (Erasure) + run: make pytest-integration-erasure \ No newline at end of file diff --git a/.github/workflows/unsafe_pr_checks.yml b/.github/workflows/unsafe_pr_checks.yml index 6f12affe3..9e6b347ec 100644 --- a/.github/workflows/unsafe_pr_checks.yml +++ b/.github/workflows/unsafe_pr_checks.yml @@ -1,6 +1,8 @@ name: CI Checks - Unsafe on: push: + branches: + - main pull_request: types: [labeled] @@ -9,12 +11,11 @@ jobs: runs-on: ubuntu-latest if: contains(github.event.pull_request.labels.*.name, 'run unsafe ci checks') steps: - - run: echo "Running CI for branch ${{ github.ref }}." - - name: Check out repository code + - name: Checkout uses: actions/checkout@v2 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - name: Run unit tests that connect to an external db + + - name: Integration Tests (External) env: REDSHIFT_TEST_URI: ${{ secrets.REDSHIFT_TEST_URI }} SNOWFLAKE_TEST_URI: ${{ secrets.SNOWFLAKE_TEST_URI }} - run: make pytest-external-integration + run: make pytest-integration-external diff --git a/Makefile b/Makefile index 90ee02831..2e59c9177 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ docker-push: # CI #################### -check-all: black-ci pylint mypy pytest pytest-integration check-migrations +check-all: black-ci pylint mypy check-migrations pytest pytest-integration-access pytest-integration-erasure black-ci: compose-build @echo "Running black checks..." @@ -99,7 +99,7 @@ mypy: compose-build pytest: compose-build @echo "Running pytest unit tests..." @docker-compose run $(IMAGE_NAME) \ - pytest $(pytestpath) -m "not integration and not integration_erasure and not external_integration" + pytest $(pytestpath) -m "not integration and not integration_erasure and not integration_external" # Run the pytest integration tests. pytest-integration-access: compose-build @@ -124,10 +124,10 @@ pytest-integration-erasure: compose-build pytest $(pytestpath) -m "integration_erasure" # These tests connect to external third-party test databases -pytest-external-integration: compose-build +pytest-integration-external: compose-build @echo "Running tests that connect to external third party test databases" @docker-compose run -e REDSHIFT_TEST_URI -e SNOWFLAKE_TEST_URI $(IMAGE_NAME) \ - pytest $(pytestpath) -m "external_integration" + pytest $(pytestpath) -m "integration_external" #################### diff --git a/tests/integration_tests/test_external_database_connections.py b/tests/integration_tests/test_external_database_connections.py index 46e3ac90b..c1d96467d 100644 --- a/tests/integration_tests/test_external_database_connections.py +++ b/tests/integration_tests/test_external_database_connections.py @@ -59,7 +59,7 @@ def snowflake_test_engine() -> Generator: engine.dispose() -@pytest.mark.external_integration +@pytest.mark.integration_external def test_redshift_example_data(redshift_test_engine): """Confirm that we can connect to the redshift test db and get table names""" inspector = inspect(redshift_test_engine) @@ -78,7 +78,7 @@ def test_redshift_example_data(redshift_test_engine): ] -@pytest.mark.external_integration +@pytest.mark.integration_external def test_snowflake_example_data(snowflake_test_engine): """Confirm that we can connect to the snowflake test db and get table names""" inspector = inspect(snowflake_test_engine)