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 to check api-go compatibility #1749

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
84 changes: 84 additions & 0 deletions .github/workflows/check-api-go.yml
Copy link
Member

Choose a reason for hiding this comment

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

Question, can we just put this whole workflow inside of api-go? Is there any reason it needs to be inside the SDK repo?

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Check api-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
rodrigozhou marked this conversation as resolved.
Show resolved Hide resolved
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-api-go-compatibility:
name: "Check api-go compatibility"
runs-on: ubuntu-latest

steps:
- name: Parse 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')
fi
if ! gh api "/repos/temporalio/sdk-go/commits/$SDK_REF"; then
echo "::error::Reference $SDK_REF not found in sdk-go"
exit 1
fi
if ! gh api "/repos/temporalio/api-go/commits/$API_REF"; then
echo "::error::Reference $API_REF not found in api-go"
exit 1
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
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runsOn: macos-13
- os: macos-arm
runsOn: macos-14

runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- name: Checkout repository
Expand Down
Loading