-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
97 lines (81 loc) · 2.25 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
87
88
89
90
91
92
93
94
95
96
97
image: "registry.gitlab.com/cipres/ipfs-void-storm:latest"
variables:
VERSION: "1.1.0"
TAGNAME: "${VERSION}"
WHEEL_FILENAME: "${CI_PROJECT_NAME}-${VERSION}-py3-none-any.whl"
WHEEL_ARTIFACT_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/continuous-${CI_COMMIT_BRANCH}/${CI_PROJECT_NAME}-${VERSION}-py3-none-any.whl"
DOCKER_REPOSITORY: "${CI_REGISTRY}/cipres/${CI_PROJECT_NAME}"
.ipfs_script_template:
before_script:
- ipfs init
- nohup ipfs daemon &
stages:
- build
- release
- docker
build:
extends:
- .ipfs_script_template
stage: build
only:
- master
- devel
- i18n
script:
- python3 -m pip install --upgrade pip
- python3 -m venv venv
- source venv/bin/activate
- pip install wheel
- pip install -r requirements-dev.txt
- flake8 iraty
- python3 setup.py build install
- python3 setup.py sdist bdist_wheel
- |-
for ex in examples/{basic,cat,layout,unixfs}; do
iraty lint $ex
iraty run $ex
done
iraty --langs en,fr run examples/i18n
artifacts:
paths:
- dist/*.whl
release:
image: registry.gitlab.com/gitlab-org/release-cli
stage: release
only:
- master
script:
- apk add curl
- >
curl
--request DELETE
--header "JOB-TOKEN: $CI_JOB_TOKEN"
--header "PRIVATE-TOKEN: ${GITLAB_PRIVATE_TOKEN}"
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases/${TAGNAME}"
- >
curl --header "JOB-TOKEN: $CI_JOB_TOKEN"
--upload-file
dist/${WHEEL_FILENAME}
${WHEEL_ARTIFACT_URL}
- >
release-cli create
--name release-${CI_COMMIT_SHA}
--description README.md
--tag-name $TAGNAME
--ref $CI_COMMIT_SHA
--assets-link
"{\"name\": \"${WHEEL_FILENAME}\", \"filepath\": \"/${WHEEL_FILENAME}\", \"url\": \"${WHEEL_ARTIFACT_URL}\"}"
docker:
image: docker:latest
stage: docker
services:
- docker:dind
rules:
- if: $CI_COMMIT_MESSAGE =~ /\[docker\]/
when: always
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- DOCKER_TAG="latest"
- docker build -f Dockerfile -t $DOCKER_REPOSITORY:$DOCKER_TAG .
- docker push $DOCKER_REPOSITORY:$DOCKER_TAG