Skip to content
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
73 changes: 73 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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 flake8 black
- name: Run flake8 (Linting)
run: |
cd server
flake8 src/ tests/
- name: Run Black (Formatting Check)
run: |
cd server
black --check --diff 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: 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
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: |
cd server
pytest tests/ --ignore=tests/test_database_connection.py
4 changes: 2 additions & 2 deletions server/src/luas_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down