-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
46 lines (40 loc) · 922 Bytes
/
.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
45
46
stages:
- Build
- Static Analysis
variables:
DOCKER_IMAGE: ckanext-advancedauth
# YAML anchor script
.clean: &clean
- docker kill $DOCKER_IMAGE || true
- docker container rm -f $DOCKER_IMAGE || true
- docker image rm -f $DOCKER_IMAGE || true
# Ensure docker is cleaned up before and after pipeline
pre-clean:
tags: [docker-shell]
stage: .pre
script: *clean
post-clean:
tags: [docker-shell]
stage: .post
script: *clean
# Build Docker image
build:
stage: Build
tags:
- docker-shell
script:
- docker build -t $DOCKER_IMAGE .
# Run Black formatter on source code
black:
stage: Static Analysis
tags:
- docker-shell
script:
- docker run --rm $DOCKER_IMAGE bash -c "black --check ckanext/advancedauth"
# Run Flake8 linter on source code
flake8:
stage: Static Analysis
tags:
- docker-shell
script:
- docker run --rm $DOCKER_IMAGE bash -c "flake8 ckanext/advancedauth"