Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 138 additions & 51 deletions .github/workflows/development.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Development
on:
push:
pull_request:
push:
tags:
- '*.*.*'
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -15,27 +17,35 @@ jobs:
PY_VER: ${{matrix.py_ver}}
DISTRO: ${{matrix.distro}}
IMAGE: ${{matrix.image}}
HOST_UID: "1001"
DOCKER_CLIENT_TIMEOUT: "120"
COMPOSE_HTTP_TIMEOUT: "120"
AS_SCRIPT: "TRUE"
steps:
- uses: actions/checkout@v2
- name: Compile image
run: |
export DJGUI_API_VERSION=$(cat dj_gui_api_server/version.py | tail -1 | \
awk -F\' '{print $2}')
docker-compose -f LNX-docker-compose.yaml build
IMAGE=$(docker images --filter "reference=datajoint/djgui*" \
export PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
export HOST_UID=$(id -u)
docker-compose -f docker-compose-build.yaml up --exit-code-from pharus --build
IMAGE=$(docker images --filter "reference=datajoint/pharus*" \
--format "{{.Repository}}")
TAG=$(docker images --filter "reference=datajoint/djgui*" --format "{{.Tag}}")
docker save "${IMAGE}:${TAG}" | gzip > "djgui_api-py${PY_VER}-${DISTRO}.tar.gz"
TAG=$(docker images --filter "reference=datajoint/pharus*" --format "{{.Tag}}")
docker save "${IMAGE}:${TAG}" | \
gzip > "image-pharus-${PHARUS_VERSION}-py${PY_VER}-${DISTRO}.tar.gz"
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
- name: Add image artifact
uses: actions/upload-artifact@v2
with:
name: ${{format('{0}-py{1}-{2}', 'djgui_api', matrix.py_ver, matrix.distro)}}
path: >
${{format('{0}-py{1}-{2}.tar.gz', 'djgui_api', matrix.py_ver, matrix.distro)}}
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}}
path: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
${{matrix.distro}}.tar.gz"
retention-days: 1
- if: matrix.py_ver == '3.8' && matrix.distro == 'alpine'
name: Add pip artifacts
uses: actions/upload-artifact@v2
with:
name: pip-pharus-${{env.PHARUS_VERSION}}
path: dist
retention-days: 1
test:
needs: build
Expand All @@ -50,56 +60,133 @@ jobs:
PY_VER: ${{matrix.py_ver}}
DISTRO: ${{matrix.distro}}
IMAGE: ${{matrix.image}}
HOST_UID: "1001"
DOCKER_CLIENT_TIMEOUT: "120"
COMPOSE_HTTP_TIMEOUT: "120"
AS_SCRIPT: "TRUE"
steps:
- uses: actions/checkout@v2
- name: Determine package version
run: |
PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
- name: Fetch image artifact
uses: actions/download-artifact@v2
with:
name: ${{format('{0}-py{1}-{2}','djgui_api', matrix.py_ver, matrix.distro)}}
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}}
- name: Run primary tests
run: |
docker load < "djgui_api-py${PY_VER}-${DISTRO}.tar.gz"
export DJGUI_API_VERSION=$(cat dj_gui_api_server/version.py | tail -1 | \
awk -F\' '{print $2}')
docker-compose -f LNX-docker-compose.yaml up --exit-code-from dj-gui-api-test
# publish:
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# needs: test
# runs-on: ubuntu-latest
# strategy:
# matrix:
# include:
# - py_ver: 3.8
# distro: alpine
# image: djbase
# env:
# PY_VER: ${{matrix.py_ver}}
# DISTRO: ${{matrix.distro}}
# IMAGE: ${{matrix.image}}
# DOCKER_USERNAME: ${{secrets.docker_username}}
# DOCKER_PASSWORD: ${{secrets.docker_password}}
# steps:
# - name: Fetch image artifact
# uses: actions/download-artifact@v2
# with:
# name: ${{format('{0}-py{1}-{2}', matrix.conda_ver, matrix.py_ver, matrix.distro)}}
# - name: Publish image
# run: |
# echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# docker load < "${CONDA_VER}-py${PY_VER}-${DISTRO}.tar.gz"
# IMAGE=$(docker images --filter "reference=datajoint/*" --format "{{.Repository}}")
# TAG=$(docker images --filter "reference=datajoint/*" --format "{{.Tag}}")
# docker push "${IMAGE}:${TAG}"
# docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
# docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
# [ "$PY_VER" == "3.9" ] && [ "$DISTRO" == "debian" ] \
# && docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \
# && docker push "${IMAGE}:latest" \
# || echo "skipping 'latest' tag..."
export HOST_UID=$(id -u)
docker load < "image-pharus-${PHARUS_VERSION}-py${PY_VER}-${DISTRO}.tar.gz"
docker-compose -f docker-compose-test.yaml up --exit-code-from pharus
publish-release:
if: github.event_name == 'push'
needs: test
runs-on: ubuntu-latest
env:
TWINE_USERNAME: ${{secrets.twine_username}}
TWINE_PASSWORD: ${{secrets.twine_password}}
steps:
- uses: actions/checkout@v2
- name: Determine package version
run: |
PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
- name: Fetch pip artifacts
uses: actions/download-artifact@v2
with:
name: pip-pharus-${{env.PHARUS_VERSION}}
- name: Publish pip release
run: python -m twine upload dist/*
- name: Get changelog entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_depth: 10
version: ${{steps.tag_name.outputs.current_version}}
path: ./CHANGELOG.md
- name: Create GH release
id: create_gh_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: Release ${{steps.changelog_reader.outputs.version}}
body: ${{steps.changelog_reader.outputs.changes}}
prerelease: ${{steps.changelog_reader.outputs.status == 'prereleased'}}
draft: ${{steps.changelog_reader.outputs.status == 'unreleased'}}
- name: Determine pip artifact paths
run: |
echo "PHARUS_WHEEL_PATH=$(ls dist/pharus-*.whl)" >> $GITHUB_ENV
echo "PHARUS_SDIST_PATH=$(ls dist/pharus-*.tar.gz)" >> $GITHUB_ENV
- name: Upload pip wheel asset to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
asset_path: $${{env.PHARUS_WHEEL_PATH}}
asset_name: pip-pharus-${{env.PHARUS_VERSION}}.whl
asset_content_type: application/zip
- name: Upload pip sdist asset to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
asset_path: $${{env.PHARUS_SDIST_PATH}}
asset_name: pip-pharus-${{env.PHARUS_VERSION}}.tar.gz
asset_content_type: application/zip
publish-images:
if: github.event_name == 'push'
needs: publish-release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- py_ver: 3.8
distro: alpine
image: djbase
env:
PY_VER: ${{matrix.py_ver}}
DISTRO: ${{matrix.distro}}
IMAGE: ${{matrix.image}}
DOCKER_USERNAME: ${{secrets.docker_username}}
DOCKER_PASSWORD: ${{secrets.docker_password}}
steps:
- uses: actions/checkout@v2
- name: Determine package version
run: |
PHARUS_VERSION=$(cat pharus/version.py | tail -1 | awk -F\' '{print $2}')
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV
- name: Fetch image artifact
uses: actions/download-artifact@v2
with:
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}}
- name: Publish image
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker load < "image-pharus-${PHARUS_VERSION}-py${PY_VER}-${DISTRO}.tar.gz"
IMAGE=$(docker images --filter "reference=datajoint/*" --format "{{.Repository}}")
TAG=$(docker images --filter "reference=datajoint/*" --format "{{.Tag}}")
docker push "${IMAGE}:${TAG}"
docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
[ "$PY_VER" == "3.8" ] && [ "$DISTRO" == "alpine" ] \
&& docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \
&& docker push "${IMAGE}:latest" \
|| echo "skipping 'latest' tag..."
- name: Upload image to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{needs.publish-release.steps.create_gh_release.outputs.upload_url}}
asset_path: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
${{matrix.distro}}.tar.gz"
asset_name: "image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-\
${{matrix.distro}}.tar.gz"
asset_content_type: application/gzip
# publish-docs:
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
*__pycache__
.vscode
docker-compose.y*ml
.coverage
.coverage
*.egg-info
dist
build
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog

Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.

## [0.1.0a1] - 2021-02-16
### Added
- List schemas method.
- List tables method.
- Create, Read, Update, Delete (CRUD) operations for DataJoint table tiers: `dj.Manual`, `dj.Lookup`.
- Read table records with proper paging and compounding restrictions (i.e. filters).
- Read table definition method.
- Support for DataJoint attribute types: `varchar`, `int`, `float`, `datetime`, `date`, `time`, `decimal`, `uuid`.
- Check dependency utility to determine child table references.
3 changes: 2 additions & 1 deletion contributing.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ What is generally expected from new contributions are the following:
3. No style errors e.g. PEP8, etc.
4. Similar or better code coverage
- Additional documentation to reflect new feature or behavior introduced.
- Necessary updates to the changelog following [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
- A contributor should not approve or merge their own PR.
- 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.

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

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

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

`MAJOR`.`MINOR`.`PATCH`

Expand Down
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG IMAGE
FROM datajoint/${IMAGE}:py${PY_VER}-${DISTRO}
COPY --chown=dja:anaconda ./README.md ./requirements.txt ./setup.py \
/main/
COPY --chown=dja:anaconda ./dj_gui_api_server/*.py /main/dj_gui_api_server/
COPY --chown=dja:anaconda ./pharus/*.py /main/pharus/
RUN \
cd /main && \
pip install . && \
Expand All @@ -15,5 +15,12 @@ HEALTHCHECK \
--interval=15s \
CMD \
wget --quiet --tries=1 --spider \
http://localhost:5000/api/version > /dev/null 2>&1 || exit 1
CMD ["djgui_api"]
http://localhost:${PHARUS_PORT}${PHARUS_PREFIX}/version > /dev/null 2>&1 || exit 1
ENV PHARUS_PORT 5000
WORKDIR /main

# development service
# CMD ["pharus"]

# production service
CMD ["sh", "-lc", "gunicorn --bind 0.0.0.0:${PHARUS_PORT} pharus.server:app"]
58 changes: 0 additions & 58 deletions LNX-docker-compose.yaml

This file was deleted.

Loading