-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
86 lines (76 loc) · 2.27 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
image: docker:latest
services:
- docker:dind
stages:
- deps
- build
- test
- manual
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
variables:
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
DOCKER_DRIVER: overlay2
BASE_IMG_TAG: $CI_REGISTRY_IMAGE:base
DEPS_IMG_TAG: $CI_REGISTRY_IMAGE:deps
FASTFM_IMG_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
PYPI_REPO: https://pypi.palaimon.io/
build_deps_images:
tags:
- docker
stage: deps
script:
- docker pull $BASE_IMG_TAG || true
- docker build --cache-from $BASE_IMG_TAG -t $BASE_IMG_TAG -f docker/base.docker .
- docker push $BASE_IMG_TAG
- docker pull $DEPS_IMG_TAG || true
- docker build --cache-from $DEPS_IMG_TAG -t $DEPS_IMG_TAG -f docker/deps.docker .
- docker push $DEPS_IMG_TAG
only:
changes:
- pyproject.toml
- docker/base.docker
- docker/deps.docker
build_fastfm_image:
tags:
- docker
stage: build
script:
- docker pull $FASTFM_IMG_TAG || true
- >
docker build
--cache-from $FASTFM_IMG_TAG
-t $FASTFM_IMG_TAG
-f docker/fastfm.docker .
- docker push $FASTFM_IMG_TAG
after_script: # remove dangling images and containers to avoid running out of disk space
- docker image ls #debug
- docker container ls #debug
- docker container prune -f || true
- docker image prune -f || true
run_test:
tags:
- docker
stage: test
script:
- docker run -i --entrypoint ./scripts/run_tests.sh $FASTFM_IMG_TAG
build_wheels_manual:
tags:
- docker
stage: manual
when: manual
except:
refs:
- master
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
- apk add --update gcc musl-dev libffi-dev openssl-dev python3 python3-dev py3-pip && rm -rf /var/cache/apk/*
- pip install twine
script:
- docker run -i --entrypoint ./scripts/compile_wheels.sh -v $(pwd)/wheelhouse:/wheelhouse $FASTFM_IMG_TAG
- twine upload --repository-url $PYPI_REPO --username $POETRY_HTTP_BASIC_PYPI_USERNAME --password $POETRY_HTTP_BASIC_PYPI_PASSWORD $(pwd)/wheelhouse/fastfm*.whl
artifacts:
paths:
- wheelhouse/fastfm*.whl
expire_in: 30 days