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

Setup github actions #146

Merged
merged 18 commits into from
Sep 15, 2024
Merged
38 changes: 38 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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: Python application
Matt343 marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with unittest
run: |
SKIP_SLOW=true python -m unittest discover -v -s ./src/tester
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ python-dotenv == 1.0.1
requests == 2.32.3
retry == 0.9.2
statistics == 1.0.3.5
xxhash == 3.5.0
xxhash == 3.5.0
Matt343 marked this conversation as resolved.
Show resolved Hide resolved
flake8
3 changes: 3 additions & 0 deletions src/tester/test_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from cleaner import Cleaner
from updater import Updater

SKIP_SLOW = os.getenv('SKIP_SLOW', 'false').lower().strip() == 'true'

def log(message, level='INFO'): # Provide message and info level (optional, defaulting to info)
# configure the logger
log = logging.getLogger(name="pid: " + str(os.getpid()))
Expand Down Expand Up @@ -252,6 +254,7 @@ def test_scrape_results_page(self,
#def scrape_case_data_pre2017()
#def scrape_case_data_post2017()

@unittest.skipIf(SKIP_SLOW, "slow")
def test_scrape_multiple_cases(self,
county = 'hays',
odyssey_version = 2003,
Expand Down
Loading