diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f2baaa1..ab8d254 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,4 @@ -name: Continues Delivery (Release) +name: Continuous Delivery (Release) on: workflow_dispatch: @@ -6,23 +6,46 @@ on: project: description: 'Project to release' required: true - default: 'pytest-itde' + default: 'pytest-saas' type: choice options: + - "pytest-saas" - "pytest-itde" version: description: 'Version number for the release' - required: True + required: true type: int jobs: Release: runs-on: ubuntu-20.04 steps: - - name: Check - run: | - echo "Stub: validate that all preconditions for the release are meet" + - name: Fail if not running on main branch + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') + + - name: SCM Checkout + uses: actions/checkout@v4 + + - name: Setup Development Environment + uses: ./.github/actions/pytest-plugins-environment - name: run: | - just release ${{ inputs.project }} ${{ inputs.version }} + just release ${PROJECT} + gh release create ${TAG} \ + --title ${TAG} \ + --notes-file ./${PROJECT}/doc/changes/changes_${VERSION}.md \ + --latest \ + --target main \ + ${PROJECT}/dist/* + env: + TAG: "${{ inputs.project }}-${{ inputs.version }}" + PROJECT: "${{ inputs.project }}" + VERSION: "${{ inputs.version }}" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__" + POETRY_HTTP_BASIC_PYPI_PASSWORD: "${{ secrets.PYPI_TOKEN }}" diff --git a/doc/developer-guide.md b/doc/developer-guide.md index cbc0d0a..ed0fd23 100644 --- a/doc/developer-guide.md +++ b/doc/developer-guide.md @@ -21,3 +21,29 @@ These test cases are only executed by the following GitHub workflows Both of these workflows can be run manually, workflow `ci-main.yml` is executed automatically at the 7th day of each month. For merging a pull request to branch `main` workflow `ci-slow.yml` needs to be run and terminate successfully. + +## Release + +`pytest-plugins` is a multi-project repository. Each of the plugins can be released independently. + +Releasing a single plugin includes +* Publishing to pypi +* Creating a release on GitHub + +This requires a dedicated Git-tag for each release of each plugin. The convention is to use the name of the plugin as a prefix followed by a dash character and the version of the plugin, e.g. `pytest-saas-0.1.0`. + +In order to create a release for one of the plugins +1. Open the GitHub repository in your browser +2. On top select the tab "Actions" +3. On the left hand side select action "Continous Delivery (Release)" +4. On the right hand click button "Run workflow" +5. Select banch "main" +6. Select the project, e.g. "pytest-saas" +7. Enter the version number, e.g. `0.2.0` +8. Click the button "Run workflow" + +The workflow will then +* Checkout the project +* Build the selected plugin +* Publish it to pypi +* Create a Git-tag and a GitHub release using the naming convention described above diff --git a/justfile b/justfile index 3815213..6268e2d 100644 --- a/justfile +++ b/justfile @@ -20,7 +20,7 @@ test +projects=PROJECTS: sys.exit(rc) # Create a release -release project version: +release project: @echo "Ensure environment variables are set:" @echo "- POETRY_HTTP_BASIC_PYPI_USERNAME=__token__" @echo "- POETRY_HTTP_BASIC_PYPI_PASSWORD=" diff --git a/pytest-saas/doc/changes/changelog.md b/pytest-saas/doc/changes/changelog.md index 8963359..31c4ef5 100644 --- a/pytest-saas/doc/changes/changelog.md +++ b/pytest-saas/doc/changes/changelog.md @@ -1,6 +1,7 @@ # Changes * [unreleased](unreleased.md) +* [0.2.0](changes_0.2.0.md) * [0.1.0](changes_0.1.0.md) @@ -9,6 +10,7 @@ hidden: --- unreleased +changes_0.2.0 changes_0.1.0 ``` \ No newline at end of file diff --git a/pytest-saas/doc/changes/changes_0.2.0.md b/pytest-saas/doc/changes/changes_0.2.0.md new file mode 100644 index 0000000..deb0a61 --- /dev/null +++ b/pytest-saas/doc/changes/changes_0.2.0.md @@ -0,0 +1,13 @@ +# 0.2.0 - 2024-06-04 + +## Feature + +* #18: Implemented keep alive for saas-database + +## Bugfixes + +* #19: Fixed removing ip whitelist rule at the end of the test session + +## Refactorings + +* #17: Added workflow for releasing a single plugin \ No newline at end of file diff --git a/pytest-saas/doc/changes/unreleased.md b/pytest-saas/doc/changes/unreleased.md index d66fd04..79e701b 100644 --- a/pytest-saas/doc/changes/unreleased.md +++ b/pytest-saas/doc/changes/unreleased.md @@ -1,9 +1 @@ # Unreleased - -## Feature - -* #18: Implemented keep alive for saas-database - -## Bugfixes - -* #19: Fixed removing ip whitelist rule at the end of the test session diff --git a/pytest-saas/exasol/pytest_saas/version.py b/pytest-saas/exasol/pytest_saas/version.py index 9da9963..55cfb40 100644 --- a/pytest-saas/exasol/pytest_saas/version.py +++ b/pytest-saas/exasol/pytest_saas/version.py @@ -5,6 +5,6 @@ # Do not edit this file manually! # If you need to change the version, do so in the project.toml, e.g. by using `poetry version X.Y.Z`. MAJOR = 0 -MINOR = 1 +MINOR = 2 PATCH = 0 VERSION = f"{MAJOR}.{MINOR}.{PATCH}" diff --git a/pytest-saas/pyproject.toml b/pytest-saas/pyproject.toml index 3434cc6..c420570 100644 --- a/pytest-saas/pyproject.toml +++ b/pytest-saas/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pytest-exasol-saas" -version = "0.1.0" +version = "0.2.0" description = "" authors = ["Christoph Kuhnke "] readme = "README.md"