Skip to content

Update pytest requirement from <9,>=8.4.2 to >=8.4.2,<10 in /tests #5428

Update pytest requirement from <9,>=8.4.2 to >=8.4.2,<10 in /tests

Update pytest requirement from <9,>=8.4.2 to >=8.4.2,<10 in /tests #5428

Workflow file for this run

# Copyright 2024-2025 New Vector Ltd
# Copyright 2025-2026 Element Creations Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only
name: Helm Chart packaging and releasing
on:
pull_request:
push:
branches:
- main
- 'maintenance/*'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
test-suite-package:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
# We disable cache for releases to avoid cache poisoning
enable-cache: ${{ github.ref_type != 'tag' }}
activate-environment: true
- name: Set up UV environment
run: uv sync --all-packages
- name: Set version
env:
GITHUB_RUN_ID: "${{ github.run_id }}"
run: |
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
uv --directory tests/ version "${GITHUB_REF_NAME#ess-community-integration-tests-v}"
else
uv version --directory tests/ --bump "dev=$GITHUB_RUN_ID"
fi
# Because pyhelm3 is a git ref, the package cannot use it as direct dependencies when pushing to Pypi
# Instead we manually vendor pyhelm3 in the package when releasing it in CI
- name: Fetch pyhelm3
run: |
# Extract the Git reference for pyhelm3 from pyproject.toml
PYHELM_GIT_REF=$(grep -oP 'pyhelm3 @ git\+https://github.com/element-hq/pyhelm3.git@\K[^"]+' tests/pyproject.toml)
if [ -z "$PYHELM_GIT_REF" ]; then
echo "Error: Could not extract pyhelm3 Git reference from pyproject.toml."
exit 1
fi
echo "Extracted pyhelm3 Git reference: $PYHELM_GIT_REF"
# Clone and checkout the specific commit of pyhelm3
git clone https://github.com/element-hq/pyhelm3.git
cd pyhelm3
git checkout "$PYHELM_GIT_REF"
cd -
mv pyhelm3/pyhelm3 tests/pyhelm3
rm -rf pyhelm3
# Patch pyproject.toml to remove pyhelm3 dependency
sed -i '/pyhelm3 @ git+https:\/\/github.com\/element-hq\/pyhelm3.git@'"$PYHELM_GIT_REF/d" "tests/pyproject.toml"
sed -i 's/\(module-name = "integration"\)/module-name = ["pyhelm3", "integration"]/' "tests/pyproject.toml"
- name: Build
run: uv build --package ess-community-integration-tests
# Check that basic features work and we didn't miss to include crucial files
- name: Smoke test (source distribution)
run: uv run --isolated --no-project --with dist/*.tar.gz pytest-ess --test-suite synapse -- --setup-plan
- name: Dry-run Publish ESS test suite to PyPI
run: uv publish --dry-run dist/*
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ess-community-integration-tests-dist
# As only a single path and nothing after the wildcard, the uploaded artifact won't have the dist/ directory structure
# https://github.com/actions/upload-artifact?tab=readme-ov-file#upload-using-multiple-paths-and-exclusions
path: |
dist/*
retention-days: 1
helm-package:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
activate-environment: true
- name: Set up UV environment
run: uv sync
- uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
- name: Set version
run: |
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
scripts/check_semver.py "$GITHUB_REF_NAME"
scripts/set_chart_version.sh "$GITHUB_REF_NAME"
elif [ "$GITHUB_EVENT_NAME" = "pull_request" ] || [ "$GITHUB_EVENT_NAME" = "pull_request_target" ]; then
actual_pr_head_commit=$(yq --input-format json -r '.pull_request.head.sha' "$GITHUB_EVENT_PATH")
version=$(yq '.version' charts/matrix-stack/Chart.yaml | sed "s/-dev/-sha$actual_pr_head_commit/")
scripts/set_chart_version.sh "$version"
elif [ "$GITHUB_EVENT_NAME" != "main" ]; then
version=$(yq '.version' charts/matrix-stack/Chart.yaml | sed "s/-dev/-sha$GITHUB_SHA/")
scripts/set_chart_version.sh "$version"
else
echo "Did not set chart version on event $GITHUB_EVENT_NAME: $GITHUB_REF_TYPE/$GITHUB_REF_NAME"
fi
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set helm changes annotations
run: |
scripts/towncrier_to_helm_annotation.py charts/matrix-stack
- name: Generate changelog
run: |
version=$(yq '.version' charts/matrix-stack/Chart.yaml)
# Add changes to CHANGELOG.md, keep files to generate CHANGELOG.latest.md
towncrier build --version "$version" --keep
# in empty file
sed -i "s/CHANGELOG.md/CHANGELOG.latest.md/" pyproject.toml
towncrier build --version "$version" --yes
sed -i "s/CHANGELOG.latest.md/CHANGELOG.md/" pyproject.toml
- name: Helm package
run: |
cd charts/matrix-stack
helm package .
- name: Helm push
if: ${{ github.event_name != 'pull_request' }}
run: helm push charts/matrix-stack/matrix-stack-*.tgz oci://ghcr.io/${{ github.repository }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: helm-package
path: |
charts/matrix-stack/*.tgz*
CHANGELOG.md
CHANGELOG.latest.md
retention-days: 1
release:
if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
permissions:
contents: write
packages: read
pull-requests: write
needs:
- helm-package
- test-suite-package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
# We are creating a commit changing the chart version for the next version PR
persist-credentials: true
- name: Grab packaged chart
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: helm-package
path: ./
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
activate-environment: true
- name: Set up UV environment
run: uv sync
- name: Calculate versions
id: versions
run: |
this_version=$(find charts/matrix-stack -name 'matrix-stack-*.tgz' | sed 's/.*matrix-stack-//;s/.tgz//')
next_version=$(echo "$this_version" | sed 's/-dev//' | awk -F'[ .]' '{print $1"."$2"."$3+1"-dev"}')
scripts/set_chart_version.sh "$next_version"
echo "this-version=$this_version" >> "$GITHUB_OUTPUT"
echo "next-version=$next_version" >> "$GITHUB_OUTPUT"
- name: Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
draft: true
body_path: CHANGELOG.latest.md
files: charts/matrix-stack/matrix-stack*.tgz*
fail_on_unmatched_files: true
# This could simply be omitted if we didn't want to test without a tag
tag_name: "${{ steps.versions.outputs.this-version }}"
- name: Remove latest changelog
run: |
rm CHANGELOG.latest.md
rm newsfragments/*.md
touch newsfragments/.gitkeep
- name: Create PR for next patch version
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
branch: "gha/bump-to-${{ steps.versions.outputs.next-version }}"
base: "main"
commit-message: "Bump chart version to ${{ steps.versions.outputs.next-version }}"
title: "Bump chart version to ${{ steps.versions.outputs.next-version }} after release"
labels: automated,version-bump
body: |
${{ steps.versions.outputs.this-version }} has just been released.
This PR prepares the chart & dependencies for the next release:
${{ steps.versions.outputs.next-version }}.
The target branch may be wrong. In which case this PR should be taken over and manually adjusted.
release-integration-tests:
if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
permissions:
packages: read
id-token: write
environment: pypi
needs:
- release
- test-suite-package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
activate-environment: true
- name: Set up UV environment
run: uv sync
- name: Grab packaged test-suite
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ess-community-integration-tests-dist
path: dist/
- name: Publish ESS test suite to PyPI
run: uv publish dist/*