Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .github/workflows/integration.yaml
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
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ tidy:
go mod tidy

test:
go test -v ./...
go test -v ./pkg/...

.PHONY: integration
integration:
go test -v ./integration/...

smoke: build
smoke:
Expand Down
13 changes: 13 additions & 0 deletions integration/cred_test.go
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")
}
16 changes: 16 additions & 0 deletions integration/helpers.go
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
}