goose/.github/workflows/pr-smoke-test.yml

117 lines
3.5 KiB
YAML

on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: 'Branch to test'
required: true
default: 'main'
type: string
name: Live Provider Tests
jobs:
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Check for code changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # pin@v3
id: filter
with:
filters: |
code:
- '!documentation/**'
build-binary:
name: Build Release Binary
runs-on: goose
needs: changes
if: needs.changes.outputs.code == 'true' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Activate hermit and set CARGO_HOME
run: |
source bin/activate-hermit
echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV
echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev
- name: Cache Cargo artifacts
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # pin@v3
with:
path: |
${{ env.CARGO_HOME }}/bin/
${{ env.CARGO_HOME }}/registry/index/
${{ env.CARGO_HOME }}/registry/cache/
${{ env.CARGO_HOME }}/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build Release Binary for Smoke Tests
run: |
source ./bin/activate-hermit
cargo build --release
- name: Upload Binary for Smoke Tests
uses: actions/upload-artifact@v4
with:
name: goose-binary
path: target/release/goose
retention-days: 1
smoke-tests:
name: Smoke Tests
runs-on: ubuntu-latest
needs: build-binary
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Download Binary
uses: actions/download-artifact@v4
with:
name: goose-binary
path: target/release
- name: Make Binary Executable
run: chmod +x target/release/goose
- name: Run Smoke Tests with Provider Script
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
HOME: /tmp/goose-home
GOOSE_DISABLE_KEYRING: 1
SKIP_BUILD: 1
run: |
# Ensure the HOME directory structure exists
mkdir -p $HOME/.local/share/goose/sessions
mkdir -p $HOME/.config/goose
# Run the provider test script (binary already built and downloaded)
bash scripts/test_providers.sh