Skip to content

Commit

Permalink
Try workflow dispatch with args
Browse files Browse the repository at this point in the history
  • Loading branch information
hallipr committed Jul 23, 2024
1 parent 0f3c24f commit 5844f2b
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 13 deletions.
19 changes: 19 additions & 0 deletions .github/actions/live-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Live Test
description: 'Run live tests against the OpenAI API'
inputs:
openai_api_key:
description: 'API key for the OpenAI API'
required: true
runs:
using: 'composite'
steps:
- name: Run Live Tests
shell: pwsh
run: dotnet test
--configuration Release
--filter="TestCategory!=Smoke&TestCategory!=Images&TestCategory!=Moderations&TestCategory!=Manual"
--logger "trx;LogFilePrefix=live"
--results-directory ${{github.workspace}}/artifacts/test-results
env:
OPENAI_API_KEY: ${{ github.event.inputs.openai_api_key }}

36 changes: 36 additions & 0 deletions .github/workflows/live-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Live Test

on:
workflow_dispatch:
inputs:
ref:
description: 'Committish to checkout and test'
required: true

jobs:
test:
name: Live Test
runs-on: ubuntu-latest
environment: Live Testing
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.x

- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}

- name: Run Live Tests
uses: ./.github/actions/live-test
with:
openai_api_key: ${{ secrets.OPENAI_API_KEY }}

- name: Upload artifact
uses: actions/upload-artifact@v2
if: ${{ !cancelled() }}
with:
name: test-artifacts
path: ${{github.workspace}}/artifacts
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Build and Test

on:
workflow_dispatch:
inputs:
commit_sha:
description: 'Commit SHA to checkout and test'
push:
branches:
- main
Expand Down Expand Up @@ -48,6 +51,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
environment: Live Testing
if: github.event_name != 'pull_request'
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v1
Expand All @@ -58,13 +62,9 @@ jobs:
uses: actions/checkout@v2

- name: Run Live Tests
run: dotnet test
--configuration Release
--filter="TestCategory!=Smoke&TestCategory!=Images&TestCategory!=Moderations&TestCategory!=Manual"
--logger "trx;LogFilePrefix=live"
--results-directory ${{github.workspace}}/artifacts/test-results
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
uses: ./.github/actions/live-test
with:
openai_api_key: ${{ secrets.OPENAI_API_KEY }}

- name: Upload artifact
uses: actions/upload-artifact@v2
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ jobs:
--logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/smoke.trx"

- name: Run Live Tests
run: dotnet test
--configuration Release
--filter="TestCategory!=Smoke&TestCategory!=Images&TestCategory!=Moderations&TestCategory!=Manual"
--logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/live.trx"
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
uses: ./.github/actions/live-test
with:
openai_api_key: ${{ secrets.OPENAI_API_KEY }}

- name: Upload artifact
uses: actions/upload-artifact@v2
Expand Down

0 comments on commit 5844f2b

Please sign in to comment.