Skip to content

Feature/get-parent-categories #119

Feature/get-parent-categories

Feature/get-parent-categories #119

Workflow file for this run

name: Python Tests
on:
pull_request:
paths:
- "mpscraper/**"
- "tests/**"
- "poetry.lock"
- "pyproject.toml"
- ".github/workflows/test.yml"
push:
branches:
- "main"
paths:
- "mpscraper/**"
- "tests/**"
- "poetry.lock"
- "pyproject.toml"
- ".github/workflows/test.yml"
env:
PYTHON_VERSION: "3.12"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: pre-commit/action@v3.0.1
env:
RUFF_OUTPUT_FORMAT: github
test:
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
python-version: ["3.12"]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install xvfb & chromium-browser
run: |
sudo apt-get update
sudo apt-get install -y xvfb chromium-browser
- name: Setup Chromedriver
uses: nanasess/setup-chromedriver@v2
env:
CHROMEAPP: chromium-browser
- name: Run Chromedriver
run: |
echo "CHROMIUM_PATH=$(which chromium)" >> "$GITHUB_ENV"
echo "CHROMEDRIVER_PATH=$(which chromedriver)" >> "$GITHUB_ENV"
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Run Pytest
run: |
source .venv/bin/activate
pytest -vv --cov=./mpscraper --cov-report=xml ./tests
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
security:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Install Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Run Bandit
run: |-
source .venv/bin/activate
bandit -r ./mpscraper