forked from IngoMeyer441/simple-term-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
120 lines (113 loc) · 4.07 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
stages:
- check
- build
- deploy
- deploy-to-aur
pre-commit:
stage: check
image: python:3
before_script:
- pip install "pre-commit==2.13.0"
script:
- TMP_MSG_FILE="$(mktemp)"
- git log -1 --pretty=%B > "${TMP_MSG_FILE}"
- pre-commit run --all-files --color=always --hook-stage commit &&
pre-commit run --all-files --color=always --hook-stage commit-msg --commit-msg-filename "${TMP_MSG_FILE}" &&
pre-commit run --all-files --color=always --hook-stage post-commit || {
>&2 echo "pre-commit checks failed. Please consider installing pre-commit";
>&2 echo "hooks in your local Git clone by running \`make git-hooks-install\`.";
exit 1;
}
check-python-compatibility:py35:
stage: check
image: sciapp/python-testing:latest-ubuntu-20.04
script:
- python3.5 -m pip install .
- python3.5 -m simple_term_menu --version
build-linux-executable:
stage: build
image: centos:7
before_script:
- yum install -y epel-release
- yum install -y python36-pip upx
script:
- python3 setup.py bdist_pyinstaller
- PLATFORM=$(python3 -c 'import platform; print("{}_{}".format(platform.system(), platform.machine()).lower())');
mv "dist/${CI_PROJECT_NAME}" "dist/${CI_PROJECT_NAME}_${PLATFORM}"
artifacts:
expire_in: 1 week
paths:
- dist/
build-macos-executable:
stage: build
image: macos:high-sierra-xcode-python3
tags:
- libvirt
script:
- python3 setup.py bdist_pyinstaller
- PLATFORM=$(python3 -c 'import platform; print("{}_{}".format(platform.system(), platform.machine()).lower())');
mv "dist/${CI_PROJECT_NAME}" "dist/${CI_PROJECT_NAME}_${PLATFORM}"
artifacts:
expire_in: 1 week
paths:
- dist/
deploy-to-github:
stage: deploy
image: iffregistry.fz-juelich.de/docker-images/gr-build-images/deploy
variables:
GIT_STRATEGY: none
only:
- master@imeyer/simple-term-menu
- develop@imeyer/simple-term-menu
- tags@imeyer/simple-term-menu
script:
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "${GITHUB_DEPLOY_KEY}" > ~/.ssh/id_rsa
&& echo "github.com ${GITHUB_HOST_KEY}" >> ~/.ssh/known_hosts)
- git clone --mirror "${CI_REPOSITORY_URL}" "${CI_PROJECT_NAME}_mirror"
- cd "${CI_PROJECT_NAME}_mirror";
git push --mirror "git@github.com:IngoMeyer441/${CI_PROJECT_NAME}.git";
cd ..
- if echo "${CI_COMMIT_TAG}" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
python3 -m pip install
"git+https://gitlab-ci-token:${CI_JOB_TOKEN}@iffgit.fz-juelich.de/Scientific-IT-Systems/github-binary-upload.git";
echo "${GITHUB_ACCESS_TOKEN}" |
github-binary-upload --user IngoMeyer441 "IngoMeyer441/${CI_PROJECT_NAME}" "${CI_COMMIT_TAG}" dist/*;
fi
deploy-to-pypi:
stage: deploy
image: python:3-slim
only:
- tags@imeyer/simple-term-menu
script:
- pip install twine
- echo "[distutils]" > ~/.pypirc;
echo "index-servers =" >> ~/.pypirc;
echo " pypi" >> ~/.pypirc;
echo "[pypi]" >> ~/.pypirc;
echo "username = __token__" >> ~/.pypirc;
echo "password = ${PYPI_DEPLOY_KEY}" >> ~/.pypirc;
- python setup.py sdist
- python setup.py bdist_wheel
- twine upload dist/*.tar.gz dist/*.whl
deploy-to-aur:
stage: deploy-to-aur
image: iffregistry.fz-juelich.de/docker-images/gr-build-images/$CI_JOB_NAME
only:
- tags@imeyer/simple-term-menu
script:
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "$AUR_PRIVATE_KEY" > ~/.ssh/id_rsa
&& echo "aur.archlinux.org $AUR_HOST_KEY" >> ~/.ssh/known_hosts)
- git clone "ssh://aur@aur.archlinux.org/python-${CI_PROJECT_NAME}.git" "python-${CI_PROJECT_NAME}-aur"
- cd "python-${CI_PROJECT_NAME}-aur"
- sed -i -e "/^pkgver=/c\pkgver=\"${CI_COMMIT_TAG#v}\"" -e "/^pkgrel=/c\pkgrel=\"1\"" PKGBUILD
- (
source PKGBUILD;
curl -o source -L "${source[0]}";
SHA256SUM="$(sha256sum source | awk '{ print $1 }')";
sed -i "/^sha256sums=/c\sha256sums=(\"${SHA256SUM}\")" PKGBUILD;
)
- makepkg --printsrcinfo > .SRCINFO
- git commit -a -m "Update to version ${CI_COMMIT_TAG#v}"
- git push