-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
94 lines (85 loc) · 2.28 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
stages:
- init
- test
- build
- deploy
- cleanup
variables:
VENV_ROOT: C:\temp\builds
VENV_PY35: C:\temp\builds\python35_x64
PYPI_URL: http://tphweb.tph.local/pypi
# Set environment vars
before_script:
- REM ==================== Before Script ====================
# Create the build dir environment variable.
- set BUILD_DIR=%VENV_PY35%\%CI_PROJECT_ID%
- set BUILD_DIR=%BUILD_DIR%__%CI_PROJECT_NAMESPACE%
- set BUILD_DIR=%BUILD_DIR%__%CI_PROJECT_NAME%
- set BUILD_DIR=%BUILD_DIR%__%CI_PIPELINE_ID%
- set BUILD_DIR=%BUILD_DIR%__%CI_COMMIT_REF_NAME%
- echo %BUILD_DIR%
- call C:\WinPython35\scripts\env.bat
- python -c "import sys;print(sys.version)"
- REM ~~~~~~~~~~~~~~~~~~~~ End Before Script ~~~~~~~~~~~~~~~~~~~~
install:
stage: init
when: always
tags:
- python-windows
script:
- python -m venv --clear %BUILD_DIR%
- call %BUILD_DIR%\Scripts\activate.bat
# Can't upgrade pip in place.
# See https://github.com/pypa/pip/issues/1299#issuecomment-188198496
- python -m pip install --upgrade pip setuptools wheel
- python -m pip install -r requirements.txt
test:
stage: test
when: on_success
tags:
- python-windows
script:
- call %BUILD_DIR%\Scripts\activate.bat
- python -m pip install --no-cache-dir -r dev-requirements.txt
- python -m green -vvv -s 1 -W -t gdwcalc
build:
stage: build
when: on_success
tags:
- python-windows
only:
- tags
script:
- call %BUILD_DIR%\Scripts\activate.bat
# - python build_exe.py build
- python setup.py sdist bdist_wheel
artifacts:
paths:
# - build/exe.win-amd64-3.5/
- dist/*
deploy:
stage: deploy
environment:
name: production
url: $PYPI_URL/simple/gdwcalc
when: on_success
tags:
- python-windows
only:
- tags
script:
- call C:\WinPython35\scripts\env.bat
- call %BUILD_DIR%\Scripts\activate.bat
- python -m pip install --upgrade twine
- dir dist\*.zip /b/s > temp.txt
- set /p VAR=<temp.txt
- echo %VAR%
- twine register --repository %PYPI_URL% --repository-url %PYPI_URL% -u '' -p '' %VAR%
- twine upload --repository %PYPI_URL% --repository-url %PYPI_URL% -u '' -p '' dist/*
clean-up:
stage: cleanup
when: always
tags:
- python-windows
script:
- rd /S /Q %BUILD_DIR%