add CI validation for server dependency version#933
add CI validation for server dependency version#933chaptersix wants to merge 5 commits intotemporalio:mainfrom
Conversation
Adds a new CI job that validates the go.temporal.io/server dependency: - Ensures it's a tagged version (not a pseudo-version with commit hash) - Ensures it doesn't exceed the next server release (major.minor+1 from latest) Uses actions/github-script to fetch the latest release from temporalio/temporal and compare versions using semver.
.github/workflows/ci.yaml
Outdated
| - name: Validate server dependency version | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | |
There was a problem hiding this comment.
Will defer to CLI team, but IMO any build tooling/validation like this should be written like any other software that anyone can run at any time (in these cases in other repositories, we've often made Go commands somewhere under internal only for use as build tooling). But up to y'all.
There was a problem hiding this comment.
I don't think it needs to be a Go command because I don't see much motivation for running this outside of CI.
I would accept any modern programming language, just not shell. JS is fine in this case but it would be great if we could put the script in its own file to get proper syntax highlighting.
There was a problem hiding this comment.
I don't see much motivation for running this outside of CI
Even without much motivation, why not? It doesn't add anything, is not meaningfully more difficult, and is a clearer way to write software. I think you'll find as this script and the pattern in general grows, the unwieldiness of this approach will become apparent, might as well do it right while it doesn't cost anything.
JS is fine
This cannot be run in a traditional JS runtime as is, it's "github-script" which has a bunch of special runtime affordances. I too think traditional JS approach would be good as opposed to GH-runtime-specific.
to get proper syntax highlighting.
Arguably if you can give up type checking, you can give up syntax highlighting.
.github/workflows/ci.yaml
Outdated
|
|
||
| // Parse major.minor from a version string like "v1.30.0-148.4" or "v1.29.2" | ||
| function parseMajorMinor(version) { | ||
| const match = version.match(/^v?(\d+)\.(\d+)/); |
There was a problem hiding this comment.
I don't think the v is optional.
| const match = version.match(/^v?(\d+)\.(\d+)/); | |
| const match = version.match(/^v(\d+)\.(\d+)/); |
.github/workflows/ci.yaml
Outdated
|
|
||
| // 1. Read and parse go.mod | ||
| const goModContent = fs.readFileSync('go.mod', 'utf-8'); | ||
| const serverVersionMatch = goModContent.match(new RegExp(`${SERVER_MODULE.replace(/\//g, '\\/')}\\s+(v[^\\s]+)`)); |
| actions: write | ||
|
|
||
| jobs: | ||
| validate-server-version: |
There was a problem hiding this comment.
This should only run on merge to main.
.github/workflows/ci.yaml
Outdated
| core.info('✓ Version is a valid tagged version'); | ||
|
|
||
| // 3. Fetch latest release from GitHub | ||
| const { data: release } = await github.rest.repos.getLatestRelease({ |
There was a problem hiding this comment.
Make sure you use an API key here to avoid getting throttled by GH.
Adds a Go tool that validates the go.temporal.io/server dependency: - Ensures it's a tagged version (not a pseudo-version) - Ensures it doesn't exceed one minor version ahead of the latest temporalio/temporal GitHub release Runs on push to main and PRs targeting main.
Summary
go.temporal.io/serverdependencyTest plan
v1.30.0-148.4(latest release isv1.29.2)