From a679dc1ae780d1c16b88eaa73bc06ee83b3f35a3 Mon Sep 17 00:00:00 2001 From: David Perl Date: Tue, 9 Dec 2025 07:51:01 +0100 Subject: [PATCH 1/3] ci: rename .gitea to .github --- {.gitea => .github}/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename {.gitea => .github}/workflows/ci.yml (92%) diff --git a/.gitea/workflows/ci.yml b/.github/workflows/ci.yml similarity index 92% rename from .gitea/workflows/ci.yml rename to .github/workflows/ci.yml index ab4aa4c..e370e35 100644 --- a/.gitea/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,28 +49,28 @@ jobs: - name: Checkout BEC Core uses: actions/checkout@v4 with: - repository: bec/bec + repository: bec-project/bec ref: "${{ inputs.BEC_CORE_BRANCH || 'main' }}" path: ./bec - name: Checkout Ophyd Devices uses: actions/checkout@v4 with: - repository: bec/ophyd_devices + repository: bec-project/ophyd_devices ref: "${{ inputs.OPHYD_DEVICES_BRANCH || 'main' }}" path: ./ophyd_devices - name: Checkout BEC Widgets uses: actions/checkout@v4 with: - repository: bec/bec_widgets + repository: bec-project/bec_widgets ref: "${{ inputs.BEC_WIDGETS_BRANCH || 'main' }}" path: ./bec_widgets - name: Checkout BEC Plugin Repository uses: actions/checkout@v4 with: - repository: bec/bec_testing_plugin + repository: bec-project/bec_testing_plugin ref: "${{ inputs.BEC_PLUGIN_REPO_BRANCH || github.head_ref || github.sha }}" path: ./bec_testing_plugin @@ -89,7 +89,7 @@ jobs: uv pip install --system -e ./bec/bec_lib[dev] uv pip install --system -e ./bec/bec_ipython_client uv pip install --system -e ./bec/bec_server[dev] - uv pip install --system -e ./bec_widgets[dev,pyside6] + uv pip install --system -e ./bec_widgets[dev] uv pip install --system -e ./bec_testing_plugin - name: Run Pytest with Coverage From 9ffead8224eb13fc8c2a353cc4b812a66e508c57 Mon Sep 17 00:00:00 2001 From: David Perl Date: Tue, 9 Dec 2025 07:56:24 +0100 Subject: [PATCH 2/3] fix: add release pipeline --- .github/workflows/semantic_release.yml | 100 +++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/semantic_release.yml diff --git a/.github/workflows/semantic_release.yml b/.github/workflows/semantic_release.yml new file mode 100644 index 0000000..127caac --- /dev/null +++ b/.github/workflows/semantic_release.yml @@ -0,0 +1,100 @@ +name: Continuous Delivery + +on: + push: + branches: + - main + +# default: least privileged permissions across all jobs +permissions: + contents: read + + + +jobs: + release: + runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-release-${{ github.ref_name }} + cancel-in-progress: false + + env: + PROJECT_PATH: ${{ github.repository }} + QTWEBENGINE_DISABLE_SANDBOX: 1 + QT_QPA_PLATFORM: "offscreen" + + permissions: + contents: write + + steps: + # Note: We checkout the repository at the branch that triggered the workflow + # with the entire history to ensure to match PSR's release branch detection + # and history evaluation. + # However, we forcefully reset the branch to the workflow sha because it is + # possible that the branch was updated while the workflow was running. This + # prevents accidentally releasing un-evaluated changes. + - name: Setup | Checkout Repository on Release Branch + uses: actions/checkout@v4 + with: + ref: ${{ github.ref_name }} + fetch-depth: 0 + ssh-key: ${{ secrets.CI_DEPLOY_SSH_KEY }} + ssh-known-hosts: ${{ secrets.CI_DEPLOY_SSH_KNOWN_HOSTS }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Setup | Force release branch to be at workflow sha + run: | + git reset --hard ${{ github.sha }} + - name: Evaluate | Verify upstream has NOT changed + # Last chance to abort before causing an error as another PR/push was applied to + # the upstream branch while this workflow was running. This is important + # because we are committing a version change (--commit). You may omit this step + # if you have 'commit: false' in your configuration. + # + # You may consider moving this to a repo script and call it from this step instead + # of writing it in-line. + shell: bash + run: | + set +o pipefail + + UPSTREAM_BRANCH_NAME="$(git status -sb | head -n 1 | cut -d' ' -f2 | grep -E '\.{3}' | cut -d'.' -f4)" + printf '%s\n' "Upstream branch name: $UPSTREAM_BRANCH_NAME" + + set -o pipefail + + if [ -z "$UPSTREAM_BRANCH_NAME" ]; then + printf >&2 '%s\n' "::error::Unable to determine upstream branch name!" + exit 1 + fi + + git fetch "${UPSTREAM_BRANCH_NAME%%/*}" + + if ! UPSTREAM_SHA="$(git rev-parse "$UPSTREAM_BRANCH_NAME")"; then + printf >&2 '%s\n' "::error::Unable to determine upstream branch sha!" + exit 1 + fi + + HEAD_SHA="$(git rev-parse HEAD)" + + if [ "$HEAD_SHA" != "$UPSTREAM_SHA" ]; then + printf >&2 '%s\n' "[HEAD SHA] $HEAD_SHA != $UPSTREAM_SHA [UPSTREAM SHA]" + printf >&2 '%s\n' "::error::Upstream has changed, aborting release..." + exit 1 + fi + + printf '%s\n' "Verified upstream branch has not changed, continuing with release..." + + - name: Semantic Version Release + id: release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pip install python-semantic-release==9.* wheel build twine + semantic-release -vv version + if [ ! -d dist ]; then echo No release will be made; exit 0; fi + twine upload dist/* -u __token__ -p ${{ secrets.CI_PYPI_TOKEN }} --skip-existing + semantic-release publish From bf122b90744b653cbf1a016d03dd7c8220ac41d2 Mon Sep 17 00:00:00 2001 From: David Perl Date: Tue, 9 Dec 2025 08:09:43 +0100 Subject: [PATCH 3/3] chore: update release config in pyproject --- pyproject.toml | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0d540c9..bc13916 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,9 +52,6 @@ plugin_widgets_update = "bec_testing_plugin.bec_widgets.auto_updates" [project.entry-points."bec.widgets.user_widgets"] plugin_widgets = "bec_testing_plugin.bec_widgets.widgets" -[tool.hatch.build.targets.wheel] -include = ["*"] - [tool.isort] profile = "black" line_length = 100 @@ -76,3 +73,48 @@ good-names-rgxs = [ ".*_2D.*", ".*_1D.*", ] + +[tool.hatch.build.targets.wheel] +include = ["*"] +exclude = ["docs/**", "tests/**"] + +[tool.hatch.build.targets.sdist] +include = ["*"] +exclude = ["docs/**", "tests/**"] + +[tool.semantic_release] +build_command = "pip install build wheel && python -m build" +version_toml = ["pyproject.toml:project.version"] + +[tool.semantic_release.commit_author] +env = "GIT_COMMIT_AUTHOR" +default = "semantic-release " + +[tool.semantic_release.commit_parser_options] +allowed_tags = [ + "build", + "chore", + "ci", + "docs", + "feat", + "fix", + "perf", + "style", + "refactor", + "test", +] +minor_tags = ["feat"] +patch_tags = ["fix", "perf"] +default_bump_level = 0 + +[tool.semantic_release.remote] +name = "origin" +type = "github" +ignore_token_for_push = true + +[tool.semantic_release.remote.token] +env = "GH_TOKEN" + +[tool.semantic_release.publish] +dist_glob_patterns = ["dist/*"] +upload_to_vcs_release = true