Create basic api for initial grabbing of unique query in background #75
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Django Tests | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
node-version: 21 | |
python-version: 3.12 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
POETRY_VERSION: "1.8.3" | |
POETRY_HOME: "~/.local/" | |
HEROKU: "False" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up node.js ${{ env.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.node-version }} | |
- name: Set up Python ${{ env.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.python-version }} | |
- name: Load cached Poetry installation | |
id: cached-poetry-installation | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.POETRY_HOME }} | |
key: ${{ runner.os }}-poetry_installation-${{ env.POETRY_VERSION }} | |
restore-keys: ${{ runner.os }}-poetry_installation- | |
- name: Install poetry and configure | |
run: | | |
curl -sSL https://install.python-poetry.org | POETRY_HOME=${{ env.POETRY_HOME }} python3 - --version ${{ env.POETRY_VERSION }} | |
poetry config virtualenvs.in-project "true" | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install poetry dependencies | |
run: poetry install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Set environmental variable for pre-commit cache | |
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- name: Create or load pre-commit cache | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Prepare Selenium | |
uses: nanasess/[email protected] | |
with: | |
chromedriver-version: "126.0.6478.126" | |
- name: Setup Display | |
run: | | |
export DISPLAY=:99 | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional | |
- name: Linting, formatting and file checks | |
run: poetry run pre-commit run --all-files | |
- name: Django Security Check | |
run: | | |
poetry run python manage.py check --deploy --fail-level WARNING | |
env: | |
DEBUG: "False" | |
- name: Load cached npm packages | |
id: cached-npm-dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-node- | |
- name: npm install dependencies | |
run: npm install | |
- name: Tailwind compile | |
run: npm run build | |
- name: Running static file collection | |
run: poetry run python manage.py collectstatic --no-input | |
env: | |
DEBUG: "True" | |
- name: Running migration | |
run: poetry run python manage.py migrate --no-input | |
env: | |
DEBUG: "True" | |
- name: Test using django | |
run: | | |
poetry run coverage erase | |
poetry run coverage run --concurrency=multiprocessing manage.py test | |
poetry run coverage combine | |
poetry run coverage report | |
poetry run coverage xml | |
env: | |
DEBUG: "True" | |
GITHUB_ACTIONS: "True" | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: true | |
verbose: true |