Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleaning up and renaming #937

Merged
merged 18 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
react-client-app/node_modules
next-client-app/node_modules
69 changes: 0 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,6 @@ name: ci
on: [pull_request]

jobs:
# pylint:
# runs-on: ubuntu-latest
# if: "!contains(github.event.head_commit.message, '[ci skip]')"
# env:
# RUNNER_ALLOW_RUNASROOT: true
# steps:
# - uses: actions/checkout@v2
# - name: Fetch master
# run: git fetch origin master:refs/remotes/origin/master
# - name: Install pylint
# run: pip3 install pylint
# - name: List changed files
# run: |
# echo `git diff origin/master HEAD --name-only | grep .py` >> changed.txt
# - name: Check PEP8
# run: |
# while read file; do
# echo $file
# pylint $file
# done < changed.txt
#
format_python_code:
runs-on: ubuntu-latest
steps:
Expand All @@ -36,69 +15,21 @@ jobs:
path: "."
black_flags: "--safe --verbose --diff"
build:
#needs: pylint
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
env:
RUNNER_ALLOW_RUNASROOT: true
COCONNECT_DB_HOST: ${{ secrets.COCONNECT_DB_HOST }}
COCONNECT_DB_PORT: ${{ secrets.COCONNECT_DB_PORT }}
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Make envfile
run: |
touch .env

echo COCONNECT_DB_ENGINE=django.db.backends.postgresql >> .env
echo COCONNECT_DB_HOST=${{ secrets.COCONNECT_DB_HOST }} >> .env
echo COCONNECT_DB_NAME=${{ secrets.COCONNECT_DB_DB }} >> .env
echo COCONNECT_DB_PORT=${{ secrets.COCONNECT_DB_PORT }} >> .env
echo COCONNECT_DB_PASSWORD=${{ secrets.COCONNECT_DB_PASSWORD }} >> .env
echo COCONNECT_DB_USER=${{ secrets.COCONNECT_DB_USER }} >> .env
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> .env
echo DEBUG=True >> .env
echo ALLOWED_HOSTS=['localhost'] >> .env

- name: Build the docker image
working-directory: ./app
run: docker build -f api/Dockerfile -t ccom-build:latest .
- name: Run the docker image
run: |
#startup the stack
docker run -it --env-file .env -p 8080:8000 -d ccom-build:latest
#give it 30s to start properly
sleep 30s
#get container ID
containerid=$(docker ps | awk 'NR==2' | awk '{print $1;}')
echo $containerid
#check the logs for errors
if docker logs $containerid | grep -i -q ERROR ; then
#print the errors before causing a fail
docker logs $containerid | grep -i ERROR
echo "Errors found"
exit 1
else
echo "No errors found!"
fi
echo "ended if"
#put the logs into a file
docker logs $containerid >> logs.out
#shutdown the container
docker stop $containerid
#save the logs so they can be further checked
- uses: actions/upload-artifact@v3
with:
name: my-artifact
path: logs.out
retention-days: 1

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies and build Next.js app
run: |
npm install
Expand Down
132 changes: 66 additions & 66 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -86,67 +86,67 @@ jobs:
junitxml-path: app/workers/pytest.xml

test-django:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
django-version: [ '4.2', '5']

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: app/api
run: poetry install --no-interaction --no-root

- name: Install django ${{ matrix.django-version }}
working-directory: app/api
run: |
poetry run python -m venv .venv
source .venv/bin/activate
pip install "Django==${{ matrix.django-version }}"

- name: Test with Django
env:
SECRET_KEY: 'test'
ALLOWED_HOSTS: "['localhost']"
COCONNECT_DB_ENGINE: "django.db.backends.postgresql"
COCONNECT_DB_HOST: "localhost"
COCONNECT_DB_NAME: "test"
COCONNECT_DB_PASSWORD: "postgres"
COCONNECT_DB_PORT: "5432"
COCONNECT_DB_USER: "postgres"
working-directory: app/api
run: |
poetry run pytest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
django-version: ["4.2", "5"]

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: app/api
run: poetry install --no-interaction --no-root

- name: Install django ${{ matrix.django-version }}
working-directory: app/api
run: |
poetry run python -m venv .venv
source .venv/bin/activate
pip install "Django==${{ matrix.django-version }}"

- name: Test with Django
env:
SECRET_KEY: "test"
ALLOWED_HOSTS: "['localhost']"
DB_ENGINE: "django.db.backends.postgresql"
DB_HOST: "localhost"
DB_NAME: "test"
DB_PASSWORD: "postgres"
DB_PORT: "5432"
DB_USER: "postgres"
working-directory: app/api
run: |
poetry run pytest
6 changes: 1 addition & 5 deletions .vscode/carrot.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@
"name": "app/shared",
"path": "../app/shared"
},
{
"name": "app/react-client-app",
"path": "../app/react-client-app"
},
{
"name": "app/next-client-app",
"path": "../app/next-client-app"
},
}
],
"extensions": {
"recommendations": [
Expand Down
57 changes: 0 additions & 57 deletions app/api/api/deprecated_router.py

This file was deleted.

Loading
Loading