Skip to content

Commit 9d5968a

Browse files
ci: fix loadtest job on stable branches
Previously, the loadtest would always compare against main and the latest tag. This meant a loadtest running on the v13 release branch, would compare to a *future* version of both. This is not useful, and also not supported by `postgrest-loadtest-against`, which recently introduced a change on `main`, that now breaks the tests on the back branches. With this change, the loadtest will always run against the current target branch of a PR, so against the v13 branch for a PR against v13, for example. Also, it will compare against the latest released tag *for that branch*. Thus, when running this for v12, it will test against the v12 branch and the v12.2.12 tag.
1 parent 9519278 commit 9d5968a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/test.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,16 @@ jobs:
125125
with:
126126
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
127127
tools: loadtest.loadtestAgainst.bin loadtest.report.bin
128-
- uses: WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce # v1.4.0
129-
id: get-latest-tag
130-
with:
131-
prefix: v
132128
- name: Run loadtest
129+
env:
130+
TARGET_BRANCH: ${{ github.base_ref || github.ref_name }}
133131
run: |
134-
postgrest-loadtest-against -k ${{ matrix.kind }} main ${{ steps.get-latest-tag.outputs.tag }}
132+
if [ "$TARGET_BRANCH" = "main" ]; then
133+
latest_tag=$(git tag --sort=-creatordate --list "v*" | head -n1)
134+
else
135+
latest_tag=$(git tag --merged HEAD --sort=-creatordate "v*" | head -n1)
136+
fi
137+
postgrest-loadtest-against -k ${{ matrix.kind }} "$TARGET_BRANCH" "$latest_tag"
135138
postgrest-loadtest-report -g ${{ matrix.kind }} >> "$GITHUB_STEP_SUMMARY"
136139
137140
flake:

0 commit comments

Comments
 (0)