Collect static before

Run as a separate job, and then tests split out into 2
This commit is contained in:
Jake Howard 2022-06-10 17:14:30 +01:00
parent c16b81a618
commit 2c1cc3e411
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 30 additions and 4 deletions

View file

@ -1,3 +1,5 @@
image: python:3.10-slim
stages: stages:
- build - build
- test - test
@ -38,15 +40,39 @@ pip:
- ./env/ - ./env/
expire_in: 30 mins expire_in: 30 mins
test_python: .python_test_template: &python_test_template
image: python:3.10-slim
stage: test stage: test
dependencies: dependencies:
- pip - pip
- static - collect_static
before_script: before_script:
- source env/bin/activate - source env/bin/activate
variables: variables:
SECRET_KEY: super-secret SECRET_KEY: super-secret
collect_static:
<<: *python_test_template
stage: build
dependencies:
- pip
- static
script: script:
- ./manage.py collectstatic --noinput -v2 --clear
artifacts:
name: 'static-$CI_JOB_ID'
paths:
- ./collected-static/
expire_in: 30 mins
test_python:
<<: *python_test_template
script:
- ./manage.py check
- ./manage.py makemigrations --check --noinput
- ./manage.py test - ./manage.py test
django_checks:
<<: *python_test_template
script:
- ./manage.py check
- ./manage.py makemigrations --check --noinput

View file

@ -22,7 +22,7 @@ install:
./manage.py {{ ARGS }} ./manage.py {{ ARGS }}
@collectstatic: @collectstatic:
./manage.py collectstatic --noinput -v2 ./manage.py collectstatic --noinput -v2 --clear
test *ARGS: test *ARGS:
./manage.py test {{ ARGS }} ./manage.py test {{ ARGS }}