ollama4j/.github/workflows/run-tests.yml
amithkoujalgi b91f6e6b25
Enhance GitHub Actions workflow for dynamic branch testing
- Added a step to check out the target branch specified in the workflow input.
- Implemented a conditional step to use the workflow file from the checked-out branch, improving flexibility and error handling in CI processes.
2025-08-30 18:06:06 +05:30

54 lines
1.4 KiB
YAML

name: Run Unit and Integration Tests
on:
# push:
# branches:
# - main
workflow_dispatch:
inputs:
branch:
description: 'Branch name to run the tests on'
required: true
default: 'main'
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout target branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- name: Use workflow from checked out branch
run: |
if [ -f .github/workflows/run-tests.yml ]; then
echo "Using workflow from checked out branch."
cp .github/workflows/run-tests.yml /tmp/run-tests.yml
exit 0
else
echo "Workflow file not found in checked out branch."
exit 1
fi
- name: Set up Ollama
run: |
curl -fsSL https://ollama.com/install.sh | sh
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}
- name: Run unit tests
run: mvn clean test -Punit-tests
- name: Run integration tests
run: mvn clean verify -Pintegration-tests
env:
USE_EXTERNAL_OLLAMA_HOST: "true"
OLLAMA_HOST: "http://localhost:11434"