-
Notifications
You must be signed in to change notification settings - Fork 32
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
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') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you're using the I vote for removing this step to have one less moving part. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rate limit is 15000 requests per hour: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-github_token-in-github-actions |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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 withmaster
. If that also fails, we should not cut a release.