handle epoch time in _filter_to_restriction #610
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Development | |
on: | |
pull_request: | |
push: | |
jobs: | |
test-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get changelog entry | |
id: changelog_reader | |
uses: guzman-raphael/changelog-reader-action@v5 | |
with: | |
path: ./CHANGELOG.md | |
- name: Verify changelog parsing | |
env: | |
TAG_NAME: ${{steps.changelog_reader.outputs.version}} | |
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'}} | |
run: | | |
echo "TAG_NAME=${TAG_NAME}" | |
echo "RELEASE_NAME=${RELEASE_NAME}" | |
echo "BODY=${BODY}" | |
echo "PRERELEASE=${PRERELEASE}" | |
echo "DRAFT=${DRAFT}" | |
build: | |
needs: test-changelog | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- py_ver: 3.8 | |
distro: alpine | |
image: djbase | |
- py_ver: 3.9 | |
distro: alpine | |
image: djbase | |
env: | |
PY_VER: ${{matrix.py_ver}} | |
DISTRO: ${{matrix.distro}} | |
IMAGE: ${{matrix.image}} | |
DOCKER_CLIENT_TIMEOUT: "120" | |
COMPOSE_HTTP_TIMEOUT: "120" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Compile image | |
run: | | |
export PHARUS_VERSION=$(cat pharus/version.py | grep -oP '\d+\.\d+\.\d+') | |
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/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@v4 | |
with: | |
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 | |
- name: Add pip artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pip-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}} | |
path: dist | |
retention-days: 1 | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- py_ver: 3.8 | |
distro: alpine | |
image: djbase | |
- py_ver: 3.9 | |
distro: alpine | |
image: djbase | |
env: | |
PY_VER: ${{matrix.py_ver}} | |
DISTRO: ${{matrix.distro}} | |
IMAGE: ${{matrix.image}} | |
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 | grep -oP '\d+\.\d+\.\d+') | |
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV | |
- name: Fetch image artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}} | |
- name: Run primary tests | |
run: | | |
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' && | |
startsWith(github.ref, 'refs/tags') && | |
( | |
github.repository_owner == 'datajoint' || | |
github.repository_owner == 'datajoint-company' || | |
github.repository_owner == 'dj-sciops' | |
) | |
needs: test | |
runs-on: ubuntu-latest | |
env: | |
TWINE_USERNAME: ${{secrets.twine_username}} | |
TWINE_PASSWORD: ${{secrets.twine_password}} | |
outputs: | |
release_upload_url: ${{steps.create_gh_release.outputs.upload_url}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Determine package version | |
run: | | |
PHARUS_VERSION=$(cat pharus/version.py | grep -oP '\d+\.\d+\.\d+') | |
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV | |
- name: Get changelog entry | |
id: changelog_reader | |
uses: guzman-raphael/changelog-reader-action@v5 | |
with: | |
path: ./CHANGELOG.md | |
version: ${{env.PHARUS_VERSION}} | |
- name: Create GH release | |
id: create_gh_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: ${{steps.changelog_reader.outputs.version}} | |
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: Fetch image artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: image-pharus-${{env.PHARUS_VERSION}}-py3.8-alpine | |
- name: Fetch 3.8 pip artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pip-pharus-${{env.PHARUS_VERSION}}-py3.8 | |
path: dist | |
- name: Fetch 3.9 pip artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pip-pharus-${{env.PHARUS_VERSION}}-py3.8 | |
path: dist | |
- name: Publish pip release | |
run: | | |
export HOST_UID=$(id -u) | |
docker load < "image-pharus-${PHARUS_VERSION}-py3.8-alpine.tar.gz" | |
docker compose -f docker-compose-build.yaml run \ | |
-e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} pharus \ | |
sh -lc "pip install twine && python -m twine upload dist/*" | |
- 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 3.8 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}}-py3.8.whl | |
asset_content_type: application/zip | |
- name: Upload 3.9 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}}-py3.9.whl | |
asset_content_type: application/zip | |
- name: Upload 3.8 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}}-py3.8.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload 3.9 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}}-py3.9.tar.gz | |
asset_content_type: application/gzip | |
- name: Upload deploy docker environment | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
upload_url: ${{steps.create_gh_release.outputs.upload_url}} | |
asset_path: docker-compose-deploy.yaml | |
asset_name: docker-compose-deploy.yaml | |
asset_content_type: application/yaml | |
publish-images: | |
if: | | |
github.event_name == 'push' && | |
startsWith(github.ref, 'refs/tags') && | |
( | |
github.repository_owner == 'datajoint' || | |
github.repository_owner == 'datajoint-company' || | |
github.repository_owner == 'dj-sciops' | |
) | |
needs: publish-release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- py_ver: 3.8 | |
distro: alpine | |
image: djbase | |
- py_ver: 3.9 | |
distro: alpine | |
image: djbase | |
env: | |
PY_VER: ${{matrix.py_ver}} | |
DISTRO: ${{matrix.distro}} | |
IMAGE: ${{matrix.image}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Determine package version | |
run: | | |
PHARUS_VERSION=$(cat pharus/version.py | grep -oP '\d+\.\d+\.\d+') | |
echo "PHARUS_VERSION=${PHARUS_VERSION}" >> $GITHUB_ENV | |
- name: Fetch image artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: image-pharus-${{env.PHARUS_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}} | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{secrets.docker_username}} | |
password: ${{secrets.docker_password}} | |
- name: Publish image | |
run: | | |
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 tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-py${PY_VER}" | |
docker push "${IMAGE}:${TAG}-py${PY_VER}" | |
docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-py${PY_VER}-${GITHUB_SHA:0:7}" | |
docker push "${IMAGE}:${TAG}-py${PY_VER}-${GITHUB_SHA:0:7}" | |
[ "$PY_VER" == "3.9" ] && [ "$DISTRO" == "alpine" ] \ | |
&& docker push "${IMAGE}:${TAG}" \ | |
&& 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.outputs.release_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' && | |
startsWith(github.ref, 'refs/tags') && | |
( | |
github.repository_owner == 'datajoint' || | |
github.repository_owner == 'datajoint-company' || | |
github.repository_owner == 'dj-sciops' | |
) | |
needs: publish-release | |
uses: datajoint/.github/.github/workflows/mkdocs_release.yaml@main | |
permissions: | |
contents: write |