-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance: add simple integration test
Signed-off-by: Grant Linville <[email protected]>
- Loading branch information
1 parent
d39962e
commit cf86376
Showing
4 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,40 @@ | ||
name: integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- docs/** | ||
- tools/** | ||
- README.md | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- docs/** | ||
- tools/** | ||
- README.md | ||
|
||
jobs: | ||
integration: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-22.04, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
cache: false | ||
go-version: "1.22" | ||
- name: Build | ||
if: matrix.os == 'ubuntu-22.04' | ||
run: make build | ||
- name: build-windows | ||
if: matrix.os == 'windows-latest' | ||
run: make build-exe | ||
- name: Run Integration Tests | ||
run: make integration |
This file contains 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 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,13 @@ | ||
package integration | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGPTScriptCredential(t *testing.T) { | ||
out, err := GPTScriptExec("cred") | ||
require.NoError(t, err) | ||
require.Contains(t, out, "CREDENTIAL") | ||
} |
This file contains 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,16 @@ | ||
package integration | ||
|
||
import ( | ||
"os/exec" | ||
"runtime" | ||
) | ||
|
||
func GPTScriptExec(args ...string) (string, error) { | ||
cmd := exec.Command("../bin/gptscript", args...) | ||
if runtime.GOOS == "windows" { | ||
cmd = exec.Command("..\\bin\\gptscript.exe", args...) | ||
} | ||
|
||
out, err := cmd.CombinedOutput() | ||
return string(out), err | ||
} |