forked from kirberich/djangae
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
44 lines (41 loc) · 1.45 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
stages:
- prepare
- lint
- test
prepare:python3.8:
stage: prepare
image: docker:latest
services:
- docker:dind
variables:
GIT_STRATEGY: none # Prevent cloning
DOCKERFILE: >- # Generate a Dockerfile for the build image
FROM python:3.8\n
SHELL ["/bin/bash", "-c"]\n
RUN apt-get update\n
RUN apt-get install -y default-jre\n
RUN pip install tox\n
RUN gcloud version || true\n
RUN if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi\n
RUN source /root/google-cloud-sdk/path.bash.inc && gcloud version\n
RUN CLOUDSDK_CORE_DISABLE_PROMPTS=1 source /root/google-cloud-sdk/path.bash.inc && gcloud components install cloud-datastore-emulator beta\n
before_script: # Put the variable into a Dockerfile
- echo -e $DOCKERFILE > Dockerfile
- cat Dockerfile
script:
- docker pull $CI_REGISTRY_IMAGE:python3.8 || true
- docker build --cache-from $CI_REGISTRY_IMAGE:python3.8 -t $CI_REGISTRY_IMAGE:python3.8 .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE:python3.8
lint:python3:
image: $CI_REGISTRY_IMAGE:python3.8
stage: lint
script:
- tox -e flake8
test:python3.8:
image: $CI_REGISTRY_IMAGE:python3.8
stage: test
before_script:
- source /root/google-cloud-sdk/path.bash.inc
script:
- tox