-
Notifications
You must be signed in to change notification settings - Fork 7
Break apart the functionalities in gridappsd-python #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e6d7c40
1a5ede0
017227d
62182be
4d0f7df
2805500
86e18db
3a4cb40
d2cfbd0
6fb30da
2a8940d
dad58ef
912ada7
3389ec0
7f4f181
857a73d
186fa4a
c33f476
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,257 @@ | ||
| --- | ||
| name: Deploy Pre-Release Artifacts | ||
| name: Deploy Release Artifacts | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - develop | ||
| - develop | ||
| workflow_dispatch: | ||
|
|
||
| inputs: | ||
| release-version: | ||
| description: "Version number to use. If provided bump-rule will be ignored" | ||
| required: false | ||
| default: "" | ||
| type: string | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| env: | ||
| LANG: en_US.utf-8 | ||
| LC_ALL: en_US.utf-8 | ||
| PYTHON_VERSION: '3.10' | ||
| PYTHON_VERSION: "3.10" | ||
|
|
||
| jobs: | ||
| call-deploy-release: | ||
| deploy-dev-release: | ||
| runs-on: ubuntu-22.04 | ||
| permissions: | ||
| contents: write # To push a branch | ||
| pull-requests: write # To create a PR from that branch | ||
| contents: write # To push a branch | ||
| pull-requests: write # To create a PR from that branch | ||
| steps: | ||
| - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | ||
| - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | ||
| - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | ||
|
|
||
| #---------------------------------------------- | ||
| # check-out repo and set-up python | ||
| #---------------------------------------------- | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| # ref: develop | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Python ${{ env.PYTHON_VERSION }} | ||
| id: setup-python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
|
|
||
| #---------------------------------------------- | ||
| # ----- install & configure poetry ----- | ||
| #---------------------------------------------- | ||
| - name: Install Poetry | ||
| uses: snok/install-poetry@v1.3.3 | ||
| with: | ||
| virtualenvs-create: true | ||
| virtualenvs-in-project: true | ||
| installer-parallel: true | ||
|
|
||
| # #---------------------------------------------- | ||
| # # load cached venv if cache exists | ||
| # #---------------------------------------------- | ||
| # - name: Load cached venv | ||
| # id: cached-poetry-dependencies | ||
| # uses: actions/cache@v3 | ||
| # with: | ||
| # path: .venv | ||
| # key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
|
||
| # #---------------------------------------------- | ||
| # # install dependencies if cache does not exist | ||
| # #---------------------------------------------- | ||
| # - name: Install dependencies | ||
| # if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
| # run: poetry install --no-interaction --no-root | ||
|
|
||
| #---------------------------------------------- | ||
| # install your root project, if required | ||
| #---------------------------------------------- | ||
| - name: Install library | ||
| run: | | ||
| ./scripts/poetry_install.sh | ||
|
|
||
| # git checkout develop | ||
| # poetry lock --no-update | ||
| # poetry install --no-interaction | ||
|
|
||
| # - name: Use given release-version number | ||
| # if: inputs.release-version != '' | ||
| # run: | | ||
| # echo "Using given release version is ${{ inputs.release-version }}" | ||
| # poetry version ${{ inputs.release-version }} | ||
|
|
||
| # NEW_TAG=v$(poetry version --short) | ||
|
|
||
| # # we want to be able to use the variable in later | ||
| # # steps we set a NEW_TAG environmental variable | ||
| # echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV | ||
| # # we don't want to update pyproject.toml yet. don't want this change to create merge conflict. | ||
| # # we don't really persist right version in pyproject.toml to figure out the next version. we use git tags. | ||
| # git restore pyproject.toml | ||
|
|
||
| #---------------------------------------------- | ||
| # bump version number for patch | ||
| #---------------------------------------------- | ||
| - name: Bump Version | ||
| run: | | ||
| # current_tag is the last tagged release in the repository. From there | ||
| # we need to remove the v from the beginning of the tag. | ||
| # echo "Bump rule is ${{ inputs.bump-rule }}" | ||
| # echo "Given release version is ${{ inputs.release-version }}" | ||
| dt=$(date +%Y.%-m.0) | ||
| if ! $(git tag -l "v*" = ''); then | ||
| # uses -V which is version sort to keep it monotonically increasing. | ||
| current_tag=$(git tag -l "v*" | grep --invert-match '-' | sort --reverse -V | sed -n 1p) | ||
| echo "current git tag is ${current_tag}" | ||
| current_tag=${current_tag#?} | ||
| if [[ "$current_tag" < "$dt" ]]; then | ||
| current_tag=$dt | ||
| fi | ||
| # current_tag is now the version we want to set our poetry version so | ||
| # that we can bump the version | ||
| ./scripts/run_on_each.sh poetry version ${current_tag} | ||
| ./scripts/run_on_each.sh poetry version prerelease | ||
|
|
||
| # poetry version ${current_tag} | ||
| # poetry version prerelease --no-interaction | ||
|
|
||
| else | ||
| # very first release. start with inputs.release-version | ||
|
|
||
| echo "First release. Setting tag as 0.1.0rc0" | ||
| current_tag=$(date +%Y.%-m.1) | ||
| ./scripts/run_on_each.sh poetry version ${current_tag} | ||
|
|
||
| # poetry version ${current_tag} | ||
| fi | ||
|
|
||
| NEW_TAG=v$(poetry version --short) | ||
|
|
||
| # Finally because we want to be able to use the variable in later | ||
| # steps we set a NEW_TAG environmental variable | ||
| echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV | ||
| # we don't want to update pyproject.toml yet. don't want this change to create merge conflict. | ||
| # we don't really persist right version in pyproject.toml to figure out the next version. we use git tags. | ||
| #git restore pyproject.toml | ||
|
|
||
| # #-------------------------------------------------------------- | ||
| # # Create a new releases/new_tag | ||
| # #-------------------------------------------------------------- | ||
| # - name: Create a new releases branch | ||
| # run: | | ||
| # git checkout -b releases/${NEW_TAG} | ||
| # git push --set-upstream origin releases/${NEW_TAG} | ||
|
|
||
| # #-------------------------------------------------------------- | ||
| # # merge changes back to main | ||
| # #-------------------------------------------------------------- | ||
| # - name: Merge changes back to main | ||
| # run: | | ||
| # git checkout main | ||
| # git merge ${{ inputs.merge-strategy }} releases/${NEW_TAG} | ||
| # git push | ||
|
|
||
| # - name: Run tests on main branch | ||
| # id: run-tests-on-main | ||
| # run: | | ||
| # poetry run pytest --timeout=${{ inputs.run-tests-wait }} tests | ||
| # continue-on-error: true | ||
|
|
||
| # - name: Do something with a failing build | ||
| # if: steps.run-tests-on-main.outcome != 'success' | ||
| # run: | | ||
| # echo "tests on main did not succeed. Outcome is ${{ steps.run-tests-on-main.outcome }}" | ||
| # git reset --hard HEAD~1 | ||
| # git push origin HEAD --force | ||
| # git branch -d releases/${NEW_TAG} | ||
| # git push origin --delete releases/${NEW_TAG} | ||
| # echo "reverted changes to main and removed release branch" | ||
| # exit 1 | ||
|
|
||
| - name: Create build artifacts | ||
| run: | | ||
| set -x | ||
| set -u | ||
| set -e | ||
|
|
||
| # set the right version in pyproject.toml before build and publish | ||
| ./scripts/poetry_build.sh | ||
| #./scripts/replace_path_deps.sh | ||
|
|
||
| # # all python packages, in topological order | ||
| # . scripts/projects.sh | ||
| # _projects=". ${PROJECTS}" | ||
| # echo "Running on following projects: ${_projects}" | ||
| # for p in $_projects | ||
| # do | ||
| # cd "${p}" || exit | ||
| # echo "==running in ${p}==" | ||
| # ../scripts/replace_path_deps.sh | ||
| # done | ||
|
|
||
| # poetry version ${NEW_TAG#?} | ||
| # poetry build -vvv | ||
|
|
||
| - name: Push artifacts to github | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| artifacts: "dist/*.gz,dist/*.whl" | ||
| artifactErrorsFailBuild: true | ||
| generateReleaseNotes: true | ||
| commit: ${{ github.ref }} | ||
| # check bump-rule and set accordingly | ||
| prerelease: true | ||
| tag: ${{ env.NEW_TAG }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Publish to pypi | ||
| id: publish-to-pypi | ||
| if: github.repository_owner == 'GRIDAPPSD' || github.repository_owner == 'PNNL-CIM-Tools' | ||
| run: | | ||
| echo "POETRY_PUBLISH_OPTIONS=''" >> $GITHUB_ENV | ||
| ./scripts/run_on_each.sh poetry config pypi-token.pypi ${{ secrets.pypi-token }} | ||
| ./scripts/run_on_each.sh poetry publish | ||
|
|
||
| # - name: Publish to test-pypi | ||
| # id: publish-to-test-pypi | ||
| # if: ${{ inputs.publish-to-test-pypi }} | ||
| # run: | | ||
| # poetry config repositories.test-pypi https://test.pypi.org/legacy/ | ||
| # poetry config pypi-token.test-pypi ${{ secrets.pypi-token }} | ||
| # poetry publish -r test-pypi | ||
| # continue-on-error: true | ||
|
|
||
| # - name: if publish to pypi/test-pypi failed revert main and delete release branch | ||
| # if: ${{ steps.publish-to-pypi.outcome != 'success' && steps.publish-to-test-pypi.outcome != 'success' }} | ||
| # run: | | ||
| # echo "publish to pypi/test-pypi did not succeed. Outcome for pypi = ${{ steps.publish-to-pypi.outcome }} outcome for test-pypi= ${{ steps.publish-to-test-pypi.outcome }}" | ||
| # git reset --hard HEAD~1 | ||
| # git push origin HEAD --force | ||
| # git branch -d releases/${NEW_TAG} | ||
| # git push origin --delete releases/${NEW_TAG} | ||
| # echo "reverted changes to main and removed release branch" | ||
|
|
||
| uses: GRIDAPPSD/.github/.github/workflows/deploy-dev-release.yml@main | ||
| secrets: | ||
| git-token: ${{ secrets.GITHUB_TOKEN }} | ||
| pypi-token: ${{ secrets.PYPI_TOKEN }} | ||
| # - name: if publish to pypi/test-pypi failed delete release and tag on github | ||
| # if: ${{ ! (steps.publish-to-pypi.outcome == 'success' || steps.publish-to-test-pypi.outcome == 'success') }} | ||
| # uses: dev-drprasad/delete-tag-and-release@v0.2.1 | ||
| # env: | ||
| # GITHUB_TOKEN: ${{ secrets.git-token }} | ||
| # with: | ||
| # tag_name: ${{ env.NEW_TAG }} | ||
|
|
||
| # - name: if publish to pypi/test-pypi failed exit with exit code 1 | ||
| # if: ${{ steps.publish-to-pypi.outcome != 'success' && steps.publish-to-test-pypi.outcome != 'success' }} | ||
| # run: | | ||
| # exit 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,3 +106,7 @@ ENV/ | |
|
|
||
| # visual studio code | ||
| .vscode/ | ||
|
|
||
| # pytest cache | ||
| .pytest_cache | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.1.0 | ||
| hooks: | ||
| - id: check-yaml | ||
| - id: check-json | ||
| - id: check-toml | ||
| - id: check-xml | ||
| - id: forbid-new-submodules | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| - id: check-merge-conflict | ||
| - id: no-commit-to-branch # blocks main commits. To bypass do git commit --allow-empty | ||
| - id: pretty-format-json | ||
|
|
||
|
|
||
| #- repo: https://github.com/pre-commit/mirrors-autopep8 | ||
| # rev: v1.6.0 | ||
| # hooks: | ||
| # - id: autopep8 | ||
|
|
||
| - repo: https://github.com/craig8/mirrors-yapf | ||
| rev: b84f670025671a341d0afd2b06b877b195d65c0f # Use the sha / tag you want to point at | ||
| hooks: | ||
| - id: yapf | ||
| name: yapf | ||
| description: "A formatter for Python files." | ||
| entry: yapf | ||
| language: python | ||
| types: [ python ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2023.5.1 |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another Empty changelog file. |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An empty readme file. |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea what this empty file is supposed to be and why it is present. |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another empty changelog file. why are these present? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 2023.5.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there an empty changelog file added to the repo?