Skip to content

Commit

Permalink
Merge pull request #3399 from mathesar-foundation/fix_gh_actions
Browse files Browse the repository at this point in the history
Fix gh workflow
  • Loading branch information
mathemancer authored Jan 19, 2024
2 parents 1a14e80 + df9b48f commit fa0e67f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
42 changes: 32 additions & 10 deletions .github/workflows/test-and-lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
tests_should_run: ${{ steps.changed_files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
- name: echo
run: echo "${{needs.all_tests_required.outputs.tests_should_run}}"
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v41
Expand All @@ -74,6 +76,22 @@ jobs:
with:
files: 'mathesar_ui/**'

all_be_tests_required:
name: Check for file changes requiring all backend tests
runs-on: ubuntu-latest
outputs:
tests_should_run: ${{ steps.changed_files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v41
with:
files: |
**.yml
**.sh
Dockerfile*
################################################################################
## BACK END TEST/LINT RUNNERS ##
## ##
Expand All @@ -90,8 +108,9 @@ jobs:
python_tests:
name: Run Python tests
runs-on: ubuntu-latest
needs: python_tests_required
if: needs.python_tests_required.outputs.tests_should_run == 'true'
needs: [python_tests_required, all_be_tests_required]
if: needs.python_tests_required.outputs.tests_should_run == 'true' ||
needs.all_be_tests_required.outputs.tests_should_run
strategy:
matrix:
pg-version: [13, 14, 15]
Expand All @@ -104,7 +123,7 @@ jobs:
- name: Fix permissions
run: sudo chown -R 1000:1000 .
- name: Build the stack
run: docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d test-service
run: docker compose -f docker-compose.dev.yml up --build -d test-service
env:
PG_VERSION: ${{ matrix.pg-version }}
- name: Run tests with pytest
Expand All @@ -113,8 +132,9 @@ jobs:
sql_tests:
name: Run SQL tests
runs-on: ubuntu-latest
needs: sql_tests_required
if: needs.sql_tests_required.outputs.tests_should_run == 'true'
needs: [sql_tests_required, all_be_tests_required]
if: needs.sql_tests_required.outputs.tests_should_run == 'true' ||
needs.all_be_tests_required.outputs.tests_should_run
strategy:
matrix:
pg-version: [13, 14, 15]
Expand All @@ -127,7 +147,7 @@ jobs:
- name: Fix permissions
run: sudo chown -R 1000:1000 .
- name: Build the test DB
run: docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d dev-db
run: docker compose -f docker-compose.dev.yml up --build -d dev-db
env:
PG_VERSION: ${{ matrix.pg-version }}
- name: Run tests with pg_prove
Expand All @@ -136,8 +156,9 @@ jobs:
python_lint:
name: Run Python linter
runs-on: ubuntu-latest
needs: python_lint_required
if: needs.python_lint_required.outputs.lint_should_run == 'true'
needs: [python_lint_required, all_be_tests_required]
if: needs.python_lint_required.outputs.lint_should_run == 'true' ||
needs.all_be_tests_required.outputs.tests_should_run
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand All @@ -153,8 +174,9 @@ jobs:
vulture:
name: Find unused code
runs-on: ubuntu-latest
needs: python_lint_required
if: needs.python_lint_required.outputs.lint_should_run == 'true'
needs: [python_lint_required, all_be_tests_required]
if: needs.python_lint_required.outputs.lint_should_run == 'true' ||
needs.all_be_tests_required.outputs.tests_should_run
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,25 @@ services:
- "8000:8000"
- "3000:3000"
- "6006:6006"
test-service:
container_name: mathesar_service_test
image: mathesar/mathesar-test:latest
environment:
- MATHESAR_DATABASES=(mathesar_tables|postgresql://mathesar:mathesar@mathesar_dev_db:5432/mathesar)
- POSTGRES_DB=mathesar_django
- POSTGRES_USER=mathesar
- POSTGRES_PASSWORD=mathesar
- POSTGRES_HOST=mathesar_dev_db
- POSTGRES_PORT=5432
build:
context: .
dockerfile: Dockerfile
args:
PYTHON_REQUIREMENTS: requirements-dev.txt
depends_on:
- dev-db
ports:
- "8000:8000"
volumes:
ui_node_modules:
dev_postgres_data:
1 change: 0 additions & 1 deletion mathesar/tests/api/test_table_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def test_update_table_settings_negative_column_order(client, column_test_table):
data=data,
)
response_data = response.json()[0]
print(response_data)
assert response.status_code == 400
assert response_data['code'] == ErrorCodes.InvalidColumnOrder.value
assert response_data['message'] == 'Invalid column order.'

0 comments on commit fa0e67f

Please sign in to comment.