From 5c103501168619709242c5e8bb60f3c3ae79086e Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 10:15:42 +0200 Subject: [PATCH 01/12] Prepare release 0.2.0 --- pytest-saas/doc/changes/changelog.md | 2 ++ pytest-saas/doc/changes/changes_0.2.0.md | 13 +++++++++++++ pytest-saas/doc/changes/unreleased.md | 8 -------- pytest-saas/exasol/pytest_saas/version.py | 2 +- pytest-saas/pyproject.toml | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 pytest-saas/doc/changes/changes_0.2.0.md 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" From ceb293f099601ec3fcb12f755be853b4d94c41f6 Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 10:20:35 +0200 Subject: [PATCH 02/12] #17: Prepare release pytest-saas 0.2.0 --- .github/workflows/cd.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f2baaa1..e09a822 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: @@ -10,6 +10,7 @@ on: type: choice options: - "pytest-itde" + - "pytest-saas" version: description: 'Version number for the release' required: True @@ -21,8 +22,20 @@ jobs: steps: - name: Check run: | - echo "Stub: validate that all preconditions for the release are meet" + echo "Stub: validate that all preconditions for the release are met" + + - name: SCM Checkout + uses: actions/checkout@v4 + + - name: Setup Python & Poetry Environment + uses: exasol/python-toolbox/.github/actions/python-environment@0.9.0 - name: run: | - just release ${{ inputs.project }} ${{ inputs.version }} + TAG="${{ inputs.project }}-${{ inputs.version }}" + git tag "${TAG}" + git push origin "${TAG}" + echo just release ${{ inputs.project }} ${{ inputs.version }} + env: + POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__" + POETRY_HTTP_BASIC_PYPI_PASSWORD: "${{ secrets.PYPI_TOKEN }}" From 334f6e746444149f8c02a5d94bdb5f43ea2fd916 Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 10:58:44 +0200 Subject: [PATCH 03/12] Updated workflow cd.yml --- .github/workflows/cd.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e09a822..6d06165 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,6 +20,13 @@ jobs: runs-on: ubuntu-20.04 steps: + - 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: Check run: | echo "Stub: validate that all preconditions for the release are met" @@ -33,9 +40,12 @@ jobs: - name: run: | TAG="${{ inputs.project }}-${{ inputs.version }}" - git tag "${TAG}" - git push origin "${TAG}" echo just release ${{ inputs.project }} ${{ inputs.version }} + echo gh release create ${GITHUB_REF_NAME} \ + --title ${GITHUB_REF_NAME} \ + --notes-file ./${PROJECT}/doc/changes/changes_${VERSION}.md \ + --latest --target main \ + dist/* env: POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__" POETRY_HTTP_BASIC_PYPI_PASSWORD: "${{ secrets.PYPI_TOKEN }}" From 112341b04438778162ea1a6303f04adfcc0c7d37 Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 10:59:40 +0200 Subject: [PATCH 04/12] Experiment 1 --- .github/workflows/cd.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6d06165..b06ed4f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,12 +20,12 @@ jobs: runs-on: ubuntu-20.04 steps: - - 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: 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: Check run: | From d04281758d5aee78487ce119c9fc700fa0565cfc Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 11:01:35 +0200 Subject: [PATCH 05/12] Experiment 2 --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b06ed4f..4944a1b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -34,8 +34,8 @@ jobs: - name: SCM Checkout uses: actions/checkout@v4 - - name: Setup Python & Poetry Environment - uses: exasol/python-toolbox/.github/actions/python-environment@0.9.0 + - name: Setup Development Environment + uses: ./.github/actions/pytest-plugins-environment - name: run: | From d02eb9c99638e6a9a744fb8329be27e55afbf3cb Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 11:07:44 +0200 Subject: [PATCH 06/12] Experiment 3 --- .github/workflows/cd.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 4944a1b..e285f05 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,11 +9,11 @@ on: default: 'pytest-itde' type: choice options: - - "pytest-itde" - "pytest-saas" + - "pytest-itde" version: description: 'Version number for the release' - required: True + required: true type: int jobs: Release: @@ -41,9 +41,9 @@ jobs: run: | TAG="${{ inputs.project }}-${{ inputs.version }}" echo just release ${{ inputs.project }} ${{ inputs.version }} - echo gh release create ${GITHUB_REF_NAME} \ - --title ${GITHUB_REF_NAME} \ - --notes-file ./${PROJECT}/doc/changes/changes_${VERSION}.md \ + echo gh release create ${TAG} \ + --title ${TAG} \ + --notes-file ./${{ inputs.project }}/doc/changes/changes_${{ inputs.version }}.md \ --latest --target main \ dist/* env: From 9593b78450a5b2d979f94f170b1295739fd10113 Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 11:30:21 +0200 Subject: [PATCH 07/12] Described release process in developer guide --- .github/workflows/cd.yml | 11 ++++------- doc/developer-guide.md | 28 ++++++++++++++++++++++++++++ justfile | 4 ++-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e285f05..3472061 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -27,10 +27,6 @@ jobs: # script: | # core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') - - name: Check - run: | - echo "Stub: validate that all preconditions for the release are met" - - name: SCM Checkout uses: actions/checkout@v4 @@ -40,11 +36,12 @@ jobs: - name: run: | TAG="${{ inputs.project }}-${{ inputs.version }}" - echo just release ${{ inputs.project }} ${{ inputs.version }} - echo gh release create ${TAG} \ + just release ${{ inputs.project }} + gh release create ${TAG} \ --title ${TAG} \ --notes-file ./${{ inputs.project }}/doc/changes/changes_${{ inputs.version }}.md \ - --latest --target main \ + --latest \ + --target main \ dist/* env: POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__" diff --git a/doc/developer-guide.md b/doc/developer-guide.md index cbc0d0a..7d04c4b 100644 --- a/doc/developer-guide.md +++ b/doc/developer-guide.md @@ -21,3 +21,31 @@ 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 +* Publish to pypi +* Create a release on GitHub + +This requires to have a dedicated Git-tag for each release of each of the +plugins. The convention is to use the name of the plugin as prefix followed +by a dash character and the version of the plugin, e.g. `pytest-saas-0.1.0`. + +In order to create release for one of the plugins +1. Open the GitHub repository in your browser +2. On top select 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 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..c5cf40f 100644 --- a/justfile +++ b/justfile @@ -20,10 +20,10 @@ 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=" #!/usr/bin/env bash poetry -C $(pwd)/{{project}}/ build - poetry -C $(pwd)/{{project}}/ publish + echo poetry -C $(pwd)/{{project}}/ publish From b258e8f29e2397676ba7a317d3a7836263100ae9 Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 11:32:58 +0200 Subject: [PATCH 08/12] Added GITHUB_TOKEN to env for running GH --- .github/workflows/cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3472061..b25a023 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -44,5 +44,6 @@ jobs: --target main \ dist/* env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__" POETRY_HTTP_BASIC_PYPI_PASSWORD: "${{ secrets.PYPI_TOKEN }}" From b3dfb5a427cfae1372caada8c654bb6c7bc8f1da Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 11:36:22 +0200 Subject: [PATCH 09/12] Fixed path to dist --- .github/workflows/cd.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b25a023..c5d5301 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -6,7 +6,7 @@ on: project: description: 'Project to release' required: true - default: 'pytest-itde' + default: 'pytest-saas' type: choice options: - "pytest-saas" @@ -35,15 +35,17 @@ jobs: - name: run: | - TAG="${{ inputs.project }}-${{ inputs.version }}" - just release ${{ inputs.project }} + just release ${PROJECT} gh release create ${TAG} \ --title ${TAG} \ - --notes-file ./${{ inputs.project }}/doc/changes/changes_${{ inputs.version }}.md \ + --notes-file ./${PROJECT}/doc/changes/changes_${VERSION}.md \ --latest \ --target main \ - dist/* + ${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 }}" From 0d37e6c005a4c40d823eb574d5a28eb36a1d5c46 Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 11:39:42 +0200 Subject: [PATCH 10/12] Prepared merge and usage on main --- .github/workflows/cd.yml | 12 ++++++------ justfile | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c5d5301..ab8d254 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,12 +20,12 @@ jobs: runs-on: ubuntu-20.04 steps: -# - 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: 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 diff --git a/justfile b/justfile index c5cf40f..6268e2d 100644 --- a/justfile +++ b/justfile @@ -26,4 +26,4 @@ release project: @echo "- POETRY_HTTP_BASIC_PYPI_PASSWORD=" #!/usr/bin/env bash poetry -C $(pwd)/{{project}}/ build - echo poetry -C $(pwd)/{{project}}/ publish + poetry -C $(pwd)/{{project}}/ publish From 28fa9377624d3bd3ed0ba38b1405f5882c8145d1 Mon Sep 17 00:00:00 2001 From: ckunki Date: Tue, 4 Jun 2024 11:42:50 +0200 Subject: [PATCH 11/12] Formatted paragraphh as a single line in developer guide --- doc/developer-guide.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/developer-guide.md b/doc/developer-guide.md index 7d04c4b..8fa757f 100644 --- a/doc/developer-guide.md +++ b/doc/developer-guide.md @@ -30,9 +30,7 @@ Releasing a single plugin includes * Publish to pypi * Create a release on GitHub -This requires to have a dedicated Git-tag for each release of each of the -plugins. The convention is to use the name of the plugin as prefix followed -by a dash character and the version of the plugin, e.g. `pytest-saas-0.1.0`. +This requires to have a dedicated Git-tag for each release of each of the plugins. The convention is to use the name of the plugin as prefix followed by a dash character and the version of the plugin, e.g. `pytest-saas-0.1.0`. In order to create release for one of the plugins 1. Open the GitHub repository in your browser From e41b170f47aeb455872ffd42a6535f48d217f682 Mon Sep 17 00:00:00 2001 From: Christoph Kuhnke Date: Tue, 4 Jun 2024 12:48:39 +0200 Subject: [PATCH 12/12] Apply suggestions from code review Co-authored-by: Mikhail Beck --- doc/developer-guide.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/developer-guide.md b/doc/developer-guide.md index 8fa757f..ed0fd23 100644 --- a/doc/developer-guide.md +++ b/doc/developer-guide.md @@ -27,20 +27,20 @@ For merging a pull request to branch `main` workflow `ci-slow.yml` needs to be r `pytest-plugins` is a multi-project repository. Each of the plugins can be released independently. Releasing a single plugin includes -* Publish to pypi -* Create a release on GitHub +* Publishing to pypi +* Creating a release on GitHub -This requires to have a dedicated Git-tag for each release of each of the plugins. The convention is to use the name of the plugin as prefix followed by a dash character and the version of the plugin, e.g. `pytest-saas-0.1.0`. +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 release for one of the plugins +In order to create a release for one of the plugins 1. Open the GitHub repository in your browser -2. On top select tab "Actions" +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 button "Run workflow" +8. Click the button "Run workflow" The workflow will then * Checkout the project