-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
78 lines (70 loc) · 2.2 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
78 lines (70 loc) · 2.2 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
image: python:latest
services:
- docker:dind
stages:
- Test
- Deploy to PyPI
before_script:
# Setup package manager
- apt-get update 2>&1 >/dev/null
- apt-get install curl wget git -y
- apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran -y
- apt-get install python-setuptools -y
- apt-get install python3-setuptools -y
- apt-get install python-dev -y
- apt-get install python3-dev -y
- apt-get install openssh-server -y
# Setup SSH configuration
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# Install gettext for envsubst
- apt-get install gettext -y
Lint:
stage: Test
script:
- pip3 install flake8
- pip3 install pep8-naming
- flake8 --version
- flake8
Test Python 2:
stage: Test
script:
- apt-get install python-pip -y
- pip2 install -U pip setuptools
- python2 setup.py test
Test Python 3:
stage: Test
script:
- pip3 install -U pip setuptools
- python3 setup.py test
Deploy to PyPI:
stage: Deploy to PyPI
script:
# Add GitLab SSH private deploy key
- eval $(ssh-agent -s)
- tmpfile=$(mktemp ~/pk.XXXXXX)
- echo "$SSH_PRIVATE_KEY" > $tmpfile
- ssh-add $tmpfile
- rm $tmpfile
# Tag the release on GitLab
- rm -rf ../tagger
- mkdir -p ../tagger
- cd ../tagger
- git clone git@gitlab.com:$CI_PROJECT_PATH.git
- cd $CI_PROJECT_NAME
- git config --global user.email "dev_ci_bot@plasticity.ai"
- git config --global user.name "Plasticity Developer Bot"
- git tag -a $(python setup.py -V) -m "Release $(python setup.py -V)"
- git push origin --tags
- cd $CI_PROJECT_DIR
- rm -rf ../tagger
- sleep 60 # Wait for GitLab to mirror to GitHub
# Create a release on GitHub
- curl -u plasticity-admin:$GITHUB_TOKEN -d "{\"tag_name\":\"$(python setup.py -V)\", \"name\":\"Release $(python setup.py -V)\"}" -H "Content-Type:"" application/json" -X POST https://api.github.com/repos/plasticityai/$CI_PROJECT_NAME/releases
# Upload to PyPI
- envsubst < deployment/.pypirc > ~/.pypirc
- chmod 600 ~/.pypirc
- python setup.py sdist upload -r pypitest
- python setup.py sdist upload -r pypi
only:
- master