Skip to content
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
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Check Generated Files
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
verify-generation:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Add Go bin to PATH
run: echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Run commands generation command
run: make gen
- name: Verify no changes were generated
run: |
# Check if there are any uncommitted changes in the working directory
if [ -z "$(git status --porcelain)" ]; then
echo "::notice::Generated files are up to date. No changes detected."
else
echo "::error::Detected uncommitted changes after running the generation command. Please run the generator and commit the changes."
git status
git diff
exit 1
fi
build:
runs-on: ubuntu-latest
needs: verify-generation
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build the cli binary
run: make build
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.PHONY: all install gen build test

# Load .env file if it exists (for local development)
# In CI/CD, environment variables are provided by the environment
-include .env
ifneq (,$(wildcard .env))
export $(shell sed 's/=.*//' .env)
endif

all: gen build test

# we need to install gen-commands directly because gen-commands does not have its
# own go.mod
install:
rm -rf ./cli
git clone https://github.com/temporalio/cli && cd ./cli && go install ./cmd/gen-commands && cd ..
rm -rf ./cli

gen: install
gen-commands -input ./temporalcloudcli/commands.yml -pkg temporalcloudcli > ./temporalcloudcli/commands.gen.go

build:
go build ./cmd/temporal-cloud

test-integration:
go test -tags=integration ./...

test:
go test ./...