Fix tests #8
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
| name: CI Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # Trigger on PRs (including forks) | |
| pull_request_target: | |
| branches: | |
| - main | |
| # Manual trigger | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: 'Branch or Ref to test' | |
| required: false | |
| default: '' | |
| jobs: | |
| test-go: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # Use the PR head for pull_request_target, otherwise the default ref | |
| ref: ${{ github.event.pull_request.head.sha || github.event.inputs.ref || github.ref }} | |
| # Persist credentials is false to prevent the PR code from using the GITHUB_TOKEN | |
| persist-credentials: false | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| - name: Run Go tests | |
| working-directory: ./go | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| run: go test -timeout 20m ./... | |
| test-java: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.event.inputs.ref || github.ref }} | |
| persist-credentials: false | |
| - name: Set up JDK 24 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '24' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Run Java tests | |
| working-directory: ./java | |
| env: | |
| GOOGLE_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| run: mvn -B test | |
| test-javascript: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.event.inputs.ref || github.ref }} | |
| persist-credentials: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: javascript/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./javascript | |
| run: npm ci | |
| - name: Run JavaScript tests | |
| working-directory: ./javascript | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| run: node --test *.test.js | |
| test-python: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.event.inputs.ref || github.ref }} | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| working-directory: ./python | |
| run: pip install absl-py google-genai Pillow pyink pytest | |
| - name: Run Python tests | |
| working-directory: ./python | |
| env: | |
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
| # Discover and run all .py files as tests | |
| run: python -m unittest discover -p "*.py" |