Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
8f3d049
ci(flake8): run flake8 in gh CI
samoehlert Nov 8, 2024
a281350
ci(gh-actions): add sast, code quality, and dependency scanning in gh…
samoehlert Nov 12, 2024
f6b73f7
ci(sast): point to an actual sast tool
samoehlert Nov 12, 2024
736ba6b
ci(pytest): add pytest github action
samoehlert Nov 12, 2024
c2e10a5
ci(sast): test this on pushes in this branch
samoehlert Nov 12, 2024
ecaee82
ci(actions): turn off duplicate SAST and turn on pytest in this branch
samoehlert Nov 12, 2024
9171cb0
ci(postgres): make postgres start
samoehlert Nov 12, 2024
ab44630
ci(updates): use latest versions of actions
samoehlert Nov 12, 2024
649e016
ci(syntax): make all workflows have similar syntax
samoehlert Nov 12, 2024
c452612
ci(github-actions): no need for our gitlab CI file anymore
samoehlert Nov 12, 2024
685ca3b
docs(actions): only run docs action on main
samoehlert Nov 13, 2024
4bcf56b
ci(run-always): set action to run on every branch
samoehlert Nov 14, 2024
ce9fd23
ci(run-always): run pytest and flake8 on all pushes
samoehlert Nov 14, 2024
5db525f
ci(coverage): automatically add coverage report to our pull requests
samoehlert Nov 14, 2024
81152c3
ci(coverage): update coverage configs to focus the MR output
samoehlert Nov 14, 2024
98a907a
chore: bump to django 4.2
crankynetman Nov 8, 2024
7519088
chore(deps): bump python image
crankynetman Nov 14, 2024
413e2dc
fix(coverage): only displaying changed files breaks this action
samoehlert Nov 14, 2024
de3d2b5
Merge pull request #71 from esnet-security/topic/soehlert/github_ci
samoehlert Nov 14, 2024
6c66554
chore(deps): remove pillow pin (it's included by other things)
crankynetman Nov 14, 2024
e650af6
Merge branch 'develop' into topic/chriscummings/issue-72/bump-django
crankynetman Nov 14, 2024
a3e6c4e
chore(deps): Remove more frozen downstream deps
crankynetman Nov 14, 2024
f22f2e8
refactor(auth): move auth_method to production which is the only file…
samoehlert Nov 14, 2024
d34334e
style(isort): run isort on base.py
samoehlert Nov 14, 2024
d98363a
refactor(settings): put auth settings for a make toggle-local situati…
samoehlert Nov 14, 2024
ecd90d1
style(precommit): ran hooks
samoehlert Nov 14, 2024
08625aa
feat(local_auth): set up the urls and point to them for the make togg…
samoehlert Nov 14, 2024
2fc25a5
refactor(formatting): fix formatting
samoehlert Nov 14, 2024
39ba31c
ci(docs): only build on main
crankynetman Nov 15, 2024
65f8e1a
Merge pull request #75 from esnet-security/topic/chriscummings/docs-t…
crankynetman Nov 15, 2024
3cb82d6
style(hooks): ran precommit
samoehlert Nov 15, 2024
7379e78
Merge branch 'develop' into topic/chriscummings/issue-72/bump-django
crankynetman Nov 15, 2024
4cc628e
feat(auth): set up the most basic working version of local auth
samoehlert Nov 15, 2024
95b921d
fix(gh-actions): pull in docs temp fix
samoehlert Nov 15, 2024
2074d72
fix(env-file): replace the .env file that i deleted thinking we didnt…
samoehlert Nov 15, 2024
dc4e0b6
Merge pull request #73 from esnet-security/topic/chriscummings/issue-…
crankynetman Nov 15, 2024
b6bfd9b
style(hookes): ran precommit
samoehlert Nov 15, 2024
602767e
refactor(hooks): ran precommit
samoehlert Nov 15, 2024
4fbfcb9
refactor(hooks): ran precommit
samoehlert Nov 15, 2024
f0334b7
test(naming): update the name of the test case to better match reality
samoehlert Nov 15, 2024
29d29ab
refactor(linting): should not be raising a raw exception
samoehlert Nov 15, 2024
a844313
Merge branch 'develop' into topic/soehlert/allow_local_auth
samoehlert Nov 15, 2024
6fa5648
feat(gobgp-neighbor): add makefile target for debugging gobgp neighbors
samoehlert Nov 16, 2024
ff716e8
Remove requirements that are pulled in by something else.
grigorescu Nov 16, 2024
4949330
Merge pull request #79 from esnet-security/topic/vlad/requirements_up…
grigorescu Nov 16, 2024
3a93643
Merge pull request #78 from esnet-security/topic/soehlert/bgp_neighbo…
samoehlert Nov 16, 2024
ebd3c7a
First step to add coveralls
grigorescu Nov 17, 2024
894cef5
YAML is so fun; fixing indent
grigorescu Nov 17, 2024
40c5e49
Merge branch 'develop' into topic/soehlert/allow_local_auth
samoehlert Nov 17, 2024
21cbe26
Ignore some things from coverage stats
grigorescu Nov 17, 2024
41aca9a
Coverage fixes: move settings to a single file, update version, fix c…
grigorescu Nov 17, 2024
310d789
Remove the config star imports; there's really not that many of them.
grigorescu Nov 17, 2024
dd12466
Fix django-coverage-plugin version
grigorescu Nov 17, 2024
72d40b1
Bring syntax inline with the rest
grigorescu Nov 17, 2024
5a68c46
Reverting 3 commits. They introduced a test failure, and I couldn't f…
grigorescu Nov 17, 2024
f8b9bff
Add Coveralls badge
grigorescu Nov 17, 2024
95f34d1
Consolidate coverage config
grigorescu Nov 17, 2024
5fecad9
Fix toml syntax
grigorescu Nov 17, 2024
58ebc6f
Add docstrings to scram/
grigorescu Nov 17, 2024
9548610
Require docstrings on everything on scram/
grigorescu Nov 17, 2024
a969cc8
docs(envvars): Document all our envvars
samoehlert Nov 17, 2024
7ca1132
docs(installation): add beginnings of environment variable instructions
samoehlert Nov 17, 2024
ef42a0f
chore(deps): bump django prod, whoops
crankynetman Nov 17, 2024
bf02348
Add docstrings to translator/
grigorescu Nov 17, 2024
2729302
Enforce docstrings on translator too.
grigorescu Nov 17, 2024
2e52f9f
I didn't actually mean to commit this, but feels small enough to leav…
grigorescu Nov 17, 2024
325d896
Merge pull request #83 from esnet-security/topic/chriscummings/django…
crankynetman Nov 18, 2024
100bedf
docs(docstrings): update a few docstrings to better match the overall…
samoehlert Nov 18, 2024
85adfa8
Merge branch 'topic/vlad/docstrings' of github.com:esnet-security/SCR…
samoehlert Nov 18, 2024
53153c1
refactor(authentication-settings): move settings back into base and j…
samoehlert Nov 18, 2024
79667a0
Merge branch 'develop' into topic/soehlert/allow_local_auth
samoehlert Nov 18, 2024
46d11fd
fix(test.py): OidcTest requires that we have these set even to dummy …
samoehlert Nov 18, 2024
381abdf
Merge branch 'topic/soehlert/allow_local_auth' of github.com:esnet-se…
samoehlert Nov 18, 2024
d387849
fix(OidcTest): OIDC vars required by our OidcTest case
samoehlert Nov 18, 2024
712815c
build(sugar): this package needed to be updated to avoid a bug we sta…
samoehlert Nov 18, 2024
8bd0c44
test(autocreate_admin): make sure to test our autocreation of the adm…
samoehlert Nov 18, 2024
25e1069
Merge pull request #82 from esnet-security/topic/vlad/docstrings
grigorescu Nov 18, 2024
55e0cc9
Merge pull request #80 from esnet-security/topic/vlad/coveralls
grigorescu Nov 18, 2024
1b8a44b
Don't generate docs for the Django migrations.
grigorescu Nov 18, 2024
8a6a619
Merge branch 'develop' into topic/soehlert/allow_local_auth
samoehlert Nov 18, 2024
c8d059b
We covered the cookiecutter docs in more detail elsewhere.
grigorescu Nov 18, 2024
d280861
style(flake8): update docstrings and spacing for flake8
samoehlert Nov 18, 2024
85c2f1e
Switch sphinx to mkdocs
grigorescu Nov 18, 2024
25ed673
Bump Python for docs build
grigorescu Nov 18, 2024
3586459
Link to Django docs
grigorescu Nov 18, 2024
2a4f8e5
refactor(login_redirect_url): no need to set this twice since both pa…
samoehlert Nov 19, 2024
7fdb6ab
refactor(OIDC-settings): move OIDC settings outside of the if statement
samoehlert Nov 20, 2024
3f86e3b
Merge pull request #76 from esnet-security/topic/soehlert/allow_local…
samoehlert Nov 20, 2024
d1f44b5
build(drf_spectacular): we probably only need swagger available locally
samoehlert Nov 21, 2024
c726e49
feat(swagger): set up swagger config bits
samoehlert Nov 21, 2024
d3e4a6a
Remove commented out bits.
grigorescu Nov 21, 2024
8e29b32
feat(swagger): set up our views to use swagger and expose the endpoin…
samoehlert Nov 21, 2024
d3b66f8
refactor(URLs): make the swagger URLs available all the time
samoehlert Nov 21, 2024
ec115fc
refactor(swagger): move swagger settings to base.py so its available …
samoehlert Nov 22, 2024
f14521f
feat(serializer): use appropriate serializers in success response ins…
samoehlert Nov 22, 2024
3399ea0
feat(CustomCidrAddressField): create a custom field that inherits fro…
samoehlert Nov 22, 2024
939e009
style(flake8): docstring
samoehlert Nov 22, 2024
55ff3ec
style(flake8): flake8 wants docstrings
samoehlert Nov 22, 2024
79bc455
test(swagger): test our swagger endpoints to make sure we can access …
samoehlert Nov 22, 2024
4400790
refactor(swagger): put swagger package in base instead of local requi…
samoehlert Nov 22, 2024
2816faf
test(swagger): make sure swagger is not only up, but serving out our …
samoehlert Nov 22, 2024
9f7eee1
Merge pull request #87 from esnet-security/topic/soehlert/swagger
samoehlert Nov 22, 2024
be25ac4
Merge remote-tracking branch 'origin/develop' into topic/vlad/mkdocs
grigorescu Nov 22, 2024
26dd224
test(bytestrings): be more explicit about our bytestrings to make sur…
samoehlert Nov 22, 2024
69269cb
Merge pull request #89 from esnet-security/hotfix/swagger_tests
samoehlert Nov 22, 2024
4fb6062
Merge pull request #84 from esnet-security/topic/vlad/mkdocs
grigorescu Nov 23, 2024
06b42a5
First pass at ruff and fixes.
grigorescu Nov 23, 2024
d42e1fc
Move workflow to ruff
grigorescu Nov 23, 2024
1901c24
Ruff format fixes
grigorescu Nov 23, 2024
7cb63c0
Enable pyflakes and pyupgrade
grigorescu Nov 23, 2024
1d4f558
Update manage.py to follow Django
grigorescu Nov 23, 2024
af564fd
Add bugbear ruff checks
grigorescu Nov 23, 2024
f240c77
Format fix
grigorescu Nov 23, 2024
46fbee4
Add simplify ruff checks
grigorescu Nov 23, 2024
4468747
Add isort ruff checks
grigorescu Nov 23, 2024
836223a
Add docstyle ruff checks
grigorescu Nov 23, 2024
4e26914
Format fix
grigorescu Nov 23, 2024
bec13b9
Add pep8-naming ruff checks
grigorescu Nov 23, 2024
6076149
Add bandit ruff security checks
grigorescu Nov 23, 2024
03d765d
Format fix
grigorescu Nov 23, 2024
97e876c
Add boolean-trap ruff checks
grigorescu Nov 23, 2024
6dac72a
Add builtins and commas checks
grigorescu Nov 23, 2024
5e614fe
Add comprehensions and datetimez checks
grigorescu Nov 23, 2024
842c3ea
Add comprehensions and datetimez checks
grigorescu Nov 23, 2024
65850f3
Add Django and errmsg checks
grigorescu Nov 23, 2024
59d0ae1
Add implicit-str-concat checks
grigorescu Nov 23, 2024
c473082
Add logging-format checks
grigorescu Nov 23, 2024
37e93ae
Add PIE checks
grigorescu Nov 23, 2024
f778f3a
Add raise checks
grigorescu Nov 23, 2024
5ed431b
Add return checks
grigorescu Nov 23, 2024
b195a9b
Add self checks
grigorescu Nov 23, 2024
5b23826
Add eradicate checks
grigorescu Nov 23, 2024
2c0b461
Add pylint checks
grigorescu Nov 23, 2024
0bfc945
Add tryceratops checks
grigorescu Nov 23, 2024
a2d6e6c
Add perflint checks
grigorescu Nov 23, 2024
332e002
Add ruff checks
grigorescu Nov 23, 2024
596d095
Final cleanup
grigorescu Nov 23, 2024
af2f7ed
Add complexity checks
grigorescu Nov 23, 2024
9b9b72c
Add preview ruff checks
grigorescu Nov 23, 2024
4a26939
Fix auth simplification logic
grigorescu Nov 23, 2024
9d7831a
Fix a few failed tests
grigorescu Nov 23, 2024
cb96b2c
Fix another test, and silence a pip warning in Docker
grigorescu Nov 23, 2024
d1c57b1
Reducing complexity broke xlator behave
grigorescu Nov 23, 2024
42f6a84
Refactor xlator code a bit to reduce complexity
grigorescu Nov 23, 2024
e783235
Add a workflow that runs pytest outside of containers. For speed.
grigorescu Nov 23, 2024
037a7f2
Change Python matrix
grigorescu Nov 23, 2024
b244603
Fix bash bug
grigorescu Nov 23, 2024
89e828a
Add an env var for the Redis host.
grigorescu Nov 23, 2024
ecdf331
Add a test that is allowed to fail to test a future Python version.
grigorescu Nov 24, 2024
ef4dd1f
Running multiple was causing an asyncio conflict.
grigorescu Nov 24, 2024
136141e
Final fixes
grigorescu Nov 24, 2024
6a4c8e2
Add a few meaningful tests to the homepage
grigorescu Nov 24, 2024
d8f5cb1
Add a few more tests for the home page
grigorescu Nov 24, 2024
2f36a66
Fix missing Django template coverage in pytest
grigorescu Nov 24, 2024
6dd3414
Remove latent print
grigorescu Nov 24, 2024
2370023
Remove temp file
grigorescu Nov 24, 2024
80835d4
Remove old pytest config and move to pyproject
grigorescu Nov 24, 2024
718324b
Merge pull request #90 from esnet-security/topic/vlad/ruff
grigorescu Nov 25, 2024
ee5f0c5
Move docs container to mkdocs (#94)
grigorescu Nov 25, 2024
c41cdcb
Fix static files warning (#92)
grigorescu Nov 26, 2024
7e9c7cd
Annotate warnings as such in GitHub Actions for pytest (#91)
grigorescu Nov 26, 2024
9b93a79
Enable Python 3.11 and 3.12 GH Action Testing (#95)
grigorescu Dec 7, 2024
0667c54
feat(db): Enable running postgres locally in prod-mode (#93)
crankynetman Dec 10, 2024
6810e74
chore(release): merge hotfix back to develop (#104)
crankynetman Dec 23, 2024
d2ed5b3
Add missing migration and ensure we fail if we're missing future ones…
grigorescu Dec 24, 2024
b39949b
Add performance tests for number of queries and response time. (#109)
grigorescu Dec 24, 2024
cf24e23
Hotfix: build the docs (#105)
grigorescu Dec 25, 2024
d71aa6f
feat(entry admin): Improve the UX on the entry admin panel (#108)
samoehlert Dec 26, 2024
12fa561
Use select_related for admin.Entry (#111)
grigorescu Dec 26, 2024
753177d
Modify expiration settings for channels (#114)
grigorescu Jan 3, 2025
8bd86d2
A couple more query optimizations and performance checks (#112)
grigorescu Jan 3, 2025
dbff9fc
feat(logging): Log properly from docker (#101)
crankynetman Jan 6, 2025
f9e9bfc
chore(deps): bump gobgp to latest (v3.33.0) (#119)
crankynetman Jan 9, 2025
1d29947
feat(translator): type-stubs and grpc helper command (#121)
crankynetman Jan 9, 2025
0d45c6b
Merge main into develop (#124)
grigorescu Jan 17, 2025
5bc3713
Enable ENV var control of replicas. This allows failure testing. (#122)
grigorescu Jan 21, 2025
ed4af56
fix(add_form): redirect to the homepage after adding via the form on …
samoehlert Jan 25, 2025
913e431
feat(active_blocks): Add a quick way to tell how many active blocks t…
samoehlert Feb 3, 2025
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
11 changes: 0 additions & 11 deletions .ci-scripts/create_user.py

This file was deleted.

3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/behave.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: Run behave

on:
push:
branches:
- "**"
pull_request:
branches:
- main
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
behave:
name: Run Behave
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.11", "3.12"]

steps:
- name: Check out the code
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose make

- name: Check Docker state (pre-build)
run: docker ps

- name: Build Docker images
run: make build
env:
PYTHON_IMAGE_VER: "${{ matrix.python-version }}"

- name: Migrate Database
run: make migrate

- name: Run Application
run: make run

- name: Check Docker state (pre-test)
run: docker ps

- name: Run pytest + behave with Coverage
env:
POSTGRES_USER: scram
POSTGRES_DB: test_scram
run: make coverage.xml

- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2

- name: Upload Coverage to Coveralls
if: matrix.python-version == '3.12'
uses: coverallsapp/github-action@v2

- name: Upload Coverage to GitHub
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml

- name: Display Coverage Metrics
if: matrix.python-version == '3.12'
uses: 5monkeys/cobertura-action@v14
with:
minimum_coverage: "50"

- name: Check Docker state (post-test)
if: always()
run: docker ps

- name: Stop Services
if: always()
run: make stop

- name: Clean Up
if: always()
run: make clean
77 changes: 77 additions & 0 deletions .github/workflows/behave_next_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: Run behave with unsupported Python versions

on:
push:
branches:
- '**'
pull_request:
branches:
- main
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
behave_next_python:
name: Run Behave
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.13']

steps:
- name: Check out the code
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose make

- name: Check Docker state (pre-build)
run: docker ps

- name: Build Docker images
run: make build
env:
PYTHON_IMAGE_VER: "${{ matrix.python-version }}"

- name: Migrate Database
run: |
make migrate || echo "::warning:: migrate failed on future Python version ${{ matrix.python-version }}."

- name: Run Application
run: |
make run || echo "::warning:: run failed on future Python version ${{ matrix.python-version }}."

- name: Check Docker state (pre-test)
run: docker ps

- name: Run pytest + behave with Coverage
env:
POSTGRES_USER: scram
POSTGRES_DB: test_scram
run: |
make coverage.xml || echo "::warning:: pytest + behave failed on future Python version ${{ matrix.python-version }}."

- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2

- name: Check Docker state (post-test)
if: always()
run: docker ps

- name: Stop Services
if: always()
run: make stop

- name: Clean Up
if: always()
run: make clean
11 changes: 8 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build sphinx docs

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
branches:
- 'main'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -41,12 +41,17 @@ jobs:
- name: "[pytest]: before"
run: "./.ci-scripts/pytest_before.sh"

- name: Build docs
run: make docs-build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'docs/_build/html'
path: 'site/'

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v4

77 changes: 77 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: Run pytest

on:
push:
branches:
- '**'
pull_request:
branches:
- main
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
pytest:
name: Run Pytest
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.11', '3.12']

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: scram
POSTGRES_PASSWORD: ''
POSTGRES_DB: test_scram_${{ matrix.python-version }}
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U scram"
--health-interval 10s
--health-timeout 5s
--health-retries 5

redis:
image: redis:5.0
ports:
- 6379:6379

steps:
- name: Check out the code
uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/local.txt
# https://github.com/pytest-dev/pytest-github-actions-annotate-failures/pull/68 isn't yet in a release
pip install git+https://github.com/pytest-dev/pytest-github-actions-annotate-failures.git@6e66cd895fe05cd09be8bad58f5d79110a20385f

- name: Apply migrations
env:
DATABASE_URL: "postgres://scram:@localhost:5432/test_scram_${{ matrix.python-version }}"
run: |
python manage.py makemigrations --noinput
python manage.py migrate --noinput

- name: Check for missing migrations
env:
DATABASE_URL: "postgres://scram:@localhost:5432/test_scram_${{ matrix.python-version }}"
run: python manage.py makemigrations --check

- name: Run Pytest
env:
DATABASE_URL: "postgres://scram:@localhost:5432/test_scram_${{ matrix.python-version }}"
REDIS_HOST: "localhost"
run: pytest
88 changes: 88 additions & 0 deletions .github/workflows/pytest_next_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: Run pytest with unsupported Python versions

on:
push:
branches:
- '**'
pull_request:
branches:
- main
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
pytest_next_python:
name: Run Pytest
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.13']

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: scram
POSTGRES_PASSWORD: ''
POSTGRES_DB: test_scram
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U scram"
--health-interval 10s
--health-timeout 5s
--health-retries 5

redis:
image: redis:5.0
ports:
- 6379:6379

steps:
- name: Check out the code
uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/local.txt
# https://github.com/pytest-dev/pytest-github-actions-annotate-failures/pull/68 isn't yet in a release
pip install git+https://github.com/pytest-dev/pytest-github-actions-annotate-failures.git@6e66cd895fe05cd09be8bad58f5d79110a20385f

- name: Apply unapplied migrations
env:
DATABASE_URL: "postgres://scram:@localhost:5432/test_scram"
run: |
python manage.py makemigrations --noinput || true
UNAPPLIED_MIGRATIONS=$(python manage.py showmigrations --plan | grep '\[ \]' | awk '{print $2}')
if [ -n "$UNAPPLIED_MIGRATIONS" ]; then
for migration in $UNAPPLIED_MIGRATIONS; do
python manage.py migrate $migration --fake-initial --noinput
done
else
echo "No unapplied migrations."
fi

- name: Check for duplicate migrations
run: |
if python manage.py makemigrations --dry-run | grep "No changes detected"; then
echo "No duplicate migrations detected."
else
echo "Warning: Potential duplicate migrations detected. Please review."
fi

- name: Run Pytest
env:
DATABASE_URL: "postgres://scram:@localhost:5432/test_scram"
REDIS_HOST: "localhost"
run: |
pytest || echo "::warning:: Failed on future Python version ${{ matrix.python-version }}."
Loading
Loading