@@ -2,50 +2,210 @@ name: Development
2
2
on :
3
3
push :
4
4
branches :
5
- - ' **' # every branch
6
- - ' !stage*' # exclude branches beginning with stage
5
+ - " **" # every branch
6
+ - " !gh-pages" # exclude gh-pages branch
7
+ - " !stage*" # exclude branches beginning with stage
8
+ tags :
9
+ - ' \d+\.\d+\.\d+' # only semver tags
7
10
pull_request :
8
11
branches :
9
- - ' **' # every branch
10
- - ' !stage*' # exclude branches beginning with stage
12
+ - " **" # every branch
13
+ - " !gh-pages" # exclude gh-pages branch
14
+ - " !stage*" # exclude branches beginning with stage
11
15
jobs :
16
+ build :
17
+ runs-on : ubuntu-latest
18
+ strategy :
19
+ matrix :
20
+ include :
21
+ - py_ver : " 3.9"
22
+ distro : debian
23
+ image : djbase
24
+ env :
25
+ PY_VER : ${{matrix.py_ver}}
26
+ DISTRO : ${{matrix.distro}}
27
+ IMAGE : ${{matrix.image}}
28
+ DOCKER_CLIENT_TIMEOUT : " 120"
29
+ COMPOSE_HTTP_TIMEOUT : " 120"
30
+ steps :
31
+ - uses : actions/checkout@v3
32
+ - name : Validate version and release notes
33
+ run : |
34
+ DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
35
+ RELEASE_BODY=$(python -c \
36
+ 'print(open("./CHANGELOG.md").read().split("\n\n")[1].split("\n", 1)[1])' \
37
+ )
38
+ echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
39
+ echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
40
+ echo "$RELEASE_BODY" >> $GITHUB_ENV
41
+ echo "EOF" >> $GITHUB_ENV
42
+ - name : Build pip artifacts
43
+ run : |
44
+ export HOST_UID=$(id -u)
45
+ docker-compose -f docker-compose-build.yaml up --exit-code-from app --build
46
+ echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
47
+ - if : matrix.py_ver == '3.9' && matrix.distro == 'debian'
48
+ name : Add pip artifacts
49
+ uses : actions/upload-artifact@v3
50
+ with :
51
+ name : pip-datajoint-${{env.DJ_VERSION}}
52
+ path : dist
53
+ retention-days : 1
12
54
test :
13
- if : github.event_name == 'push' || github.event_name == 'pull_request'
14
55
runs-on : ubuntu-latest
15
56
strategy :
16
57
matrix :
17
- py_ver : ["3.8 "]
58
+ py_ver : ["3.9 "]
18
59
mysql_ver : ["8.0", "5.7"]
19
60
include :
20
- - py_ver : " 3.7 "
61
+ - py_ver : " 3.8 "
21
62
mysql_ver : " 5.7"
22
- - py_ver : " 3.6 "
63
+ - py_ver : " 3.7 "
23
64
mysql_ver : " 5.7"
24
65
steps :
25
- - uses : actions/checkout@v2
66
+ - uses : actions/checkout@v3
26
67
- name : Set up Python ${{matrix.py_ver}}
27
- uses : actions/setup-python@v2
68
+ uses : actions/setup-python@v4
28
69
with :
29
70
python-version : ${{matrix.py_ver}}
30
71
- name : Install dependencies
31
72
run : |
32
73
python -m pip install --upgrade pip
33
- pip install flake8
74
+ pip install flake8 black
34
75
- name : Run syntax tests
35
76
run : flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
36
77
- name : Run primary tests
37
78
env :
38
- UID : " 1001"
39
- GID : " 121"
40
79
PY_VER : ${{matrix.py_ver}}
80
+ DJ_PASS : simple
41
81
MYSQL_VER : ${{matrix.mysql_ver}}
42
- ALPINE_VER : " 3.10 "
82
+ DISTRO : alpine
43
83
MINIO_VER : RELEASE.2021-09-03T03-56-13Z
84
+ DOCKER_CLIENT_TIMEOUT : " 120"
44
85
COMPOSE_HTTP_TIMEOUT : " 120"
45
- COVERALLS_SERVICE_NAME : travis-ci
46
- COVERALLS_REPO_TOKEN : fd0BoXG46TPReEem0uMy7BJO5j0w1MQiY
47
- run : docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
86
+ run : |
87
+ export HOST_UID=$(id -u)
88
+ docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
48
89
- name : Run style tests
49
90
run : |
50
- flake8 --ignore=E121,E123,E126,E226,E24,E704,W503,W504, E722,F401,W605 datajoint \
91
+ flake8 --ignore=E203, E722,W503 datajoint \
51
92
--count --max-complexity=62 --max-line-length=127 --statistics
93
+ black datajoint --check -v
94
+ black tests --check -v
95
+ publish-docs :
96
+ if : |
97
+ github.event_name == 'push' &&
98
+ startsWith(github.ref, 'refs/tags')
99
+ needs : test
100
+ runs-on : ubuntu-latest
101
+ env :
102
+ DOCKER_CLIENT_TIMEOUT : " 120"
103
+ COMPOSE_HTTP_TIMEOUT : " 120"
104
+ steps :
105
+ - uses : actions/checkout@v3
106
+ - name : Deploy docs
107
+ run : |
108
+ export MODE=BUILD
109
+ export PACKAGE=datajoint
110
+ export UPSTREAM_REPO=https://github.com/${GITHUB_REPOSITORY}.git
111
+ export HOST_UID=$(id -u)
112
+ docker compose -f docs/docker-compose.yaml up --exit-code-from docs --build
113
+ git push origin gh-pages
114
+ publish-release :
115
+ if : |
116
+ github.event_name == 'push' &&
117
+ startsWith(github.ref, 'refs/tags')
118
+ needs : test
119
+ runs-on : ubuntu-latest
120
+ strategy :
121
+ matrix :
122
+ include :
123
+ - py_ver : " 3.9"
124
+ distro : debian
125
+ image : djbase
126
+ env :
127
+ PY_VER : ${{matrix.py_ver}}
128
+ DISTRO : ${{matrix.distro}}
129
+ IMAGE : ${{matrix.image}}
130
+ TWINE_USERNAME : ${{secrets.twine_username}}
131
+ TWINE_PASSWORD : ${{secrets.twine_password}}
132
+ DOCKER_CLIENT_TIMEOUT : " 120"
133
+ COMPOSE_HTTP_TIMEOUT : " 120"
134
+ outputs :
135
+ release_upload_url : ${{steps.create_gh_release.outputs.upload_url}}
136
+ steps :
137
+ - uses : actions/checkout@v3
138
+ - name : Set up Python ${{matrix.py_ver}}
139
+ uses : actions/setup-python@v4
140
+ with :
141
+ python-version : ${{matrix.py_ver}}
142
+ - name : Determine package version
143
+ run : |
144
+ DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
145
+ RELEASE_BODY=$(python -c \
146
+ 'print(open("./CHANGELOG.md").read().split("\n\n")[1].split("\n", 1)[1])' \
147
+ )
148
+ echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
149
+ echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
150
+ echo "$RELEASE_BODY" >> $GITHUB_ENV
151
+ echo "EOF" >> $GITHUB_ENV
152
+ - name : Create GH release
153
+ id : create_gh_release
154
+ uses : actions/create-release@v1
155
+ env :
156
+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
157
+ with :
158
+ tag_name : ${{env.DJ_VERSION}}
159
+ release_name : Release ${{env.DJ_VERSION}}
160
+ body : ${{env.RELEASE_BODY}}
161
+ prerelease : false
162
+ draft : false
163
+ - name : Fetch pip artifacts
164
+ uses : actions/download-artifact@v3
165
+ with :
166
+ name : pip-datajoint-${{env.DJ_VERSION}}
167
+ path : dist
168
+ - name : Determine pip artifact paths
169
+ run : |
170
+ echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
171
+ echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV
172
+ - name : Upload pip wheel asset to release
173
+ uses : actions/upload-release-asset@v1
174
+ env :
175
+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
176
+ with :
177
+ upload_url : ${{steps.create_gh_release.outputs.upload_url}}
178
+ asset_path : ${{env.DJ_WHEEL_PATH}}
179
+ asset_name : pip-datajoint-${{env.DJ_VERSION}}.whl
180
+ asset_content_type : application/zip
181
+ - name : Upload pip sdist asset to release
182
+ uses : actions/upload-release-asset@v1
183
+ env :
184
+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
185
+ with :
186
+ upload_url : ${{steps.create_gh_release.outputs.upload_url}}
187
+ asset_path : ${{env.DJ_SDIST_PATH}}
188
+ asset_name : pip-datajoint-${{env.DJ_VERSION}}.tar.gz
189
+ asset_content_type : application/gzip
190
+ - name : Publish pip release
191
+ run : |
192
+ export HOST_UID=$(id -u)
193
+ docker-compose -f docker-compose-build.yaml run \
194
+ -e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} app \
195
+ sh -c "pip install twine && python -m twine upload dist/*"
196
+ - name : Login to DockerHub
197
+ uses : docker/login-action@v1
198
+ with :
199
+ username : ${{secrets.docker_username}}
200
+ password : ${{secrets.docker_password}}
201
+ - name : Publish image
202
+ run : |
203
+ IMAGE=$(docker images --filter "reference=datajoint/datajoint*" --format "{{.Repository}}")
204
+ TAG=$(docker images --filter "reference=datajoint/datajoint*" --format "{{.Tag}}")
205
+ docker push "${IMAGE}:${TAG}"
206
+ docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
207
+ docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
208
+ [ "$PY_VER" == "3.9" ] && [ "$DISTRO" == "debian" ] \
209
+ && docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \
210
+ && docker push "${IMAGE}:latest" \
211
+ || echo "skipping 'latest' tag..."
0 commit comments