3
3
push :
4
4
branches :
5
5
- ' **' # every branch
6
+ - ' !gh-pages' # exclude gh-pages branch
6
7
- ' !stage*' # exclude branches beginning with stage
8
+ tags :
9
+ - ' \d+\.\d+\.\d+' # only semver tags
7
10
pull_request :
8
11
branches :
9
12
- ' **' # every branch
10
13
- ' !stage*' # exclude branches beginning with stage
11
14
jobs :
12
- build-docs :
15
+ build :
13
16
runs-on : ubuntu-latest
17
+ strategy :
18
+ matrix :
19
+ include :
20
+ - py_ver : 3.8
21
+ distro : alpine
22
+ image : djbase
14
23
env :
24
+ PY_VER : ${{matrix.py_ver}}
25
+ DISTRO : ${{matrix.distro}}
26
+ IMAGE : ${{matrix.image}}
15
27
DOCKER_CLIENT_TIMEOUT : " 120"
16
28
COMPOSE_HTTP_TIMEOUT : " 120"
17
29
steps :
18
30
- uses : actions/checkout@v2
19
- - name : Compile docs static artifacts
31
+ - name : Build pip artifacts
20
32
run : |
33
+ export DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
21
34
export HOST_UID=$(id -u)
22
- docker-compose -f ./docs-api/docker-compose.yaml up --exit-code-from docs-builder --build
23
- - name : Add docs static artifacts
35
+ docker-compose -f docker-compose-build.yaml up --exit-code-from app --build
36
+ echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
37
+ - if : matrix.py_ver == '3.8' && matrix.distro == 'alpine'
38
+ name : Add pip artifacts
24
39
uses : actions/upload-artifact@v2
25
40
with :
26
- name : docs-api-static
27
- path : docs-api/build/html
41
+ name : pip-datajoint-${{env.DJ_VERSION}}
42
+ path : dist
28
43
retention-days : 1
29
44
test :
30
- if : github.event_name == 'push' || github.event_name == 'pull_request'
31
45
runs-on : ubuntu-latest
32
46
strategy :
33
47
matrix :
39
53
steps :
40
54
- uses : actions/checkout@v2
41
55
- name : Set up Python ${{matrix.py_ver}}
42
- uses : actions/setup-python@v2
56
+ uses : actions/setup-python@v4
43
57
with :
44
58
python-version : ${{matrix.py_ver}}
45
59
- name : Install dependencies
@@ -50,58 +64,119 @@ jobs:
50
64
run : flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
51
65
- name : Run primary tests
52
66
env :
53
- UID : " 1001"
54
- GID : " 121"
55
67
PY_VER : ${{matrix.py_ver}}
56
68
MYSQL_VER : ${{matrix.mysql_ver}}
57
69
ALPINE_VER : " 3.10"
58
70
MINIO_VER : RELEASE.2021-09-03T03-56-13Z
59
71
COMPOSE_HTTP_TIMEOUT : " 120"
60
72
COVERALLS_SERVICE_NAME : travis-ci
61
73
COVERALLS_REPO_TOKEN : fd0BoXG46TPReEem0uMy7BJO5j0w1MQiY
62
- run : docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
74
+ run : |
75
+ export HOST_UID=$(id -u)
76
+ export HOST_GID=$(id -g)
77
+ docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
63
78
- name : Run style tests
64
79
run : |
65
- flake8 --ignore=E203,E722,F401, W503 datajoint \
80
+ flake8 --ignore=E203,E722,W503 datajoint \
66
81
--count --max-complexity=62 --max-line-length=127 --statistics
67
82
black datajoint --check -v
68
83
black tests --check -v
69
84
publish-docs :
70
85
if : |
71
86
github.event_name == 'push' &&
72
- (
73
- github.repository_owner == 'datajoint' ||
74
- github.repository_owner == 'datajoint-company' ||
75
- github.repository_owner == 'dj-sciops'
76
- )
77
- needs : build-docs
87
+ startsWith(github.ref, 'refs/tags')
88
+ needs : test
89
+ runs-on : ubuntu-latest
90
+ env :
91
+ DOCKER_CLIENT_TIMEOUT : " 120"
92
+ COMPOSE_HTTP_TIMEOUT : " 120"
93
+ steps :
94
+ - uses : actions/checkout@v2
95
+ - name : Deploy docs
96
+ run : |
97
+ export MODE=BUILD
98
+ export PACKAGE=datajoint
99
+ export UPSTREAM_REPO=https://github.com/${GITHUB_REPOSITORY}.git
100
+ export HOST_UID=$(id -u)
101
+ docker compose -f docs/docker-compose.yaml up --exit-code-from docs --build
102
+ git push origin gh-pages
103
+ publish-release :
104
+ if : |
105
+ github.event_name == 'push' &&
106
+ startsWith(github.ref, 'refs/tags')
107
+ needs : test
78
108
runs-on : ubuntu-latest
109
+ strategy :
110
+ matrix :
111
+ include :
112
+ - py_ver : 3.8
113
+ distro : alpine
114
+ image : djbase
115
+ env :
116
+ PY_VER : ${{matrix.py_ver}}
117
+ DISTRO : ${{matrix.distro}}
118
+ IMAGE : ${{matrix.image}}
119
+ TWINE_USERNAME : ${{secrets.twine_username}}
120
+ TWINE_PASSWORD : ${{secrets.twine_password}}
121
+ DOCKER_CLIENT_TIMEOUT : " 120"
122
+ COMPOSE_HTTP_TIMEOUT : " 120"
123
+ outputs :
124
+ release_upload_url : ${{steps.create_gh_release.outputs.upload_url}}
79
125
steps :
80
126
- uses : actions/checkout@v2
81
- - name : Fetch docs static artifacts
127
+ - name : Set up Python ${{matrix.py_ver}}
128
+ uses : actions/setup-python@v4
129
+ with :
130
+ python-version : ${{matrix.py_ver}}
131
+ - name : Determine package version
132
+ run : |
133
+ DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
134
+ RELEASE_BODY=$(python -c \
135
+ 'print(open("./CHANGELOG.md").read().split("\n\n")[1].split("\n", 1)[1])' \
136
+ )
137
+ echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
138
+ echo "RELEASE_BODY=${RELEASE_BODY}" >> $GITHUB_ENV
139
+ - name : Create GH release
140
+ id : create_gh_release
141
+ uses : actions/create-release@v1
142
+ env :
143
+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
144
+ with :
145
+ tag_name : ${{env.DJ_VERSION}}
146
+ release_name : Release ${{env.DJ_VERSION}}
147
+ body : ${{env.RELEASE_BODY}}
148
+ prerelease : false
149
+ draft : false
150
+ - name : Fetch pip artifacts
82
151
uses : actions/download-artifact@v2
83
152
with :
84
- name : docs-api-static
85
- path : docs-api/build/html
86
- - name : Commit documentation changes
153
+ name : pip-datajoint-${{env.DJ_VERSION}}
154
+ path : dist
155
+ - name : Determine pip artifact paths
87
156
run : |
88
- git clone https://github.com/${GITHUB_REPOSITORY}.git \
89
- --branch gh-pages --single-branch gh-pages
90
- rm -R gh-pages/*
91
- cp -r docs-api/build/html/* gh-pages/
92
- cp .gitignore gh-pages/
93
- touch gh-pages/.nojekyll
94
- echo "docs-api.datajoint.org" > gh-pages/CNAME
95
- cd gh-pages
96
- git config --local user.email "[email protected] "
97
- git config --local user.name "GitHub Action"
98
- git add . --all
99
- git commit -m "Update documentation" -a || true
100
- # The above command will fail if no changes were present, so we ignore
101
- # the return code.
102
- - name : Push changes
103
- uses : ad-m/github-push-action@master
157
+ echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
158
+ echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV
159
+ - name : Upload pip wheel asset to release
160
+ uses : actions/upload-release-asset@v1
161
+ env :
162
+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
104
163
with :
105
- branch : gh-pages
106
- directory : gh-pages
107
- github_token : ${{secrets.GITHUB_TOKEN}}
164
+ upload_url : ${{steps.create_gh_release.outputs.upload_url}}
165
+ asset_path : ${{env.DJ_WHEEL_PATH}}
166
+ asset_name : pip-datajoint-${{env.DJ_VERSION}}.whl
167
+ asset_content_type : application/zip
168
+ - name : Upload pip sdist asset to release
169
+ uses : actions/upload-release-asset@v1
170
+ env :
171
+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
172
+ with :
173
+ upload_url : ${{steps.create_gh_release.outputs.upload_url}}
174
+ asset_path : ${{env.DJ_SDIST_PATH}}
175
+ asset_name : pip-datajoint-${{env.DJ_VERSION}}.tar.gz
176
+ asset_content_type : application/gzip
177
+ - name : Publish pip release
178
+ run : |
179
+ export HOST_UID=$(id -u)
180
+ docker-compose -f docker-compose-build.yaml run \
181
+ -e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} app \
182
+ sh -lc "pip install twine && python -m twine upload dist/*"
0 commit comments