Skip to content

Commit

Permalink
split
Browse files Browse the repository at this point in the history
  • Loading branch information
nbsp committed Dec 23, 2024
1 parent b312a90 commit 4568fca
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Test
- name: Check which tests to run
id: check
run: |
echo "agents=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^agents.*\.ts$' && echo true || echo false)" >> $GITHUB_OUTPUT
echo "tests=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^plugins/test.*\.ts$' && echo true || echo false)" >> $GITHUB_OUTPUT
echo "plugins=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^plugins.*\.ts$' | cut -d/ -f2 | sort -u | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: Test agents
if: steps.check.outputs.agents == 'true' || steps.check.outputs.tests == 'true' || github.event_name != 'pull_request'
run: pnpm test agents
- name: Test plugins
if: steps.check.outputs.agents == 'true' || steps.check.outputs.tests == 'true' || steps.check.outputs.plugins != '' || github.event_name != 'pull_request'
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ELEVEN_API_KEY: ${{ secrets.ELEVEN_API_KEY }}
Expand All @@ -40,14 +50,11 @@ jobs:
tests=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^plugins/test.*\.ts$' && echo 1 || echo 0)
plugins=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^plugins.*\.ts$' | cut -d/ -f2 | sort -u | tr '\n' ' ')
if [[ "$agents" -eq 1 || "$tests" -eq 1 || "$pr" = "false" ]]; then
pnpm test
elif [[ -n "$plugins" ]]; then
read -ra plugins <<< "$plugins"
if [[ "${{ steps.check.outputs.agents }}" = "true" || "${{ steps.check.outputs.tests }}" = "true" || "${{ github.event_name }}" != "pull_request" ]]; then
pnpm test plugins
else
read -ra plugins <<< "${{ steps.check.outputs.plugins }}"
for plugin in "${plugins[@]}"; do
pnpm test $plugin
done
else
echo "::notice::no testable changes detected"
exit 0
fi

0 comments on commit 4568fca

Please sign in to comment.