From ae18ca9edbf41bca12c2f5031f884dc343c3637e Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Fri, 25 Aug 2023 12:12:47 -0700 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=94=A7=20Update=20GitHub=20workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add paths filter to dotnet-build-and-test workflow - Include samples/skills directory in python-integration-tests filter This commit updates the GitHub workflows to include a paths filter in the dotnet-build-and-test workflow, which will only run tests if changes were made to the dotnet files. Additionally, the python-integration-tests workflow now includes the samples/skills directory in its filter. --- .github/workflows/dotnet-build-and-test.yml | 123 +++++++++++------- .../workflows/python-integration-tests.yml | 1 + 2 files changed, 79 insertions(+), 45 deletions(-) diff --git a/.github/workflows/dotnet-build-and-test.yml b/.github/workflows/dotnet-build-and-test.yml index 351a24944280..b63b480e8b30 100644 --- a/.github/workflows/dotnet-build-and-test.yml +++ b/.github/workflows/dotnet-build-and-test.yml @@ -8,7 +8,7 @@ name: dotnet-build-and-test on: workflow_dispatch: pull_request: - branches: [ "main", "feature*" ] + branches: ["main", "feature*"] merge_group: branches: ["main"] @@ -20,57 +20,90 @@ permissions: contents: read jobs: + paths-filter: + runs-on: ubuntu-latest + outputs: + dotnetChanges: ${{ steps.filter.outputs.dotnet }} + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + dotnet: + - 'dotnet/**' + - '**/dotnet/**' + - 'samples/skills/**' + # run only if 'dotnet' files were changed + - name: dotnet tests + if: steps.filter.outputs.dotnet == 'true' + run: echo "Dotnet file" + # run only if not 'dotnet' files were changed + - name: not dotnet tests + if: steps.filter.outputs.dotnet != 'true' + run: echo "NOT dotnet file" dotnet-build-and-test: + needs: paths-filter + if: needs.paths-filter.outputs.dotnetChanges == 'true' strategy: - fail-fast: false - matrix: - include: - - { dotnet: '6.0-jammy', os: 'ubuntu', configuration: Debug } - - { dotnet: '7.0-jammy', os: 'ubuntu', configuration: Release } - - { dotnet: '8.0-preview-jammy', os: 'ubuntu', configuration: Release } - - { dotnet: '6.0', os: 'windows', configuration: Release } - - { dotnet: '7.0', os: 'windows', configuration: Debug, integration-tests: true } - - { dotnet: '8.0-preview', os: 'windows', configuration: Release } - + fail-fast: false + matrix: + include: + - { dotnet: "6.0-jammy", os: "ubuntu", configuration: Debug } + - { dotnet: "7.0-jammy", os: "ubuntu", configuration: Release } + - { + dotnet: "8.0-preview-jammy", + os: "ubuntu", + configuration: Release, + } + - { dotnet: "6.0", os: "windows", configuration: Release } + - { + dotnet: "7.0", + os: "windows", + configuration: Debug, + integration-tests: true, + } + - { dotnet: "8.0-preview", os: "windows", configuration: Release } + runs-on: ubuntu-latest container: image: mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} env: NUGET_CERT_REVOCATION_MODE: offline - GITHUB_ACTIONS: 'true' + GITHUB_ACTIONS: "true" steps: - - uses: actions/checkout@v3 - - - name: Build dotnet solutions - run: | - export SOLUTIONS=$(find ./dotnet/ -type f -name "*.sln" | tr '\n' ' ') - for solution in $SOLUTIONS; do - dotnet build -c ${{ matrix.configuration }} /warnaserror $solution - done - - - name: Run Unit Tests - run: | - export UT_PROJECTS=$(find ./dotnet -type f -name "*.UnitTests.csproj" | tr '\n' ' ') - for project in $UT_PROJECTS; do - dotnet test -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx - done + - uses: actions/checkout@v3 - - name: Run Integration Tests - if: github.event_name != 'pull_request' && matrix.integration-tests - run: | - export INTEGRATION_TEST_PROJECTS=$(find ./dotnet -type f -name "*IntegrationTests.csproj" | tr '\n' ' ') - for project in $INTEGRATION_TEST_PROJECTS; do - dotnet test -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx - done - env: - AzureOpenAI__Label: azure-text-davinci-003 - AzureOpenAIEmbedding__Label: azure-text-embedding-ada-002 - AzureOpenAI__DeploymentName: ${{ vars.AZUREOPENAI__DEPLOYMENTNAME }} - AzureOpenAIEmbeddings__DeploymentName: ${{ vars.AZUREOPENAIEMBEDDING__DEPLOYMENTNAME }} - AzureOpenAI__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }} - AzureOpenAIEmbeddings__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }} - AzureOpenAI__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }} - AzureOpenAIEmbeddings__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }} - Bing__ApiKey: ${{ secrets.BING__APIKEY }} - OpenAI__ApiKey: ${{ secrets.OPENAI__APIKEY }} + - name: Build dotnet solutions + run: | + export SOLUTIONS=$(find ./dotnet/ -type f -name "*.sln" | tr '\n' ' ') + for solution in $SOLUTIONS; do + dotnet build -c ${{ matrix.configuration }} /warnaserror $solution + done + + - name: Run Unit Tests + run: | + export UT_PROJECTS=$(find ./dotnet -type f -name "*.UnitTests.csproj" | tr '\n' ' ') + for project in $UT_PROJECTS; do + dotnet test -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx + done + + - name: Run Integration Tests + if: github.event_name != 'pull_request' && matrix.integration-tests + run: | + export INTEGRATION_TEST_PROJECTS=$(find ./dotnet -type f -name "*IntegrationTests.csproj" | tr '\n' ' ') + for project in $INTEGRATION_TEST_PROJECTS; do + dotnet test -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx + done + env: + AzureOpenAI__Label: azure-text-davinci-003 + AzureOpenAIEmbedding__Label: azure-text-embedding-ada-002 + AzureOpenAI__DeploymentName: ${{ vars.AZUREOPENAI__DEPLOYMENTNAME }} + AzureOpenAIEmbeddings__DeploymentName: ${{ vars.AZUREOPENAIEMBEDDING__DEPLOYMENTNAME }} + AzureOpenAI__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }} + AzureOpenAIEmbeddings__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }} + AzureOpenAI__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }} + AzureOpenAIEmbeddings__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }} + Bing__ApiKey: ${{ secrets.BING__APIKEY }} + OpenAI__ApiKey: ${{ secrets.OPENAI__APIKEY }} diff --git a/.github/workflows/python-integration-tests.yml b/.github/workflows/python-integration-tests.yml index 91e2d6af36ec..1ab5e187fe4b 100644 --- a/.github/workflows/python-integration-tests.yml +++ b/.github/workflows/python-integration-tests.yml @@ -29,6 +29,7 @@ jobs: filters: | python: - 'python/**' + - 'samples/skills/**' # run only if 'python' files were changed - name: python tests if: steps.filter.outputs.python == 'true' From e6efaa76f6fe2a7069c566e4a55e8cad248fa6a6 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Fri, 25 Aug 2023 12:44:26 -0700 Subject: [PATCH 2/3] python tests don't use the sample skills --- .github/workflows/python-integration-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-integration-tests.yml b/.github/workflows/python-integration-tests.yml index 1ab5e187fe4b..91e2d6af36ec 100644 --- a/.github/workflows/python-integration-tests.yml +++ b/.github/workflows/python-integration-tests.yml @@ -29,7 +29,6 @@ jobs: filters: | python: - 'python/**' - - 'samples/skills/**' # run only if 'python' files were changed - name: python tests if: steps.filter.outputs.python == 'true' From 6b7a9d1ed0b2c8e28ef31dc801c3ef63e2b231e3 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Fri, 25 Aug 2023 12:46:38 -0700 Subject: [PATCH 3/3] test dotnet chagnes --- dotnet/samples/KernelSyntaxExamples/Program.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/dotnet/samples/KernelSyntaxExamples/Program.cs b/dotnet/samples/KernelSyntaxExamples/Program.cs index 8a37f9620b6a..3888d14115b0 100644 --- a/dotnet/samples/KernelSyntaxExamples/Program.cs +++ b/dotnet/samples/KernelSyntaxExamples/Program.cs @@ -75,6 +75,7 @@ public static async Task Main() await Example53_Kusto.RunAsync().SafeWaitAsync(cancelToken); await Example54_AzureChatCompletionWithData.RunAsync().SafeWaitAsync(cancelToken); await Example55_TextChunker.RunAsync().SafeWaitAsync(cancelToken); + // hey! } private static void LoadUserSecrets()