Skip to content

Commit adbd920

Browse files
authored
Merge pull request #68 from guzman-raphael/alpha-release
Update for ALPHA release
2 parents 44de192 + 1ec8cd7 commit adbd920

27 files changed

+331
-207
lines changed

.github/workflows/development.yaml

Lines changed: 138 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Development
22
on:
3-
push:
43
pull_request:
4+
push:
5+
tags:
6+
- '*.*.*'
57
jobs:
68
build:
79
runs-on: ubuntu-latest
@@ -15,27 +17,35 @@ jobs:
1517
PY_VER: ${{matrix.py_ver}}
1618
DISTRO: ${{matrix.distro}}
1719
IMAGE: ${{matrix.image}}
18-
HOST_UID: "1001"
1920
DOCKER_CLIENT_TIMEOUT: "120"
2021
COMPOSE_HTTP_TIMEOUT: "120"
2122
AS_SCRIPT: "TRUE"
2223
steps:
2324
- uses: actions/checkout@v2
2425
- name: Compile image
2526
run: |
26-
export DJGUI_API_VERSION=$(cat dj_gui_api_server/version.py | tail -1 | \
27-
awk -F\' '{print $2}')
28-
docker-compose -f LNX-docker-compose.yaml build
29-
IMAGE=$(docker images --filter "reference=datajoint/djgui*" \
27+
export PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
28+
export HOST_UID=$(id -u)
29+
docker-compose -f docker-compose-build.yaml up --exit-code-from pharus --build
30+
IMAGE=$(docker images --filter "reference=datajoint/pharus*" \
3031
--format "{{.Repository}}")
31-
TAG=$(docker images --filter "reference=datajoint/djgui*" --format "{{.Tag}}")
32-
docker save "${IMAGE}:${TAG}" | gzip > "djgui_api-py${PY_VER}-${DISTRO}.tar.gz"
32+
TAG=$(docker images --filter "reference=datajoint/pharus*" --format "{{.Tag}}")
33+
docker save "${IMAGE}:${TAG}" | \
34+
gzip > "image-pharus-${PHARUS_VERSION}-py${PY_VER}-${DISTRO}.tar.gz"
35+
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
3336
- name: Add image artifact
3437
uses: actions/upload-artifact@v2
3538
with:
36-
name: ${{format('{0}-py{1}-{2}', 'djgui_api', matrix.py_ver, matrix.distro)}}
37-
path: >
38-
${{format('{0}-py{1}-{2}.tar.gz', 'djgui_api', matrix.py_ver, matrix.distro)}}
39+
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}}
40+
path: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
41+
${{matrix.distro}}.tar.gz"
42+
retention-days: 1
43+
- if: matrix.py_ver == '3.8' && matrix.distro == 'alpine'
44+
name: Add pip artifacts
45+
uses: actions/upload-artifact@v2
46+
with:
47+
name: pip-pharus-${{env.PHARUS_VERSION}}
48+
path: dist
3949
retention-days: 1
4050
test:
4151
needs: build
@@ -50,56 +60,133 @@ jobs:
5060
PY_VER: ${{matrix.py_ver}}
5161
DISTRO: ${{matrix.distro}}
5262
IMAGE: ${{matrix.image}}
53-
HOST_UID: "1001"
5463
DOCKER_CLIENT_TIMEOUT: "120"
5564
COMPOSE_HTTP_TIMEOUT: "120"
5665
AS_SCRIPT: "TRUE"
5766
steps:
5867
- uses: actions/checkout@v2
68+
- name: Determine package version
69+
run: |
70+
PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
71+
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
5972
- name: Fetch image artifact
6073
uses: actions/download-artifact@v2
6174
with:
62-
name: ${{format('{0}-py{1}-{2}','djgui_api', matrix.py_ver, matrix.distro)}}
75+
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}}
6376
- name: Run primary tests
6477
run: |
65-
docker load < "djgui_api-py${PY_VER}-${DISTRO}.tar.gz"
66-
export DJGUI_API_VERSION=$(cat dj_gui_api_server/version.py | tail -1 | \
67-
awk -F\' '{print $2}')
68-
docker-compose -f LNX-docker-compose.yaml up --exit-code-from dj-gui-api-test
69-
# publish:
70-
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
71-
# needs: test
72-
# runs-on: ubuntu-latest
73-
# strategy:
74-
# matrix:
75-
# include:
76-
# - py_ver: 3.8
77-
# distro: alpine
78-
# image: djbase
79-
# env:
80-
# PY_VER: ${{matrix.py_ver}}
81-
# DISTRO: ${{matrix.distro}}
82-
# IMAGE: ${{matrix.image}}
83-
# DOCKER_USERNAME: ${{secrets.docker_username}}
84-
# DOCKER_PASSWORD: ${{secrets.docker_password}}
85-
# steps:
86-
# - name: Fetch image artifact
87-
# uses: actions/download-artifact@v2
88-
# with:
89-
# name: ${{format('{0}-py{1}-{2}', matrix.conda_ver, matrix.py_ver, matrix.distro)}}
90-
# - name: Publish image
91-
# run: |
92-
# echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
93-
# docker load < "${CONDA_VER}-py${PY_VER}-${DISTRO}.tar.gz"
94-
# IMAGE=$(docker images --filter "reference=datajoint/*" --format "{{.Repository}}")
95-
# TAG=$(docker images --filter "reference=datajoint/*" --format "{{.Tag}}")
96-
# docker push "${IMAGE}:${TAG}"
97-
# docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
98-
# docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
99-
# [ "$PY_VER" == "3.9" ] && [ "$DISTRO" == "debian" ] \
100-
# && docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \
101-
# && docker push "${IMAGE}:latest" \
102-
# || echo "skipping 'latest' tag..."
78+
export HOST_UID=$(id -u)
79+
docker load < "image-pharus-${PHARUS_VERSION}-py${PY_VER}-${DISTRO}.tar.gz"
80+
docker-compose -f docker-compose-test.yaml up --exit-code-from pharus
81+
publish-release:
82+
if: github.event_name == 'push'
83+
needs: test
84+
runs-on: ubuntu-latest
85+
env:
86+
TWINE_USERNAME: ${{secrets.twine_username}}
87+
TWINE_PASSWORD: ${{secrets.twine_password}}
88+
steps:
89+
- uses: actions/checkout@v2
90+
- name: Determine package version
91+
run: |
92+
PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
93+
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
94+
- name: Fetch pip artifacts
95+
uses: actions/download-artifact@v2
96+
with:
97+
name: pip-pharus-${{env.PHARUS_VERSION}}
98+
- name: Publish pip release
99+
run: python -m twine upload dist/*
100+
- name: Get changelog entry
101+
id: changelog_reader
102+
uses: mindsers/changelog-reader-action@v2
103+
with:
104+
validation_depth: 10
105+
version: ${{steps.tag_name.outputs.current_version}}
106+
path: ./CHANGELOG.md
107+
- name: Create GH release
108+
id: create_gh_release
109+
uses: actions/create-release@v1
110+
env:
111+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
112+
with:
113+
tag_name: ${{github.ref}}
114+
release_name: Release ${{steps.changelog_reader.outputs.version}}
115+
body: ${{steps.changelog_reader.outputs.changes}}
116+
prerelease: ${{steps.changelog_reader.outputs.status == 'prereleased'}}
117+
draft: ${{steps.changelog_reader.outputs.status == 'unreleased'}}
118+
- name: Determine pip artifact paths
119+
run: |
120+
echo "PHARUS_WHEEL_PATH=$(ls dist/pharus-*.whl)" >> $GITHUB_ENV
121+
echo "PHARUS_SDIST_PATH=$(ls dist/pharus-*.tar.gz)" >> $GITHUB_ENV
122+
- name: Upload pip wheel asset to release
123+
uses: actions/upload-release-asset@v1
124+
env:
125+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
126+
with:
127+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
128+
asset_path: $${{env.PHARUS_WHEEL_PATH}}
129+
asset_name: pip-pharus-${{env.PHARUS_VERSION}}.whl
130+
asset_content_type: application/zip
131+
- name: Upload pip sdist asset to release
132+
uses: actions/upload-release-asset@v1
133+
env:
134+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
135+
with:
136+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
137+
asset_path: $${{env.PHARUS_SDIST_PATH}}
138+
asset_name: pip-pharus-${{env.PHARUS_VERSION}}.tar.gz
139+
asset_content_type: application/zip
140+
publish-images:
141+
if: github.event_name == 'push'
142+
needs: publish-release
143+
runs-on: ubuntu-latest
144+
strategy:
145+
matrix:
146+
include:
147+
- py_ver: 3.8
148+
distro: alpine
149+
image: djbase
150+
env:
151+
PY_VER: ${{matrix.py_ver}}
152+
DISTRO: ${{matrix.distro}}
153+
IMAGE: ${{matrix.image}}
154+
DOCKER_USERNAME: ${{secrets.docker_username}}
155+
DOCKER_PASSWORD: ${{secrets.docker_password}}
156+
steps:
157+
- uses: actions/checkout@v2
158+
- name: Determine package version
159+
run: |
160+
PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
161+
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
162+
- name: Fetch image artifact
163+
uses: actions/download-artifact@v2
164+
with:
165+
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}}
166+
- name: Publish image
167+
run: |
168+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
169+
docker load < "image-pharus-${PHARUS_VERSION}-py${PY_VER}-${DISTRO}.tar.gz"
170+
IMAGE=$(docker images --filter "reference=datajoint/*" --format "{{.Repository}}")
171+
TAG=$(docker images --filter "reference=datajoint/*" --format "{{.Tag}}")
172+
docker push "${IMAGE}:${TAG}"
173+
docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
174+
docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
175+
[ "$PY_VER" == "3.8" ] && [ "$DISTRO" == "alpine" ] \
176+
&& docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \
177+
&& docker push "${IMAGE}:latest" \
178+
|| echo "skipping 'latest' tag..."
179+
- name: Upload image to release
180+
uses: actions/upload-release-asset@v1
181+
env:
182+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
183+
with:
184+
upload_url: ${{needs.publish-release.steps.create_gh_release.outputs.upload_url}}
185+
asset_path: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
186+
${{matrix.distro}}.tar.gz"
187+
asset_name: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
188+
${{matrix.distro}}.tar.gz"
189+
asset_content_type: application/gzip
103190
# publish-docs:
104191
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
105192
# runs-on: ubuntu-latest

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
*__pycache__
33
.vscode
44
docker-compose.y*ml
5-
.coverage
5+
.coverage
6+
*.egg-info
7+
dist
8+
build

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
4+
5+
## [0.1.0a1] - 2021-02-16
6+
### Added
7+
- List schemas method.
8+
- List tables method.
9+
- Create, Read, Update, Delete (CRUD) operations for DataJoint table tiers: `dj.Manual`, `dj.Lookup`.
10+
- Read table records with proper paging and compounding restrictions (i.e. filters).
11+
- Read table definition method.
12+
- Support for DataJoint attribute types: `varchar`, `int`, `float`, `datetime`, `date`, `time`, `decimal`, `uuid`.
13+
- Check dependency utility to determine child table references.

contributing.md renamed to CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ What is generally expected from new contributions are the following:
3131
3. No style errors e.g. PEP8, etc.
3232
4. Similar or better code coverage
3333
- Additional documentation to reflect new feature or behavior introduced.
34+
- Necessary updates to the changelog following [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
3435
- A contributor should not approve or merge their own PR.
3536
- Reviewer suggestions or feedback should not be directly committed to a branch on contributor's fork. A less intrusive way to collaborate would be for the reviewer to PR to the contributor's fork/branch that is associated with the main PR currently in review.
3637

@@ -42,7 +43,7 @@ Since milestones represent the development plan, projects represent the actual e
4243

4344
## What is the release process? How do I know when my merged PR will officially make it into a release?
4445

45-
Releases follow the standard definition of semantic versioning. Meaning:
46+
Releases follow the standard definition of [semantic versioning](https://semver.org/spec/v2.0.0.html). Meaning:
4647

4748
`MAJOR`.`MINOR`.`PATCH`
4849

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG IMAGE
44
FROM datajoint/${IMAGE}:py${PY_VER}-${DISTRO}
55
COPY --chown=dja:anaconda ./README.md ./requirements.txt ./setup.py \
66
/main/
7-
COPY --chown=dja:anaconda ./dj_gui_api_server/*.py /main/dj_gui_api_server/
7+
COPY --chown=dja:anaconda ./pharus/*.py /main/pharus/
88
RUN \
99
cd /main && \
1010
pip install . && \
@@ -15,5 +15,12 @@ HEALTHCHECK \
1515
--interval=15s \
1616
CMD \
1717
wget --quiet --tries=1 --spider \
18-
http://localhost:5000/api/version > /dev/null 2>&1 || exit 1
19-
CMD ["djgui_api"]
18+
http://localhost:${PHARUS_PORT}${PHARUS_PREFIX}/version > /dev/null 2>&1 || exit 1
19+
ENV PHARUS_PORT 5000
20+
WORKDIR /main
21+
22+
# development service
23+
# CMD ["pharus"]
24+
25+
# production service
26+
CMD ["sh", "-lc", "gunicorn --bind 0.0.0.0:${PHARUS_PORT} pharus.server:app"]

LNX-docker-compose.yaml

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)