-
Notifications
You must be signed in to change notification settings - Fork 1
Gmankes/add test harness #6
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7f4c17d
fix formatting directive for fmt.Errorf
c04bd8a
add mise toml and add command test harness
918fb67
remove a test that's broken
413dfe1
add integration test harness and fix bugs
24f812e
fix env var name
7301f3d
modify makefile to make .env not required
2974b5c
remove environment from cicd
aa87efd
add build tags to commands_test
2c9a698
fix json printing, add consistency across the board
7103686
Update test.yml
gregmankes 09e5c18
Update test.yml
gregmankes 955167f
Update temporalcloudcli/commands.namespace_test.go
gregmankes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - develop | ||
| - main | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Unit + Integration (mise) | ||
| runs-on: ubuntu-latest | ||
|
|
||
| env: | ||
| TEMPORAL_CLOUD_SERVER: ${{ vars.TEMPORAL_CLOUD_SERVER }} | ||
| TEMPORAL_API_KEY: ${{ secrets.TEMPORAL_API_KEY }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup mise | ||
| uses: jdx/mise-action@v2 | ||
| with: | ||
| install: true | ||
|
|
||
| - name: Validate required environment variables and secrets | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| missing=0 | ||
|
|
||
| if [[ -z "${TEMPORAL_CLOUD_SERVER:-}" ]]; then | ||
| echo "::error::TEMPORAL_CLOUD_SERVER is not set or is empty" | ||
| missing=1 | ||
| fi | ||
|
|
||
|
|
||
| # Secret: check presence ONLY, never print or echo | ||
| if [[ -z "${TEMPORAL_API_KEY:-}" ]]; then | ||
| echo "::error::TEMPORAL_API_KEY is not set or is empty" | ||
| missing=1 | ||
| fi | ||
|
|
||
| if [[ "$missing" -ne 0 ]]; then | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| mise run test | ||
|
|
||
| - name: Run integration tests | ||
| run: | | ||
| mise run integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,22 @@ | ||
| .PHONY: all gen build | ||
| .PHONY: all gen build test | ||
|
|
||
| all: gen build | ||
| # 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 | ||
|
|
||
| gen: | ||
| go tool 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 ./... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,13 @@ | ||
| # cloud-cli | ||
| CLI Plugin for Temporal Cloud | ||
|
|
||
| ## Testing | ||
| In order to run the tests, you need a temporal cloud api key. Create one in the [cloud dashboard](https://cloud.temporal.io/) and place it in a .env file at the root directory of the repo as follows: | ||
| ``` | ||
| TEMPORAL_API_KEY=<api key> | ||
| TEMPORAL_CLOUD_SERVER=<server> | ||
| ``` | ||
|
|
||
| *NOTE* This will create and delete resources on the account. | ||
|
|
||
| Then run with `mise run test` to run the tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [tools] | ||
| # Note: Keep in sync with `toolchain` directive in `go.mod`. | ||
| go = "1.25.3" | ||
|
|
||
| # needed for go backends | ||
| [settings] | ||
| experimental = true | ||
|
|
||
| # Add .local/bin to PATH for sc binaries | ||
| [env] | ||
| _.path = [".local/bin"] | ||
| GOPRIVATE = "go.temporal.io/temporal,go.temporal.io/temporal-proto,github.com/temporalio" | ||
|
|
||
| [tasks] | ||
| build = "make build" | ||
| gen = "make gen" | ||
| test = "make test" | ||
| integration = "make test-integration" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.