Run tests from inside docker image to ensure python version
This commit is contained in:
parent
3afdd108b5
commit
a97bfdffef
4 changed files with 13 additions and 12 deletions
11
.build.yml
11
.build.yml
|
@ -1,8 +1,6 @@
|
||||||
image: archlinux
|
image: archlinux
|
||||||
packages:
|
packages:
|
||||||
- docker
|
- docker
|
||||||
- python-pip
|
|
||||||
- python-virtualenv
|
|
||||||
sources:
|
sources:
|
||||||
- https://git.sr.ht/~crocmagnon/blog
|
- https://git.sr.ht/~crocmagnon/blog
|
||||||
secrets:
|
secrets:
|
||||||
|
@ -12,19 +10,14 @@ secrets:
|
||||||
environment:
|
environment:
|
||||||
TESTING: true
|
TESTING: true
|
||||||
tasks:
|
tasks:
|
||||||
- test: |
|
|
||||||
python --version
|
|
||||||
cd blog
|
|
||||||
virtualenv venv
|
|
||||||
venv/bin/python -m pip install -r requirements.txt -r requirements-dev.txt --progress-bar off
|
|
||||||
venv/bin/python -m pytest
|
|
||||||
- setup_docker: |
|
- setup_docker: |
|
||||||
./blog/docker/setup-docker
|
./blog/docker/setup-docker
|
||||||
- build: |
|
- build_and_test: |
|
||||||
docker info
|
docker info
|
||||||
docker login -u crocmagnon --password-stdin < .docker-secret
|
docker login -u crocmagnon --password-stdin < .docker-secret
|
||||||
docker pull crocmagnon/blog || true
|
docker pull crocmagnon/blog || true
|
||||||
docker build --cache-from crocmagnon/blog:latest -t crocmagnon/blog blog/
|
docker build --cache-from crocmagnon/blog:latest -t crocmagnon/blog blog/
|
||||||
|
docker run -t --rm crocmagnon/blog /app/docker/runtests.sh
|
||||||
docker push crocmagnon/blog
|
docker push crocmagnon/blog
|
||||||
- deploy: |
|
- deploy: |
|
||||||
ssh blog -o StrictHostKeyChecking=no "/srv/blog/redeploy"
|
ssh blog -o StrictHostKeyChecking=no "/srv/blog/redeploy"
|
||||||
|
|
|
@ -8,10 +8,10 @@ RUN apt-get update \
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
COPY manage.py ./
|
COPY manage.py LICENSE .pre-commit-config.yaml .isort.cfg pyproject.toml requirements-dev.txt ./
|
||||||
COPY articles ./articles/
|
|
||||||
COPY blog ./blog/
|
|
||||||
COPY docker ./docker/
|
COPY docker ./docker/
|
||||||
|
COPY blog ./blog/
|
||||||
|
COPY articles ./articles/
|
||||||
|
|
||||||
ENV SECRET_KEY "changeme"
|
ENV SECRET_KEY "changeme"
|
||||||
ENV DEBUG "false"
|
ENV DEBUG "false"
|
||||||
|
|
|
@ -11,3 +11,8 @@ services:
|
||||||
- ./db:/db
|
- ./db:/db
|
||||||
- ./static:/app/staticfiles
|
- ./static:/app/staticfiles
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
tests:
|
||||||
|
image: crocmagnon/blog
|
||||||
|
build: .
|
||||||
|
command: ["/app/docker/runtests.sh"]
|
||||||
|
healthcheck: {}
|
||||||
|
|
3
docker/runtests.sh
Executable file
3
docker/runtests.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
pip install -r /app/requirements-dev.txt --progress-bar off
|
||||||
|
TESTING=true python -m pytest
|
Reference in a new issue