openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
.github/workflows/main.yml
52lines · modecode
| 1 | # This worflow is triggered on push to main, pull request, or by manual invocation. |
| 2 | # It builds and unit tests the codebase. |
| 3 | name: Build and Unit Test |
| 4 | |
| 5 | on: |
| 6 | workflow_dispatch: |
| 7 | push: |
| 8 | branches: |
| 9 | - main |
| 10 | pull_request: |
| 11 | types: [opened, reopened, synchronize] |
| 12 | |
| 13 | jobs: |
| 14 | build: # Test, pack and publish the Open AI nuget package as a build artifact |
| 15 | name: Build |
| 16 | runs-on: ubuntu-latest |
| 17 | env: |
| 18 | version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }} |
| 19 | steps: |
| 20 | - name: Setup .NET |
| 21 | uses: actions/setup-dotnet@v3 |
| 22 | with: |
| 23 | dotnet-version: '9.x' |
| 24 | |
| 25 | - name: Setup .NET 8 |
| 26 | uses: actions/setup-dotnet@v3 |
| 27 | with: |
| 28 | dotnet-version: '8.x' |
| 29 | |
| 30 | - name: Checkout code |
| 31 | uses: actions/checkout@v2 |
| 32 | |
| 33 | - name: Build and pack |
| 34 | run: dotnet pack |
| 35 | --configuration Release |
| 36 | --output "${{github.workspace}}/artifacts/packages" |
| 37 | ${{ env.version_suffix_args}} |
| 38 | |
| 39 | - name: Run unit tests |
| 40 | run: dotnet test |
| 41 | --configuration Release |
| 42 | --filter="TestCategory=Smoke&TestCategory!=Manual" |
| 43 | --logger "trx;LogFilePrefix=smoke" |
| 44 | --results-directory ${{github.workspace}}/artifacts/test-results |
| 45 | ${{ env.version_suffix_args}} |
| 46 | |
| 47 | - name: Upload artifact |
| 48 | uses: actions/upload-artifact@v4 |
| 49 | if: ${{ !cancelled() }} |
| 50 | with: |
| 51 | name: build-artifacts |
| 52 | path: ${{github.workspace}}/artifacts |
| 53 | |