@@ -386,8 +386,15 @@ jobs:
386386 with :
387387 python-version : " 3.13"
388388
389- - name : Install hatch
390- run : pip install hatch
389+ - name : Install hatch and poetry
390+ run : pip install hatch poetry poetry-plugin-export
391+
392+ - name : Generate requirements from Synapse lockfile
393+ # hatch can't read synapse's lock file, we export it in a format hatch can use,
394+ # this allows us to install synapse dependencies on the version they are locked at,
395+ # this avoids errors due to new dependency versions with breaking changes.
396+ run : |
397+ poetry export --without-hashes --format requirements.txt --output "${{ github.workspace }}/synapse-invite-checker/synapse-requirements.txt"
391398
392399 - name : Determine synapse git ref
393400 id : synapse-ref
@@ -402,17 +409,30 @@ jobs:
402409
403410 - name : Update dependency to the current branch
404411 working-directory : synapse-invite-checker
412+ # the synapse dependency of the invite-checker is already pointing to synapse's master branch
413+ # we skip the branch update when the CI runs on master
405414 run : |
406- sed -i 's|"matrix-synapse[^"]*"|"matrix-synapse @ git+https://github.com/${{ steps.synapse-ref.outputs.repo }}.git@${{ steps.synapse-ref.outputs.ref }}"|' pyproject.toml
407- # Check if the file was actually modified
408- if git diff --exit-code pyproject.toml > /dev/null; then
409- echo "::error::The sed command did not modify pyproject.toml. Check if the 'matrix-synapse' dependency exists in the file."
410- exit 1
415+ if [ "${{ steps.synapse-ref.outputs.ref }}" != "master" ]; then
416+ sed -i 's|"matrix-synapse[^"]*"|"matrix-synapse @ git+https://github.com/${{ steps.synapse-ref.outputs.repo }}.git@${{ steps.synapse-ref.outputs.ref }}"|' pyproject.toml
417+ # Check if the file was actually modified
418+ if git diff --exit-code pyproject.toml > /dev/null; then
419+ echo "::error::The sed command did not modify pyproject.toml. Check if the 'matrix-synapse' dependency exists in the file."
420+ exit 1
421+ fi
411422 fi
412423
413424 - name : Run invite-checker tests
414425 working-directory : synapse-invite-checker
415- run : hatch run cov
426+ run : hatch run pip install -r synapse-requirements.txt && hatch run cov
427+
428+ - name : Display Hatch Environment Info
429+ if : always()
430+ working-directory : synapse-invite-checker
431+ run : |
432+ echo "### Hatch Environment Details"
433+ hatch env show
434+ echo "### Installed Packages"
435+ hatch run pip freeze
416436
417437 token-authenticator :
418438 if : ${{ !failure() && !cancelled() }}
@@ -435,8 +455,15 @@ jobs:
435455 with :
436456 python-version : " 3.13"
437457
438- - name : Install hatch
439- run : pip install hatch
458+ - name : Install hatch and poetry
459+ run : pip install hatch poetry poetry-plugin-export
460+
461+ - name : Generate requirements from Synapse lockfile
462+ # hatch can't read synapse's lock file, we export it in a format hatch can use
463+ # this allows us to install synapse dependencies on the version they are locked at,
464+ # this avoids errors due to new dependency versions with breaking changes
465+ run : |
466+ poetry export --without-hashes --format requirements.txt --output "${{ github.workspace }}/synapse-token-authenticator/synapse-requirements.txt"
440467
441468 - name : Determine synapse git ref
442469 id : synapse-ref
@@ -451,21 +478,26 @@ jobs:
451478
452479 - name : Update dependency to the current branch
453480 working-directory : synapse-token-authenticator
454- # the synapse dependency of the token-authenticator is already pointing to synapse's master branch
455- # we skip the branch update when the CI runs on master
456481 run : |
457- if [ "${{ steps.synapse-ref.outputs.ref }}" != "master" ]; then
458- sed -i 's|"matrix-synapse[^"]*"|"matrix-synapse @ git+https://github.com/${{ steps.synapse-ref.outputs.repo }}.git@${{ steps.synapse-ref.outputs.ref }}"|' pyproject.toml
459- # Check if the file was actually modified
460- if git diff --exit-code pyproject.toml > /dev/null; then
461- echo "::error::The sed command did not modify pyproject.toml. Check if the 'matrix-synapse' dependency exists in the file."
462- exit 1
463- fi
482+ sed -i 's|"matrix-synapse[^"]*"|"matrix-synapse @ git+https://github.com/${{ steps.synapse-ref.outputs.repo }}.git@${{ steps.synapse-ref.outputs.ref }}"|' pyproject.toml
483+ # Check if the file was actually modified
484+ if git diff --exit-code pyproject.toml > /dev/null; then
485+ echo "::error::The sed command did not modify pyproject.toml. Check if the 'matrix-synapse' dependency exists in the file."
486+ exit 1
464487 fi
465488
466489 - name : Run token-authenticator tests
467490 working-directory : synapse-token-authenticator
468- run : hatch run cov
491+ run : hatch run pip install -r synapse-requirements.txt && hatch run cov
492+
493+ - name : Display Hatch Environment Info
494+ if : always()
495+ working-directory : synapse-token-authenticator
496+ run : |
497+ echo "### Hatch Environment Details"
498+ hatch env show
499+ echo "### Installed Packages"
500+ hatch run pip freeze
469501
470502 otlp :
471503 if : ${{ !failure() && !cancelled() }}
0 commit comments