Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA check sdk-go compatibility #200

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/check-sdk-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Check sdk-go compatibility

on:
workflow_dispatch:
inputs:
sdk_ref:
description: sdk-go ref to check ("latest" for latest release tag)
required: true
default: latest
api_ref:
description: api-go ref to check
required: true
default: master
workflow_call:
inputs:
sdk_ref:
description: sdk-go ref to check ("latest" for latest release tag)
required: true
default: latest
api_ref:
description: api-go ref to check
required: true
default: master

jobs:
check-sdk-go-compatibility:
name: "Check sdk-go compatibility"
runs-on: ubuntu-latest

steps:
- name: Validate inputs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably redundant since the checkout step will fail if the ref isn't valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to at least translate the "latest" input to an actual tag. The checkout step fails with the "latest" ref.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, yeah, I had it in my head that we want to verify master and not latest, but I think latest is right.
We need to give guidance though that sometimes latest is expected to fail, e.g. when making backwards incompatible changes, and that the action should be rerun with master. If that also fails, we should not cut a release.

id: inputs
env:
GH_TOKEN: ${{ github.token }}
SDK_REF: ${{ github.event.inputs.sdk_ref }}
API_REF: ${{ github.event.inputs.api_ref }}
run: |
if [[ "$SDK_REF" == "latest" ]]; then
SDK_REF=$(gh api /repos/temporalio/sdk-go/releases/latest --jq '.name')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you're using the GH_TOKEN env var so probably not much of a concern but this command may get rate limited by GH.

I vote for removing this step to have one less moving part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fi
echo "SDK_REF=$SDK_REF" >> "$GITHUB_OUTPUT"
echo "API_REF=$API_REF" >> "$GITHUB_OUTPUT"

- name: Checkout
uses: actions/checkout@v4
with:
repository: temporalio/sdk-go
ref: ${{ steps.inputs.outputs.SDK_REF }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Update api-go
env:
API_REF: ${{ steps.inputs.outputs.API_REF }}
run: |
for f in $(find . -iname go.mod); do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if any of the commands in this loop fail, will this shell script error out or will these failures be silent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will error out.

cd $(dirname $f)
go get go.temporal.io/api@$API_REF
go mod tidy
cd -
done

- name: Run check
run: go run . check
working-directory: ./internal/cmd/build

- name: Run unit test
run: go run . unit-test
working-directory: ./internal/cmd/build

- name: Run integration tests
run: go run . integration-test -dev-server
working-directory: ./internal/cmd/build
Loading