Skip to content

Commit b423094

Browse files
authored
Merge pull request #4430 from mathesar-foundation/0.2.3
Release 0.2.3
2 parents da1fae0 + 89d2e18 commit b423094

File tree

36 files changed

+2027
-4415
lines changed

36 files changed

+2027
-4415
lines changed

.github/workflows/test-and-lint-code.yml

Lines changed: 131 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ jobs:
2828
- uses: actions/checkout@v4
2929
- name: Get changed files
3030
id: changed_files
31-
uses: tj-actions/changed-files@v41
31+
uses: tj-actions/changed-files@v46
3232
with:
3333
files: |
3434
*.py
3535
mathesar/**
3636
db/**
37+
- name: echo
38+
run: echo "${{ steps.changed_files.outputs.any_changed }}"
3739

3840
python_lint_required:
3941
name: Check for file changes requiring python linter
@@ -44,9 +46,11 @@ jobs:
4446
- uses: actions/checkout@v4
4547
- name: Get changed files
4648
id: changed_files
47-
uses: tj-actions/changed-files@v41
49+
uses: tj-actions/changed-files@v46
4850
with:
4951
files: '**.py'
52+
- name: echo
53+
run: echo "${{ steps.changed_files.outputs.any_changed }}"
5054

5155
sql_tests_required:
5256
name: Check for file changes requiring SQL tests
@@ -55,13 +59,13 @@ jobs:
5559
tests_should_run: ${{ steps.changed_files.outputs.any_changed }}
5660
steps:
5761
- uses: actions/checkout@v4
58-
- name: echo
59-
run: echo "${{needs.all_tests_required.outputs.tests_should_run}}"
6062
- name: Get changed files
6163
id: changed_files
62-
uses: tj-actions/changed-files@v41
64+
uses: tj-actions/changed-files@v46
6365
with:
6466
files: '**.sql'
67+
- name: echo
68+
run: echo "${{ steps.changed_files.outputs.any_changed }}"
6569

6670
front_end_checks_required:
6771
name: Check for file changes requiring front end checks
@@ -72,9 +76,11 @@ jobs:
7276
- uses: actions/checkout@v4
7377
- name: Get changed files
7478
id: changed_files
75-
uses: tj-actions/changed-files@v41
79+
uses: tj-actions/changed-files@v46
7680
with:
7781
files: 'mathesar_ui/**'
82+
- name: echo
83+
run: echo "${{ steps.changed_files.outputs.any_changed }}"
7884

7985
all_be_tests_required:
8086
name: Check for file changes requiring all backend tests
@@ -85,12 +91,14 @@ jobs:
8591
- uses: actions/checkout@v4
8692
- name: Get changed files
8793
id: changed_files
88-
uses: tj-actions/changed-files@v41
94+
uses: tj-actions/changed-files@v46
8995
with:
9096
files: |
9197
**.yml
9298
**.sh
9399
Dockerfile*
100+
- name: echo
101+
run: echo "${{ steps.changed_files.outputs.any_changed }}"
94102

95103
################################################################################
96104
## BACK END TEST/LINT RUNNERS ##
@@ -110,7 +118,7 @@ jobs:
110118
runs-on: ubuntu-latest
111119
needs: [python_tests_required, all_be_tests_required]
112120
if: needs.python_tests_required.outputs.tests_should_run == 'true' ||
113-
needs.all_be_tests_required.outputs.tests_should_run
121+
needs.all_be_tests_required.outputs.tests_should_run == 'true'
114122
strategy:
115123
matrix:
116124
py-version: [3.9-bookworm, 3.10-bookworm, 3.11-bookworm, 3.12-bookworm, 3.13-bookworm]
@@ -136,7 +144,7 @@ jobs:
136144
runs-on: ubuntu-latest
137145
needs: [sql_tests_required, all_be_tests_required]
138146
if: needs.sql_tests_required.outputs.tests_should_run == 'true' ||
139-
needs.all_be_tests_required.outputs.tests_should_run
147+
needs.all_be_tests_required.outputs.tests_should_run == 'true'
140148
strategy:
141149
matrix:
142150
pg-version: [13, 14, 15, 16, 17]
@@ -160,7 +168,7 @@ jobs:
160168
runs-on: ubuntu-latest
161169
needs: [python_tests_required, all_be_tests_required]
162170
if: needs.python_tests_required.outputs.tests_should_run == 'true' ||
163-
needs.all_be_tests_required.outputs.tests_should_run
171+
needs.all_be_tests_required.outputs.tests_should_run == 'true'
164172
strategy:
165173
matrix:
166174
py-version: [3.9-bookworm, 3.10-bookworm, 3.11-bookworm, 3.12-bookworm, 3.13-bookworm]
@@ -186,7 +194,7 @@ jobs:
186194
runs-on: ubuntu-latest
187195
needs: [python_lint_required, all_be_tests_required]
188196
if: needs.python_lint_required.outputs.lint_should_run == 'true' ||
189-
needs.all_be_tests_required.outputs.tests_should_run
197+
needs.all_be_tests_required.outputs.tests_should_run == 'true'
190198
steps:
191199
- uses: actions/checkout@v4
192200
- uses: actions/setup-python@v4
@@ -360,19 +368,124 @@ jobs:
360368
- run: npm ci --no-audit --prefer-offline
361369
- run: npm test
362370

371+
################################################################################
372+
## BUILD TESTER ##
373+
## ##
374+
## This job tests if we can successfully build mathesar in both development ##
375+
## and production modes we don't use these build for any other tests as they ##
376+
## involve building the frontend which slows down backend tests significantly ##
377+
## and threfore, we test to make sure that we can still build mathesar in ##
378+
## these modes separately. ##
379+
## ##
380+
################################################################################
381+
382+
build_tests:
383+
name: Build mathesar
384+
runs-on: ubuntu-latest
385+
strategy:
386+
matrix:
387+
target: [production, development]
388+
steps:
389+
- uses: actions/checkout@v4
390+
- name: Copy env file
391+
run: cp .env.example .env
392+
# The code is checked out under uid 1001 - reset this to 1000 for the
393+
# container to run tests successfully
394+
- name: Fix permissions
395+
run: sudo chown -R 1000:1000 .
396+
- name: Build the stack
397+
run: docker compose -f docker-compose.dev.yml up --build -d test-service
398+
env:
399+
TARGET: ${{ matrix.target }}
400+
363401
################################################################################
364402
## REQUIRED TEST/LINT COLLECTORS ##
365-
## Jobs in this section collect outputs from matrix-strategy testing jobs, ##
366-
## since these are otherwise impossible to capture for branch protection ##
367-
## purposes. At the moment, they only need to have each required check as a ##
368-
## dependency. Required checks should skip themselves if no relevant files ##
369-
## have changed. ##
403+
## Jobs in this section collect outputs from testing jobs, since these are ##
404+
## otherwise impossible to capture for branch protection purposes. ##
405+
## At the moment, they only need to have each required check as a dependency. ##
406+
## Required checks should skip themselves if no relevant files have changed. ##
370407
## ##
371408
################################################################################
372409

373-
matrix_tests:
410+
checkpoint:
411+
if: ${{ always() }}
374412
runs-on: ubuntu-latest
375-
needs: [python_tests, sql_tests]
413+
needs:
414+
# Checkers
415+
- python_tests_required
416+
- python_lint_required
417+
- sql_tests_required
418+
- front_end_checks_required
419+
- all_be_tests_required
420+
# Backend tests
421+
- python_tests
422+
- sql_tests
423+
- api_tests
424+
- python_lint
425+
# Frontend tests
426+
- front_end_format
427+
- front_end_lint
428+
- front_end_typecheck
429+
- front_end_audit
430+
- front_end_tests
431+
# Build test
432+
- build_tests
376433
steps:
434+
- name: Check Dependency Results
435+
run: |
436+
# Check "all_be_tests_required" conditions
437+
if [[ "${{ needs.all_be_tests_required.outputs.tests_should_run }}" == "true" ]]; then
438+
if [[ "${{ needs.python_tests.result }}" != "success"
439+
|| "${{ needs.sql_tests.result }}" != "success"
440+
|| "${{ needs.api_tests.result }}" != "success"
441+
|| "${{ needs.python_lint.result }}" != "success"
442+
]]; then
443+
echo "One or more backend tests failed."
444+
exit 1
445+
fi
446+
# Check "python_tests_required" conditions
447+
elif [[ "${{ needs.python_tests_required.outputs.tests_should_run }}" == "true" ]]; then
448+
if [[ "${{ needs.python_tests.result }}" != "success"
449+
|| "${{ needs.api_tests.result }}" != "success"
450+
]]; then
451+
echo "One or more python tests failed."
452+
exit 1
453+
fi
454+
fi
455+
456+
# Check "python_lint_required" conditions
457+
if [[ "${{ needs.python_lint_required.outputs.lint_should_run }}" == "true" ]]; then
458+
if [[ "${{ needs.python_lint.result }}" != "success" ]]; then
459+
echo "python linter failed."
460+
exit 1
461+
fi
462+
fi
463+
464+
# Check "sql_tests_required" conditions
465+
if [[ "${{ needs.sql_tests_required.outputs.tests_should_run }}" == "true" ]]; then
466+
if [[ "${{ needs.sql_tests.result }}" != "success" ]]; then
467+
echo "SQL tests failed."
468+
exit 1
469+
fi
470+
fi
471+
472+
# Check "front_end_checks_required" conditions
473+
if [[ "${{ needs.front_end_checks_required.outputs.checks_should_run }}" == "true" ]]; then
474+
if [[ "${{ needs.front_end_format.result }}" != "success"
475+
|| "${{ needs.front_end_lint.result }}" != "success"
476+
|| "${{ needs.front_end_typecheck.result }}" != "success"
477+
|| "${{ needs.front_end_audit.result }}" != "success"
478+
|| "${{ needs.front_end_tests.result }}" != "success"
479+
]]; then
480+
echo "One or more frontend tests failed."
481+
exit 1
482+
fi
483+
fi
484+
485+
# Check if build succeeds
486+
if [[ "${{ needs.build_tests.result }}" != "success" ]]; then
487+
echo "Build failed."
488+
exit 1
489+
fi
377490
- name: Report success
378491
run: echo "All tests succeeded or skipped!"

.github/workflows/test-build.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

config/settings/common_settings.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,22 @@ def pipe_delim(pipe_string):
117117
for db_key, url_string in [pipe_delim(i) for i in os.environ.get('MATHESAR_DATABASES', default='').split(',') if i != '']
118118
}
119119

120-
# POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_HOST & POSTGRES_PORT are required env variables for forming a pg connection string for the django database
121120
POSTGRES_DB = os.environ.get('POSTGRES_DB', default=None)
122121
POSTGRES_USER = os.environ.get('POSTGRES_USER', default=None)
123122
POSTGRES_PASSWORD = os.environ.get('POSTGRES_PASSWORD', default=None)
124123
POSTGRES_HOST = os.environ.get('POSTGRES_HOST', default=None)
125124
POSTGRES_PORT = os.environ.get('POSTGRES_PORT', default=None)
126125

127-
if POSTGRES_DB and POSTGRES_USER and POSTGRES_PASSWORD and POSTGRES_HOST and POSTGRES_PORT:
128-
DATABASES['default'] = db_url(f'postgres://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}')
126+
# POSTGRES_DB, POSTGRES_USER, and POSTGRES_HOST are required env variables for forming a pg connection string for the django database
127+
# We expect the environment variables to be url-encoded, we do not do additional encoding here
128+
if POSTGRES_DB and POSTGRES_USER and POSTGRES_HOST:
129+
DATABASES['default'] = db_url(
130+
f"postgres://{POSTGRES_USER}"
131+
f"{':' + POSTGRES_PASSWORD if POSTGRES_PASSWORD else ''}"
132+
f"@{POSTGRES_HOST}"
133+
f"{':' + POSTGRES_PORT if POSTGRES_PORT else ''}"
134+
f"/{POSTGRES_DB}"
135+
)
129136

130137
for db_key, db_dict in DATABASES.items():
131138
# Engine should be '.postgresql' or '.postgresql_psycopg2' for all db(s)

db/columns.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def get_column_info_for_table(table, conn):
3232
},
3333
"nullable": <bool>,
3434
"primary_key": <bool>,
35-
"valid_target_types": [<str>, <str>, ..., <str>]
3635
"default": {"value": <str>, "is_dynamic": <bool>},
3736
"has_dependents": <bool>,
3837
"current_role_priv": [<str>, <str>, ...],

db/deprecated/queries/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ def _process_initial_column(initial_col):
223223
and returns the SA column that the initial column represents.
224224
"""
225225
nonlocal from_clause
226-
nonlocal base_table
227-
nonlocal map_of_jp_subpath_to_alias
228-
nonlocal created_joins
229226
jp_path = initial_col.jp_path
230227
right = base_table
231228
for i, jp in enumerate(jp_path):

db/sql/00_msar_all_objects_table.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ INSERT INTO msar.all_mathesar_objects VALUES
922922
('msar', 'msar.cast_to_numeric(real)', 'FUNCTION', NULL),
923923
('msar', 'msar.cast_to_numeric(smallint)', 'FUNCTION', NULL),
924924
('msar', 'msar.cast_to_numeric(text)', 'FUNCTION', NULL),
925+
('msar', 'msar.cast_to_numeric(text,"char","char")', 'FUNCTION', NULL),
925926
('msar', 'msar.cast_to_real(bigint)', 'FUNCTION', NULL),
926927
('msar', 'msar.cast_to_real(boolean)', 'FUNCTION', NULL),
927928
('msar', 'msar.cast_to_real(character varying)', 'FUNCTION', NULL),
@@ -1012,6 +1013,8 @@ INSERT INTO msar.all_mathesar_objects VALUES
10121013
('msar', 'msar.cast_to_uri(text)', 'FUNCTION', NULL),
10131014
('msar', 'msar.cast_to_uuid(text)', 'FUNCTION', NULL),
10141015
('msar', 'msar.cast_to_uuid(uuid)', 'FUNCTION', NULL),
1016+
('msar', 'msar.check_column_numeric_compat(regclass,smallint,numeric)', 'FUNCTION', NULL),
1017+
('msar', 'msar.check_column_type_compat(regclass,smallint,regtype,numeric)', 'FUNCTION', NULL),
10151018
('msar', 'msar.col_description(oid,integer)', 'FUNCTION', NULL),
10161019
('msar', 'msar.collect_all_objects(text[])', 'FUNCTION', NULL),
10171020
('msar', 'msar.column_exists(oid,text)', 'FUNCTION', NULL),
@@ -1034,6 +1037,7 @@ INSERT INTO msar.all_mathesar_objects VALUES
10341037
('msar', 'msar.degrees_to_time(double precision)', 'FUNCTION', NULL),
10351038
('msar', 'msar.delete_records_from_table(oid,jsonb)', 'FUNCTION', NULL),
10361039
('msar', 'msar.describe_column_default(regclass,smallint)', 'FUNCTION', NULL),
1040+
('msar', 'msar.downsize_table_sample(numeric)', 'FUNCTION', NULL),
10371041
('msar', 'msar.drop_columns(oid,integer[])', 'FUNCTION', NULL),
10381042
('msar', 'msar.drop_columns(text,text,text[])', 'FUNCTION', NULL),
10391043
('msar', 'msar.drop_constraint(oid,oid)', 'FUNCTION', NULL),
@@ -1055,6 +1059,7 @@ INSERT INTO msar.all_mathesar_objects VALUES
10551059
('msar', 'msar.expr_templates', 'TYPE', NULL),
10561060
('msar', 'msar.extract_columns_from_table(oid,integer[],text,text)', 'FUNCTION', NULL),
10571061
('msar', 'msar.extract_smallints(jsonb)', 'FUNCTION', NULL),
1062+
('msar', 'msar.find_numeric_separators(regclass,smallint,numeric)', 'FUNCTION', NULL),
10581063
('msar', 'msar.format_data(anyelement)', 'FUNCTION', NULL),
10591064
('msar', 'msar.format_data(date)', 'FUNCTION', NULL),
10601065
('msar', 'msar.format_data(interval)', 'FUNCTION', NULL),
@@ -1180,6 +1185,7 @@ INSERT INTO msar.all_mathesar_objects VALUES
11801185
('msar', 'msar.transfer_database_ownership(regrole)', 'FUNCTION', NULL),
11811186
('msar', 'msar.transfer_schema_ownership(regnamespace,regrole)', 'FUNCTION', NULL),
11821187
('msar', 'msar.transfer_table_ownership(regclass,regrole)', 'FUNCTION', NULL),
1188+
('msar', 'msar.type_compat_details', 'TYPE', NULL),
11831189
('msar', 'msar.update_pk_sequence_to_latest(oid,integer)', 'FUNCTION', NULL),
11841190
('msar', 'msar.update_pk_sequence_to_latest(text,text,text)', 'FUNCTION', NULL),
11851191
('msar', 'msar.uri_authority(text)', 'FUNCTION', NULL),

0 commit comments

Comments
 (0)