-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
136 lines (129 loc) · 5.41 KB
/
.gitlab-ci.yml
File metadata and controls
136 lines (129 loc) · 5.41 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
stages:
- build
- test
- deploy-github
- deploy-pypi
generate:
stage: build
image: python:3
only:
- schedule@kaiser/python-chromedriver-binary
script:
- apt-get update
- apt-get install -y python3-venv sed ssh git
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "$GITLAB_PRIVATE_KEY" > ~/.ssh/id_rsa
&& echo "iffgit.fz-juelich.de $GITLAB_HOST_KEY" >> ~/.ssh/known_hosts)
- git config --global user.email "[email protected]"
- git config --global user.name "Daniel Kaiser"
- git remote set-url --push origin [email protected]:kaiser/python-chromedriver-binary.git
- python3 -m venv schedule-env
- schedule-env/bin/python -m pip install requests
- cp get_versions.py /tmp/
- for VERSION in `schedule-env/bin/python /tmp/get_versions.py`; do
git checkout master;
git checkout origin/schedule README.md setup.py;
sed -i "s/@@CHROMEDRIVER_VERSION@@/${VERSION}/g" README.md;
sed -i "s/@@CHROMEDRIVER_VERSION@@/${VERSION}/g" setup.py;
git add README.md setup.py;
git commit -m "Chromedriver version ${VERSION}";
git tag -a -m "v${VERSION}.0" "v${VERSION}.0";
git push -f origin master;
git push -f origin --tags;
done
build:
stage: build
image: python:3
only:
- master@kaiser/python-chromedriver-binary
- tags@kaiser/python-chromedriver-binary
- chromedriver-binary-auto@kaiser/python-chromedriver-binary
before_script:
- python3 -m pip install setuptools
script:
- python3 setup.py sdist
artifacts:
paths:
- dist/
expire_in: 1 week
python3-test:
stage: test
image: python:3
only:
- master@kaiser/python-chromedriver-binary
- tags@kaiser/python-chromedriver-binary
script:
- apt-get update
- apt-get install -y python3-venv
- apt-get install -y libglib2.0-0 libx11-6 libnss3 libx11-xcb1 libdbus-1-3
- rm -rf chromedriver_binary
- python3 -m venv env
- env/bin/pip install dist/*
- ls `env/bin/python3 -c "import chromedriver_binary; print(chromedriver_binary.chromedriver_filename)"`
- VERSION=$(PATH=`env/bin/chromedriver-path` chromedriver -v | cut -d' ' -f2 | cut -d'.' -f1-4)
- PY_VERS=$(env/bin/pip list --format=freeze | grep 'chromedriver-binary' | cut -d'=' -f3 | cut -d'.' -f1-4)
- echo "Version $VERSION $PY_VERS"
- test "$VERSION" = "$PY_VERS"
dependencies:
- build
deploy-github:
stage: deploy-github
image: alpine
only:
- master@kaiser/python-chromedriver-binary
- chromedriver-binary-auto@kaiser/python-chromedriver-binary
- tags@kaiser/python-chromedriver-binary
script:
- apk add --no-cache openssh-client git
- if [ -n "$CI_COMMIT_BRANCH" ]; then git checkout "$CI_COMMIT_BRANCH"; else git checkout master; fi
- mkdir --mode=700 ~/.ssh/
- (umask 0377 && echo "$GITHUB_PRIVATE_KEY" > ~/.ssh/id_rsa
&& echo "github.com $GITHUB_HOST_KEY" >> ~/.ssh/known_hosts)
- git config --global user.email "[email protected]"
- git config --global user.name "Daniel Kaiser"
- git remote add github [email protected]:danielkaiser/python-chromedriver-binary.git
- git fetch github
- if [ -n "$CI_COMMIT_BRANCH" ]; then git push -f github "$CI_COMMIT_BRANCH"; fi
- if [ -n "$CI_COMMIT_TAG" ]; then git push -f github --tags; fi
deploy-pypi:
stage: deploy-pypi
image: python:3
only:
- tags@kaiser/python-chromedriver-binary
script:
- rm -rf deploy && mkdir deploy && cd deploy
- apt-get update
- apt-get install -y python3-venv
- python3 -m venv env
- env/bin/python -m pip install --upgrade pip
- env/bin/python -m pip install twine
- echo "[distutils]" > ~/.pypirc
- echo "index-servers =" >> ~/.pypirc
- echo " pypi" >> ~/.pypirc
- echo "[pypi]" >> ~/.pypirc
- echo "username=$PYPIUSERNAME" >> ~/.pypirc
- echo "password=$PYPIPASSWORD" >> ~/.pypirc
- env/bin/twine upload --repository pypi ../dist/*.tar.gz
dependencies:
- build
deploy-pypi-auto:
stage: deploy-pypi
image: python:3
only:
- chromedriver-binary-auto@kaiser/python-chromedriver-binary
script:
- rm -rf deploy && mkdir deploy && cd deploy
- apt-get update
- apt-get install -y python3-venv
- python3 -m venv env
- env/bin/python -m pip install --upgrade pip
- env/bin/python -m pip install twine
- echo "[distutils]" > ~/.pypirc
- echo "index-servers =" >> ~/.pypirc
- echo " pypi" >> ~/.pypirc
- echo "[pypi]" >> ~/.pypirc
- echo "username=$PYPIUSERNAME" >> ~/.pypirc
- echo "password=$PYPIPASSWORD_AUTO" >> ~/.pypirc
- env/bin/twine upload --repository pypi ../dist/*.tar.gz
dependencies:
- build