Skip to content

Commit a43a773

Browse files
Version 1.7.2 (#454)
* Fix map issues * Add projects to todo list * Fix and refactor ascent list skeletons * Fix menu overflow issue * Fix login infinity loop * Add contributors to the Readme file * Fix confusing renamed import of pbkdf2_sha256 * Fix broken ascent records * Docker-Compose-based Development Setup (#463) * Added SMTP_TYPE to config * Fixed AttributeError when relaunching an instance while having an session running * Added Docker Compose Dev Setup * Added SPACES_ADDRESSING option to account for MinIO path addressing in dev setup * Fixed generated upload urls and bucket placeholder generation * Slightly improved password formatting in registration mail since I copied the whitespace before way too many times * Added documentation for docker setup * Escaped all $ in docker-compose.yml * Update license * Fix conflicting license files * Show LC logo as favicon if no favicon is set * Rework project climbed message feature * Fix tests * Add flake8 and format according to it * Reformat server code according to black style * Add isort config and order imports according to config * Move linting tools to dev packages * Update readme, add dev tooling docs * Add pre commit config * Fix black version in pre commit hook * Fix branches in pipelines to match version branches and add server linting pipeline * Update linting pipeline * Update linting pipeline * Update linting pipeline * Reformat linting pipeline yml * Restructuring of Server Tests (#474) * Added type hints to BaseEntity * update_slugs() now listens for 'before_flush' * Merged upstream branch * Reworked test setup: All tests are now capsuled in a transaction and the database is populated from Python, not a psql dump * Reworked test_region_resources as sample * Monkey patched test client to improve using a JWT in tests * Adjusted docker setup for testing * Tests: Migrated some more sample data * Finished migrating test data * Event listeners need to be re-registered for every db session in testing * Updated test_area_resources to new test design * Migrated test_instance_settings # Conflicts: # server/tests/test_instance_settings_resources.py * Migrated test_crag_resources * Migrated all auth_resources tests except for SMTP stuff * Migrated ascent_resources * Migrated test_line_path_resources * Migrated test_line_resources * Fixed sample data * Migrated test_menu_item_resources * Migrated test_menu_page_resources * Migrated test_menu_page_resources * Migrated test_ranking_resources * Migrated test_search_resources * Migrated test_secret_spots * Migrated test_sector_resources * Migrated test_todo_resources * Migrated test_topo_image_resources * Migrated test_upload_resources * Migrated test_user_resources * Migrated test_health_resources * Updated SMTP mock counts as we only have 1 admin * SuperadminEmail has been removed from instance_settings in v1.7.2 * Clean environment, so we read values from test-ci.cfg * test_topo_image_resources: Fixed comparison with wrong value * Addressed MR reviews and improved testing in docker setup * Cleaned up test dump and user_test_util * Dockerfile: aliases for easy usage of flake8, black and isort * Including tests into black and isort coverage * black and isort on tests * Remove restoring dump for test pipline db * Use even numbered node version in frontend tests * Fix node versions and add command to create dumps directory if it does not exist * Try cypress pipeline fix * Try cypress pipeline fix * Try cypress pipeline fix * Fix cypress login credentials * Fix test user slug * Add eslint and prettier * Prettify client code * Optimize frontend imports * Optimize frontend imports * Optimize frontend imports * Fix linting issues * Fix linting issues * Fix linting issues * Prettier * Fix build issues * Add frontend linting to pipeline * Update linting pipe node version * Fix linting issue * Fix pipeline * Run prettier * Replace pre-commit with husky --------- Co-authored-by: BlobbyBob <[email protected]>
1 parent 6da2355 commit a43a773

File tree

679 files changed

+23531
-15893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

679 files changed

+23531
-15893
lines changed

.github/workflows/backend-unit-tests.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44
branches:
55
- main
6-
- next
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
77
jobs:
88
backend-unit-tests:
99
environment: Testing
@@ -45,10 +45,9 @@ jobs:
4545
cd server/src
4646
pipenv install
4747
48-
- name: Setup database with test dump
48+
- name: Add UUID extension to test database
4949
run: |
5050
export PGPASSWORD='postgres'; psql -h 0.0.0.0 -p 5432 -U postgres -d localcrag_test < server/scripts/create_uuid_extension.sql
51-
export PGPASSWORD='postgres'; pg_restore --no-privileges --no-owner -h 0.0.0.0 -p 5432 -U postgres -d localcrag_test server/tests/dumps/localcrag_test_dump.sql
5251
5352
- name: Run Tests
5453
run: |

.github/workflows/check-frontend-prod-build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44
branches:
55
- main
6-
- next
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
77
jobs:
88
frontend-prod-build-check:
99
runs-on: ubuntu-latest
@@ -12,10 +12,10 @@ jobs:
1212
working-directory: ./client
1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Use latest node.js
15+
- name: Use node.js v22
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: latest
18+
node-version: 22
1919
- name: Install dependencies
2020
run: npm install
2121
- name: Build production bundle

.github/workflows/check-migrate-from-empty-db.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44
branches:
55
- main
6-
- next
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
77
jobs:
88
check-migrate-from-empty-db:
99
environment: Testing

.github/workflows/check-migrate-from-prod-db.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44
branches:
55
- main
6-
- next
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
77
jobs:
88
check-migrate-from-prod-db:
99
environment: Testing
@@ -49,6 +49,7 @@ jobs:
4949
run: |
5050
echo "${{ secrets.BACKUP_SERVER_SSH_KEY }}" >> backup_key.pem
5151
chmod 600 backup_key.pem
52+
mkdir -p server/tests/dumps
5253
scp -i backup_key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${{ secrets.BACKUP_SERVER_USER }}@${{ secrets.BACKUP_SERVER_IP }}:${{ secrets.BACKUP_SERVER_DUMPPATH }} server/tests/dumps/localcrag_prod_dump.sql
5354
5455
- name: Setup database with prod dump

.github/workflows/cypress-e2e-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44
branches:
55
- main
6-
- next
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
77
jobs:
88
cypress-run:
99
runs-on: ubuntu-latest
@@ -54,7 +54,7 @@ jobs:
5454
- name: Setup database
5555
run: |
5656
export PGPASSWORD='postgres'; psql -h 0.0.0.0 -p 5432 -U postgres -d localcrag_test < server/scripts/create_uuid_extension.sql
57-
export PGPASSWORD='postgres'; pg_restore --no-privileges --no-owner -h 0.0.0.0 -p 5432 -U postgres -d localcrag_test server/tests/dumps/localcrag_test_dump.sql
57+
cd server && PYTHONPATH=.:src LOCALCRAG_CONFIG=config/test-ci-e2e.cfg pipenv run python3 scripts/setup_cypress_db.py
5858
5959
- name: Copy assets
6060
run: |

.github/workflows/frontend-unit-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44
branches:
55
- main
6-
- next
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
77
jobs:
88
frontend-unit-tests:
99
runs-on: ubuntu-latest
@@ -12,10 +12,10 @@ jobs:
1212
working-directory: ./client
1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Use latest node.js
15+
- name: Use node.js v22
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: latest
18+
node-version: 22
1919
- name: Install dependencies
2020
run: npm install
2121
- name: Run unit tests

.github/workflows/linting.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Linting Pipeline
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
jobs:
8+
lint-server:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Set up Python 3.11
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.11
17+
18+
- name: Install dependencies
19+
run: |
20+
pip install pipenv
21+
cd server
22+
pipenv install --dev
23+
24+
- name: Run Flake8
25+
run: |
26+
cd server
27+
pipenv run flake8 .
28+
29+
- name: Run Black
30+
run: |
31+
cd server
32+
pipenv run black --check .
33+
34+
- name: Run Isort
35+
run: |
36+
cd server
37+
pipenv run isort --check-only .
38+
lint-client:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v3
42+
43+
- name: Install Node.js
44+
uses: actions/setup-node@v3
45+
with:
46+
node-version: '22'
47+
48+
- name: Install dependencies
49+
run: |
50+
cd client
51+
npm install
52+
53+
- name: Run ESLint
54+
run: |
55+
cd client
56+
npm run lint
57+
58+
- name: Run Prettier
59+
run: |
60+
cd client
61+
npx prettier --check .

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
.idea
1+
.idea
2+
node_modules
3+
.husky/_/

.husky/pre-commit

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cd client
2+
npx prettier --write .
3+
npm run lint
4+
cd ..
5+
cd server
6+
pipenv run black .
7+
pipenv run flake8 .
8+
pipenv run isort .

Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM python AS localcragapp-server
2+
RUN pip install pipenv
3+
ENV PYTHONPATH=/localcragapp/src
4+
RUN mkdir /.local && chown 1000:1000 /.local
5+
RUN echo 'alias pytest="SQLALCHEMY_DATABASE_URI=${SQLALCHEMY_DATABASE_URI}_test LOCALCRAG_CONFIG=/localcragapp/src/config/test-ci.cfg env -u SPACES_SECRET_KEY -u SPACES_ACCESS_KEY -u SPACES_ENDPOINT -u SPACES_ACCESS_ENDPOINT -u SPACES_REGION -u SPACES_BUCKET -u SPACES_ADDRESSING -u SMTP_HOST -u SMTP_USER -u SMTP_PASSWORD -u SMTP_PORT -u SMTP_TYPE pipenv run pytest"' >> /tmp/aliases && \
6+
echo 'alias flake8="pipenv run flake8"' >> /tmp/aliases && \
7+
echo 'alias black="pipenv run black --config=/localcragapp/pyproject.toml"' >> /tmp/aliases && \
8+
echo 'alias isort="pipenv run isort --settings-path=/localcragapp/pyproject.toml"' >> /tmp/aliases && \
9+
cat /tmp/aliases >> /etc/profile && \
10+
cat /tmp/aliases >> /etc/bash.bashrc
11+
USER 1000:1000
12+
WORKDIR /localcragapp
13+
COPY ./server/.flake8 /localcragapp/.flake8
14+
COPY ./server/pyproject.toml /localcragapp/pyproject.toml
15+
COPY ./server/Pipfile /localcragapp/Pipfile
16+
COPY ./server/Pipfile.lock /localcragapp/Pipfile.lock
17+
RUN pipenv install --dev
18+
USER root
19+
RUN chown -R 1000:1000 /localcragapp
20+
USER 1000:1000
21+
WORKDIR /localcragapp/src
22+
23+
FROM node AS localcragapp-client
24+
USER 1000:1000
25+
WORKDIR /localcragapp
26+
COPY ./client .
27+
RUN npm ci

0 commit comments

Comments
 (0)