From 3cc68969e8a8c06e4f8c07f852eba89f6fe10e27 Mon Sep 17 00:00:00 2001 From: Ma-Golden <125670894+Ma-Golden@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:30:25 +0000 Subject: [PATCH 1/6] Create backend-ci.yml --- .github/workflows/backend-ci.yml | 60 ++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/backend-ci.yml diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml new file mode 100644 index 0000000..6b4ae5b --- /dev/null +++ b/.github/workflows/backend-ci.yml @@ -0,0 +1,60 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Backend CI + +on: + push: + branches: [ "develop", "main" ] + pull_request: + branches: [ "develop" ] + +permissions: + contents: read + +jobs: + lint: + name: Lint Python Code (PEP8) + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + cd server + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install flake8 black + - name: Run flake8 (Linting) + run: | + cd server + flake8 src/ tests/ + - name: Run Black (Formatting Check) + run: | + cd server + black --check src/ tests/ + test: + name: Run Backend Tests + runs-on: ubuntu-latest + needs: lint # Ensures linting passes before running tests + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Create .env file in CI + run: | + cd server + echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env" + echo "SUPABASE_URL=${{ secrets.SUPABASE_KEY }} >> .env" + - name: Run Tests + run: | + cd server + pytest tests/ --ignore=tests/test_database_connection.py From 8922b7e64a30d73e80630081dae44228dd2e43fe Mon Sep 17 00:00:00 2001 From: Cormac Sharkey <101349412+CormacSharkey@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:40:43 +0000 Subject: [PATCH 2/6] Update backend-ci.yml --- .github/workflows/backend-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 6b4ae5b..262eb3d 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -39,7 +39,7 @@ jobs: - name: Run Black (Formatting Check) run: | cd server - black --check src/ tests/ + black --check --diff src/ tests/ test: name: Run Backend Tests runs-on: ubuntu-latest From 673470154a54ebb5391510363b1057e214adef04 Mon Sep 17 00:00:00 2001 From: Mark Golden Date: Fri, 14 Feb 2025 12:11:06 +0000 Subject: [PATCH 3/6] fina check --- server/src/luas_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/luas_api.py b/server/src/luas_api.py index 9ccd52a..01bf48f 100644 --- a/server/src/luas_api.py +++ b/server/src/luas_api.py @@ -68,8 +68,8 @@ def get(self, stop): while True: stop = str( input( - 'Enter stop code to see live arrivals and departures,' - 'or "exit" to leave: ' + "Enter stop code to see live arrivals and departures," + ' or "exit" to leave: ' ) ) if stop == "exit": From 625eff8ef72a78391ed80e2f32f52eabe1392827 Mon Sep 17 00:00:00 2001 From: Ma-Golden <125670894+Ma-Golden@users.noreply.github.com> Date: Fri, 14 Feb 2025 12:20:40 +0000 Subject: [PATCH 4/6] Update backend-ci.yml --- .github/workflows/backend-ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 262eb3d..f8294d4 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -30,7 +30,6 @@ jobs: run: | cd server python -m pip install --upgrade pip - pip install -r requirements.txt pip install flake8 black - name: Run flake8 (Linting) run: | @@ -48,12 +47,24 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + cd server + python -m pip install --upgrade pip + pip install -r requirements.txt - name: Create .env file in CI run: | cd server echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env" echo "SUPABASE_URL=${{ secrets.SUPABASE_KEY }} >> .env" + - name: Run Tests run: | cd server From a9141c45aef14f5e90f4a77a33652f21274e1bd0 Mon Sep 17 00:00:00 2001 From: Ma-Golden <125670894+Ma-Golden@users.noreply.github.com> Date: Fri, 14 Feb 2025 12:28:09 +0000 Subject: [PATCH 5/6] Update backend-ci.yml --- .github/workflows/backend-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index f8294d4..214bdae 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -62,8 +62,10 @@ jobs: - name: Create .env file in CI run: | cd server + touch .env echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env" echo "SUPABASE_URL=${{ secrets.SUPABASE_KEY }} >> .env" + echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }} >> .env" - name: Run Tests run: | From b1e425181d603be796f64a8138aa930ab9fd36e2 Mon Sep 17 00:00:00 2001 From: Ma-Golden <125670894+Ma-Golden@users.noreply.github.com> Date: Fri, 14 Feb 2025 12:40:05 +0000 Subject: [PATCH 6/6] Update backend-ci.yml --- .github/workflows/backend-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 214bdae..e11bb12 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -63,9 +63,9 @@ jobs: run: | cd server touch .env - echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env" - echo "SUPABASE_URL=${{ secrets.SUPABASE_KEY }} >> .env" - echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }} >> .env" + echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> .env + echo "SUPABASE_URL=${{ secrets.SUPABASE_KEY }}" >> .env + echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" >> .env - name: Run Tests run: |