diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..a9b023d --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,48 @@ +name: Python Tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read +jobs: + build: + runs-on: ubuntu-latest + + env: + ADMIN_USERNAME: ${{ secrets.ADMIN_USERNAME }} + ADMIN_PASSWORD: ${{ secrets.ADMIN_PASSWORD }} + SUPABASE_URL: ${{ secrets.SUPABASE_URL }} + SUPERBASE_SERVICE_ROLE_KEY: ${{ secrets.SUPERBASE_SERVICE_ROLE_KEY }} + SUPABASE_ANON_KEY: ${{ secrets.SUPERBASE_ANON_KEY }} + SUPERBASE_S3_BUCKET_NAME: ${{ secrets.SUPERBASE_S3_BUCKET_NAME }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest playwright + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Install Playwright browsers + run: | + playwright install --with-deps chromium + + - name: Lint with flake8 + run: | + # Stop build if there are syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # Exit-zero treats all errors as warnings (so build continues) + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Run pytest + run: pytest -v --maxfail=3 --disable-warnings