diff --git a/.github/.staging_workflows/anchored_u24_element_before_release.yaml b/.github/.staging_workflows/anchored_u24_element_before_release.yaml new file mode 100644 index 0000000..d1d6e43 --- /dev/null +++ b/.github/.staging_workflows/anchored_u24_element_before_release.yaml @@ -0,0 +1,28 @@ +name: u24_element_before_release + +on: + pull_request: + push: + branches: + - '**' + tags-ignore: + - '**' + workflow_dispatch: + +anchor-dev-build-call: &dev-build-call + uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main + +anchor-test-build-call: &test-build-call + uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main + +anchor-prod-build-call: &prod-build-call + uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main + +jobs: + call_context_check: + uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main + call_u24_elements_build_alpine: + !!merge <<: *$STAGE-build-call + with: + py_ver: 3.9 + image: djbase \ No newline at end of file diff --git a/.github/.staging_workflows/anchored_u24_element_release_call.yaml b/.github/.staging_workflows/anchored_u24_element_release_call.yaml new file mode 100644 index 0000000..2b809f2 --- /dev/null +++ b/.github/.staging_workflows/anchored_u24_element_release_call.yaml @@ -0,0 +1,59 @@ +name: u24_element_release_call + +on: + workflow_run: + workflows: ["u24_element_tag_to_release"] + types: + - completed + +anchor-dev-release-call: &dev-release-call + uses: yambottle/djsciops-cicd/.github/workflows/u24_element_release.yaml@main + +anchor-test-release-call: &test-release-call + uses: yambottle/djsciops-cicd/.github/workflows/u24_element_release.yaml@main + +anchor-prod-release-call: &prod-release-call + uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_release.yaml@main + +anchor-dev-release-if: &dev-release-if + if: >- + github.event.workflow_run.conclusion == 'success' && + github.repository_owner == 'yambottle' && + !contains(github.event.workflow_run.head_branch, 'test') + +anchor-test-release-if: &test-release-if + if: >- + github.event.workflow_run.conclusion == 'success' && + github.repository_owner == 'yambottle' && + !contains(github.event.workflow_run.head_branch, 'test') + +anchor-prod-release-if: &prod-release-if + if: >- + github.event.workflow_run.conclusion == 'success' && + github.repository_owner == 'datajoint' && + !contains(github.event.workflow_run.head_branch, 'test') + +jobs: + call_context_check: + uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main + test_call_u24_elements_release_alpine: + if: >- + github.event.workflow_run.conclusion == 'success' && + ( contains(github.event.workflow_run.head_branch, 'test') || + (github.event.workflow_run.event == 'pull_request')) + !!merge <<: *$STAGE-release-call + with: + py_ver: 3.9 + twine_repo: testpypi + secrets: + TWINE_USERNAME: ${{secrets.TWINE_TEST_USERNAME}} + TWINE_PASSWORD: ${{secrets.TWINE_TEST_PASSWORD}} + + call_u24_elements_release_alpine: + !!merge <<: *$STAGE-release-if + !!merge <<: *$STAGE-release-call + with: + py_ver: 3.9 + secrets: + TWINE_USERNAME: ${{secrets.TWINE_USERNAME}} + TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}} \ No newline at end of file diff --git a/.github/.staging_workflows/anchored_u24_element_tag_to_release.yaml b/.github/.staging_workflows/anchored_u24_element_tag_to_release.yaml new file mode 100644 index 0000000..cc6be67 --- /dev/null +++ b/.github/.staging_workflows/anchored_u24_element_tag_to_release.yaml @@ -0,0 +1,25 @@ +name: u24_element_tag_to_release + +on: + push: + tags: + - '*.*.*' + - 'test*.*.*' + +anchor-dev-build-call: &dev-build-call + uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main + +anchor-test-build-call: &test-build-call + uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main + +anchor-prod-build-call: &prod-build-call + uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main + +jobs: + call_context_check: + uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main + call_u24_elements_build_alpine: + !!merge <<: *$STAGE-build-call + with: + py_ver: 3.9 + image: djbase \ No newline at end of file diff --git a/.github/.staging_workflows/normalize.sh b/.github/.staging_workflows/normalize.sh new file mode 100644 index 0000000..e15479c --- /dev/null +++ b/.github/.staging_workflows/normalize.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# For Github Action that doesn't support anchor yet... +# https://github.com/actions/runner/issues/1182 +# yq is not the version from pypi with the same name. + +export STAGE=${1:-prod} +# .yaml in .staging_workflows has to be named using a prefix, e.g., 'anchored_', this will be removed when normalizing +PREFIX=${2:-anchored_} +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + +run_yq() { + local src_file + local filename + local target + for src_file in "${SCRIPT_DIR}"/*.y*ml; do + [[ ! -f ${src_file} ]] && continue + filename=$(basename "$src_file") + target="${SCRIPT_DIR}"/../workflows/${filename#"$PREFIX"} + envsubst '${STAGE}' <"$src_file" | yq e 'explode(.) | del(.anchor-*)' >"$target" + done +} + +run_yq \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..31fe9fc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,39 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' + +--- + +## Bug Report + +### Description + +A clear and concise description of what is the overall operation that is intended to be +performed that resulted in an error. + +### Reproducibility +Include: +- OS (WIN | MACOS | Linux) +- DataJoint Element Version +- MySQL Version +- MySQL Deployment Strategy (local-native | local-docker | remote) +- Minimum number of steps to reliably reproduce the issue +- Complete error stack as a result of evaluating the above steps + +### Expected Behavior +A clear and concise description of what you expected to happen. + +### Screenshots +If applicable, add screenshots to help explain your problem. + +### Additional Research and Context +Add any additional research or context that was conducted in creating this report. + +For example: +- Related GitHub issues and PR's either within this repository or in other relevant + repositories. +- Specific links to specific lines or a focus within source code. +- Relevant summary of Maintainers development meetings, milestones, projects, etc. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..d31fbac --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: DataJoint Contribution Guideline + url: https://docs.datajoint.org/python/community/02-Contribute.html + about: Please make sure to review the DataJoint Contribution Guidelines \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..1f2b784 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,57 @@ +--- +name: Feature request +about: Suggest an idea for a new feature +title: '' +labels: 'enhancement' +assignees: '' + +--- + +## Feature Request + +### Problem + +A clear and concise description how this idea has manifested and the context. Elaborate +on the need for this feature and/or what could be improved. Ex. I'm always frustrated +when [...] + +### Requirements + +A clear and concise description of the requirements to satisfy the new feature. Detail +what you expect from a successful implementation of the feature. Ex. When using this +feature, it should [...] + +### Justification + +Provide the key benefits in making this a supported feature. Ex. Adding support for this +feature would ensure [...] + +### Alternative Considerations + +Do you currently have a work-around for this? Provide any alternative solutions or +features you've considered. + +### Related Errors +Add any errors as a direct result of not exposing this feature. + +Please include steps to reproduce provided errors as follows: +- OS (WIN | MACOS | Linux) +- DataJoint Element Version +- MySQL Version +- MySQL Deployment Strategy (local-native | local-docker | remote) +- Minimum number of steps to reliably reproduce the issue +- Complete error stack as a result of evaluating the above steps + +### Screenshots +If applicable, add screenshots to help explain your feature. + +### Additional Research and Context +Add any additional research or context that was conducted in creating this feature request. + +For example: +- Related GitHub issues and PR's either within this repository or in other relevant + repositories. +- Specific links to specific lines or a focus within source code. +- Relevant summary of Maintainers development meetings, milestones, projects, etc. +- Any additional supplemental web references or links that would further justify this + feature request. diff --git a/.github/make-dev.sh b/.github/make-dev.sh new file mode 100644 index 0000000..e9bdb38 --- /dev/null +++ b/.github/make-dev.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bash ./.staging_workflows/normalize.sh dev \ No newline at end of file diff --git a/.github/make-prod.sh b/.github/make-prod.sh new file mode 100644 index 0000000..806e39e --- /dev/null +++ b/.github/make-prod.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bash ./.staging_workflows/normalize.sh prod \ No newline at end of file diff --git a/.github/make-test.sh b/.github/make-test.sh new file mode 100644 index 0000000..3870e77 --- /dev/null +++ b/.github/make-test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bash ./.staging_workflows/normalize.sh test \ No newline at end of file diff --git a/.github/run-act.sh b/.github/run-act.sh new file mode 100644 index 0000000..4ae9cdf --- /dev/null +++ b/.github/run-act.sh @@ -0,0 +1,7 @@ +#!/bin/bash +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +bash $SCRIPT_DIR/.staging_workflows/normalize.sh dev +cd .. +act -P ubuntu-latest=drewyangdev/ubuntu:act-latest \ + --secret-file $SCRIPT_DIR/.test/.secrets \ + --artifact-server-path $SCRIPT_DIR/.test/artifacts/ \ No newline at end of file diff --git a/.github/workflow/development.yaml b/.github/workflow/development.yaml deleted file mode 100644 index 0dac23c..0000000 --- a/.github/workflow/development.yaml +++ /dev/null @@ -1,147 +0,0 @@ -name: Development -on: - pull_request: - push: - tags: - - '*.*.*' -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 - 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 PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") - export PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\" '/__version__ = / {print $2}') - export HOST_UID=$(id -u) - docker-compose -f docker-compose-build.yaml up --exit-code-from element --build - IMAGE=$(docker images --filter "reference=datajoint/${PKG_NAME}*" \ - --format "{{.Repository}}") - TAG=$(docker images --filter "reference=datajoint/${PKG_NAME}*" --format "{{.Tag}}") - docker save "${IMAGE}:${TAG}" | \ - gzip > "image-${PKG_NAME}-${PKG_VERSION}-py${PY_VER}-${DISTRO}.tar.gz" - echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV - - name: Add image artifact - uses: actions/upload-artifact@v2 - with: - name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}} - path: "image-${{env.PKG_NAME}}-${{env.PKG_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-${{env.PKG_NAME}}-${{env.PKG_VERSION}} - path: dist - retention-days: 1 - publish-release: - if: github.event_name == 'push' - needs: build - 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: | - PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") - SDIST_PKG_NAME=$(echo ${PKG_NAME} | sed 's|_|-|g') - PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\" '/__version__ = / {print $2}') - echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV - echo "SDIST_PKG_NAME=${SDIST_PKG_NAME}" >> $GITHUB_ENV - - name: Get changelog entry - id: changelog_reader - uses: guzman-raphael/changelog-reader-action@v5 - with: - path: ./CHANGELOG.md - version: ${{env.PKG_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@v2 - with: - name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py3.8-alpine - - name: Fetch pip artifacts - uses: actions/download-artifact@v2 - with: - name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} - path: dist - - name: Publish pip release - run: | - export HOST_UID=$(id -u) - docker load < "image-${{env.PKG_NAME}}-${PKG_VERSION}-py3.8-alpine.tar.gz" - docker-compose -f docker-compose-build.yaml run \ - -e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} element \ - sh -lc "pip install twine && python -m twine upload dist/*" - - name: Determine pip artifact paths - run: | - echo "PKG_WHEEL_PATH=$(ls dist/${PKG_NAME}-*.whl)" >> $GITHUB_ENV - echo "PKG_SDIST_PATH=$(ls dist/${SDIST_PKG_NAME}-*.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.PKG_WHEEL_PATH}} - asset_name: pip-${{env.PKG_NAME}}-${{env.PKG_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.PKG_SDIST_PATH}} - asset_name: pip-${{env.SDIST_PKG_NAME}}-${{env.PKG_VERSION}}.tar.gz - asset_content_type: application/gzip \ No newline at end of file diff --git a/.github/workflows/u24_element_before_release.yml b/.github/workflows/u24_element_before_release.yaml similarity index 100% rename from .github/workflows/u24_element_before_release.yml rename to .github/workflows/u24_element_before_release.yaml diff --git a/.github/workflows/u24_element_release_call.yml b/.github/workflows/u24_element_release_call.yaml similarity index 100% rename from .github/workflows/u24_element_release_call.yml rename to .github/workflows/u24_element_release_call.yaml diff --git a/.github/workflows/u24_element_tag_to_release.yml b/.github/workflows/u24_element_tag_to_release.yaml similarity index 100% rename from .github/workflows/u24_element_tag_to_release.yml rename to .github/workflows/u24_element_tag_to_release.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index f0d2190..de6d2f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,20 +2,24 @@ 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.2 - 2022-08-26 +## [0.1.2] - 2022-08-26 ### Added + Added `attribute_blob` as `longblob` in the Attribute tables - support storing non-string types of data -## 0.1.1 - 2022-06-10 +## [0.1.1] - 2022-06-10 ### Added + NotImplementedError where Imported tables do not offer make function + get_trialized_alignment_event_times docstring specificity ### Changed + Diagram to reflect design with trial.BlockTrial as imported -## 0.1.0 - 2022-05-10 +## [0.1.0] - 2022-05-10 ### Added + Draft based on [Cajal](https://github.com/cajal/pipeline) and [Kavli Institute](https://github.com/kavli-ntnu/dj-docs) precursor projects + Table architecture + AlignmentEvent design to capture windows relative to an event + Adopted black formatting into code base + +[0.1.2]: https://github.com/datajoint/element-event/releases/tag/0.1.2 +[0.1.1]: https://github.com/datajoint/element-event/releases/tag/0.1.1 +[0.1.0]: https://github.com/datajoint/element-event/releases/tag/0.1.0 \ No newline at end of file