-
Notifications
You must be signed in to change notification settings - Fork 358
Add live tests to release, main and new live-test workflows #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6692bec
Add live testing to main and release
hallipr 9d6792c
Add live tests to release and main
hallipr ff54131
Use --results-directory parameter
hallipr 0f3c24f
Add !cancelled() condition to all artifact uploads
hallipr 5844f2b
Try workflow dispatch with args
hallipr fe81d68
Remove action
hallipr e16af97
Add push trigger
hallipr 88ac42c
Remove push trigger
hallipr 58574d5
Refactor worflows to support pr, ci, live-test, schedule, manual and …
hallipr 9da90a7
Better comment for live-test workflow
hallipr 37c5507
Remove the ref parameter from manual runs of main
hallipr 2e71fcb
Fix source argument in nuget publish step
hallipr f31149a
Always publish to local feed in release pipeline
hallipr d11977f
Make step names more consistent
hallipr 82c22bd
Update .github/workflows/release.yml
weshaggard 854a6a0
Update .github/workflows/live-test.yml
hallipr e9598dd
Allow for queuing live tests throught PR label
hallipr 52e9413
Live trigger
hallipr c8d9278
change casing on live test label
hallipr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # This workflow is triggered by the user and runs live tests on the codebase. | ||
| name: Live Test | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't we decide to switch this trigger to be label based?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was just about to push that change :) |
||
| pull_request: | ||
| types: | ||
| - labeled | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Live Test | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'live test') | ||
| environment: Live Testing | ||
| env: | ||
| version_suffix_args: ${{ format('--version-suffix="alpha.{0}"', github.run_number) }} | ||
| steps: | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v3 | ||
| with: | ||
| dotnet-version: '8.x' | ||
|
|
||
| - name: Checkout code | ||
| 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.version_suffix_args }} | ||
| env: | ||
| 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 | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,104 @@ | ||
| # This workflow is triggered by new releases and on a daily schedule. | ||
| # It builds, unit tests, live tests and published the Open AI nuget package. | ||
| # For daily runs, the package is published to the GitHub package registry. | ||
| # For releases, the package is published to the NuGet package registry. | ||
| name: Release package | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| schedule: | ||
| # run every day at 00:00 | ||
| - cron: '0 0 * * *' | ||
|
|
||
| jobs: | ||
| deploy: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| environment: Live Testing | ||
weshaggard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| env: | ||
| version_suffix_args: ${{ github.event_name == 'schedule' && format('--version-suffix="alpha.{0}"', github.run_number) || '' }} | ||
| permissions: | ||
| packages: write | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-dotnet@v3 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v3 | ||
| with: | ||
| dotnet-version: '8.x' # SDK Version to use. | ||
| dotnet-version: '8.x' | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| # Pack the client nuget package and include url back to the repository and release tag | ||
| - name: Build and Pack | ||
| run: dotnet pack | ||
| --configuration Release | ||
| --output "${{github.workspace}}/artifacts/packages" | ||
| --output "${{ github.workspace }}/artifacts/packages" | ||
| /p:PackageProjectUrl="${{ github.server_url }}/${{ github.repository }}/tree/${{ github.event.release.tag_name }}" | ||
| /p:PackageReleaseNotes="${{ github.server_url }}/${{ github.repository }}/blob/${{ github.event.release.tag_name }}/CHANGELOG.md" | ||
| ${{ env.version_suffix_args }} | ||
|
|
||
| - name: Test | ||
| - name: Unit Test | ||
| run: dotnet test | ||
| --configuration Release | ||
| --filter="TestCategory=Smoke&TestCategory!=Manual" | ||
| --logger "trx;LogFileName=${{ github.workspace }}/artifacts/test-results/smoke.trx" | ||
| ${{ env.version_suffix_args }} | ||
|
|
||
| - name: Run Live Tests | ||
| run: dotnet test | ||
| --configuration Release | ||
| --filter="TestCategory~Online" | ||
| --logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/full.trx" | ||
| --filter="TestCategory!=Smoke&TestCategory!=Images&TestCategory!=Moderations&TestCategory!=Manual" | ||
| --logger "trx;LogFilePrefix=live" | ||
| --results-directory ${{ github.workspace }}/artifacts/test-results | ||
| ${{ env.version_suffix_args }} | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v2 | ||
| if: ${{ !cancelled() }} | ||
| with: | ||
| name: build-artifacts | ||
| path: ${{ github.workspace }}/artifacts | ||
|
|
||
| deploy: | ||
| name: Publish Package | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| packages: write | ||
| contents: write | ||
| steps: | ||
| - uses: actions/download-artifact@v2 | ||
|
|
||
| # Append the nuget package to the github release that triggered this workflow | ||
| - name: Upload release asset | ||
| if: github.event_name == 'release' | ||
weshaggard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| run: gh release upload ${{ github.event.release.tag_name }} | ||
| ${{github.workspace}}/artifacts/packages/*.*nupkg | ||
| ${{ github.workspace }}/build-artifacts/packages/*.*nupkg | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v2 | ||
| with: | ||
| name: build-artifacts | ||
| path: ${{github.workspace}}/artifacts | ||
| - name: NuGet authenticate | ||
| run: dotnet nuget add source | ||
| "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" | ||
| --name "github" | ||
| --username ${{ github.actor }} | ||
| --password ${{ secrets.GITHUB_TOKEN }} | ||
| --store-password-in-clear-text | ||
|
|
||
| - name: Publish package to local feed | ||
| run: dotnet nuget push | ||
| ${{github.workspace}}/build-artifacts/packages/*.nupkg | ||
| --source github | ||
| --skip-duplicate | ||
|
|
||
| - name: Publish | ||
| - name: Publish package to nuget.org | ||
| if: github.event_name == 'release' | ||
| run: dotnet nuget push | ||
weshaggard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ${{github.workspace}}/artifacts/packages/*.nupkg | ||
| --source https://api.nuget.org/v3/index.json | ||
| --api-key ${{ secrets.NUGET_API_KEY }} | ||
| --skip-duplicate | ||
| ${{github.workspace}}/build-artifacts/packages/*.nupkg | ||
| --source https://api.nuget.org/v3/index.json | ||
| --api-key ${{ secrets.NUGET_API_KEY }} | ||
| --skip-duplicate | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.