From d91bd5e696ec206741f087e80b5cbe7fbfbb0b8a Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 29 May 2024 12:17:19 -0500 Subject: [PATCH 01/14] code mirror template for worker --- eng/ci/code-mirror.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 eng/ci/code-mirror.yml diff --git a/eng/ci/code-mirror.yml b/eng/ci/code-mirror.yml new file mode 100644 index 000000000..fec4062bd --- /dev/null +++ b/eng/ci/code-mirror.yml @@ -0,0 +1,18 @@ +trigger: + branches: + include: + - dev + - release/* + +resources: + repositories: + - repository: eng + type: git + name: engineering + ref: refs/tags/release + +variables: + - template: ci/variables/cfs.yml@eng + +extends: + template: ci/code-mirror.yml@eng \ No newline at end of file From d9eacfa404b470870481082ec74398cc7283bea6 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Mon, 3 Jun 2024 13:50:46 -0500 Subject: [PATCH 02/14] converting to 1ES pipeline --- .github/workflows/ci_e2e_workflow.yml | 301 ++++++++++++++------------ 1 file changed, 161 insertions(+), 140 deletions(-) diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index 6b4d6979f..e2077224e 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -16,146 +16,167 @@ on: branches: [dev, main, release/*] schedule: # Monday to Friday 3 AM CST build - # * is a special character in YAML so you have to quote this string + # * is a special character in YAML, so you have to quote this string - cron: "0 8 * * 1,2,3,4,5" -jobs: - build: - name: "Python E2E CI Run" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] - # Currently runs FWPC E2E tests, classic E2E tests, and DefBindings E2E tests. - # To run tests from another script, add the script name to this matrix - test-type: [fwpc-e2e-tests, e2e-tests, deferred-bindings-e2e-tests] - permissions: read-all - steps: - - name: Checkout code. - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Set up Dotnet 8.0.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "8.0.x" - - name: Install dependencies and the worker - run: | - retry() { - local -r -i max_attempts="$1"; shift - local -r cmd="$@" - local -i attempt_num=1 - until $cmd - do - if (( attempt_num == max_attempts )) - then - echo "Attempt $attempt_num failed and there are no more attempts left!" - return 1 - else - echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..." - sleep 1 - fi - done - } +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows - python -m pip install --upgrade pip - python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre - python -m pip install -U -e .[dev] - - if [[ "${{ matrix.python-version }}" != "3.7" ]]; then - python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] - fi - if [[ "${{ matrix.python-version }}" != "3.7" && "${{ matrix.python-version }}" != "3.8" ]]; then - python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-deferred-bindings] - fi - - # Retry a couple times to avoid certificate issue - retry 5 python setup.py build - retry 5 python setup.py webhost --branch-name=dev - retry 5 python setup.py extension - mkdir logs - - name: Grant execute permission - run: | - chmod +x .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.7 ${{ matrix.test-type }} - if: matrix.python-version == 3.7 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.8 ${{ matrix.test-type }} - if: matrix.python-version == 3.8 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.9 ${{ matrix.test-type }} - if: matrix.python-version == 3.9 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.10 ${{ matrix.test-type }} - if: matrix.python-version == 3.10 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.11 ${{ matrix.test-type }} - if: matrix.python-version == 3.11 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString311 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString311 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString311 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Codecov - uses: codecov/codecov-action@v3 - with: - file: ./coverage.xml # optional - flags: unittests # optional - name: codecov # optional - fail_ci_if_error: false # optional (default = false) - - name: Publish Logs to Artifact - if: failure() - uses: actions/upload-artifact@v4 - with: - name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} - path: logs/*.log - if-no-files-found: ignore + stages: + - stage: Build + displayName: 'Build using 1ES Pool' + jobs: + - job: Build + pool: + name: 1es-pool-azfunc + image: 1es-ubuntu-22.04 + os: linux + steps: + - name: "Python E2E CI Run" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] + # Currently runs FWPC E2E tests, classic E2E tests, and DefBindings E2E tests. + # To run tests from another script, add the script name to this matrix + test-type: [fwpc-e2e-tests, e2e-tests, deferred-bindings-e2e-tests] + permissions: read-all + - name: Checkout code. + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Dotnet 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + - name: Install dependencies and the worker + run: | + retry() { + local -r -i max_attempts="$1"; shift + local -r cmd="$@" + local -i attempt_num=1 + until $cmd + do + if (( attempt_num == max_attempts )) + then + echo "Attempt $attempt_num failed and there are no more attempts left!" + return 1 + else + echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..." + sleep 1 + fi + done + } + + python -m pip install --upgrade pip + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre + python -m pip install -U -e .[dev] + + if [[ "${{ matrix.python-version }}" != "3.7" ]]; then + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] + fi + if [[ "${{ matrix.python-version }}" != "3.7" && "${{ matrix.python-version }}" != "3.8" ]]; then + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-deferred-bindings] + fi + + # Retry a couple times to avoid certificate issue + retry 5 python setup.py build + retry 5 python setup.py webhost --branch-name=dev + retry 5 python setup.py extension + mkdir logs + - name: Grant execute permission + run: | + chmod +x .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.7 ${{ matrix.test-type }} + if: matrix.python-version == 3.7 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.8 ${{ matrix.test-type }} + if: matrix.python-version == 3.8 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.9 ${{ matrix.test-type }} + if: matrix.python-version == 3.9 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.10 ${{ matrix.test-type }} + if: matrix.python-version == 3.10 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.11 ${{ matrix.test-type }} + if: matrix.python-version == 3.11 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString311 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString311 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString311 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.xml # optional + flags: unittests # optional + name: codecov # optional + fail_ci_if_error: false # optional (default = false) + - name: Publish Logs to Artifact + if: failure() + uses: actions/upload-artifact@v4 + with: + name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} + path: logs/*.log + if-no-files-found: ignore From 1353f58005f77aa1e3276df52c16ee7f80b2cf4b Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 5 Jun 2024 17:06:14 -0500 Subject: [PATCH 03/14] basic 1ES pipeline --- .github/workflows/ci_e2e_workflow.yml | 182 ++++---------------------- 1 file changed, 23 insertions(+), 159 deletions(-) diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index e2077224e..ddf526aef 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -3,28 +3,23 @@ name: CI E2E tests +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + on: - workflow_dispatch: - inputs: - archive_webhost_logging: - description: "For debugging purposes, archive test webhost logs" - required: false - default: "false" push: branches: [dev, main, release/*] pull_request: branches: [dev, main, release/*] schedule: # Monday to Friday 3 AM CST build - # * is a special character in YAML, so you have to quote this string + # * is a special character in YAML so you have to quote this string - cron: "0 8 * * 1,2,3,4,5" -resources: - repositories: - - repository: 1es - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release extends: template: v1/1ES.Official.PipelineTemplate.yml@1es parameters: @@ -34,149 +29,18 @@ extends: os: windows stages: - - stage: Build - displayName: 'Build using 1ES Pool' - jobs: - - job: Build - pool: - name: 1es-pool-azfunc - image: 1es-ubuntu-22.04 - os: linux - steps: - - name: "Python E2E CI Run" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] - # Currently runs FWPC E2E tests, classic E2E tests, and DefBindings E2E tests. - # To run tests from another script, add the script name to this matrix - test-type: [fwpc-e2e-tests, e2e-tests, deferred-bindings-e2e-tests] - permissions: read-all - - name: Checkout code. - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Set up Dotnet 8.0.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "8.0.x" - - name: Install dependencies and the worker - run: | - retry() { - local -r -i max_attempts="$1"; shift - local -r cmd="$@" - local -i attempt_num=1 - until $cmd - do - if (( attempt_num == max_attempts )) - then - echo "Attempt $attempt_num failed and there are no more attempts left!" - return 1 - else - echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..." - sleep 1 - fi - done - } - - python -m pip install --upgrade pip - python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre - python -m pip install -U -e .[dev] - - if [[ "${{ matrix.python-version }}" != "3.7" ]]; then - python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] - fi - if [[ "${{ matrix.python-version }}" != "3.7" && "${{ matrix.python-version }}" != "3.8" ]]; then - python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-deferred-bindings] - fi - - # Retry a couple times to avoid certificate issue - retry 5 python setup.py build - retry 5 python setup.py webhost --branch-name=dev - retry 5 python setup.py extension - mkdir logs - - name: Grant execute permission - run: | - chmod +x .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.7 ${{ matrix.test-type }} - if: matrix.python-version == 3.7 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.8 ${{ matrix.test-type }} - if: matrix.python-version == 3.8 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.9 ${{ matrix.test-type }} - if: matrix.python-version == 3.9 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.10 ${{ matrix.test-type }} - if: matrix.python-version == 3.10 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.11 ${{ matrix.test-type }} - if: matrix.python-version == 3.11 - env: - AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }} - AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }} - AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString311 }} - AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString311 }} - AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString311 }} - AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }} - AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }} - ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Codecov - uses: codecov/codecov-action@v3 - with: - file: ./coverage.xml # optional - flags: unittests # optional - name: codecov # optional - fail_ci_if_error: false # optional (default = false) - - name: Publish Logs to Artifact - if: failure() - uses: actions/upload-artifact@v4 - with: - name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} - path: logs/*.log - if-no-files-found: ignore + - stage: Build + displayName: 'Python E2E CI Run -- 1ES PT' + jobs: + - job: Build + pool: + name: 1es-pool-azfunc + image: 1es-ubuntu-22.04 + os: linux + steps: + - name: Checkout code. + uses: actions/checkout@v4 + - name: Set up Dotnet 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" From c062966e545fdf44eb22c792b7725a6e397ab53c Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 5 Jun 2024 17:11:42 -0500 Subject: [PATCH 04/14] basic format changed 1ES pipeline --- .github/workflows/ci_e2e_workflow.yml | 44 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index ddf526aef..1d5985ff4 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -1,7 +1,21 @@ # This workflow will install Python dependencies and run end to end tests with single version of Python # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: CI E2E tests +pr: + branches: + include: + - main + paths: + exclude: + - '**.md' + +trigger: + branches: + include: + - main + paths: + exclude: + - '**.md' resources: repositories: @@ -10,15 +24,13 @@ resources: name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release -on: - push: - branches: [dev, main, release/*] - pull_request: - branches: [dev, main, release/*] - schedule: - # Monday to Friday 3 AM CST build - # * is a special character in YAML so you have to quote this string - - cron: "0 8 * * 1,2,3,4,5" +schedules: + - cron: '0 0 * * MON' + displayName: At 12:00 AM, only on Monday + branches: + include: + - main + always: true extends: template: v1/1ES.Official.PipelineTemplate.yml@1es @@ -30,7 +42,7 @@ extends: stages: - stage: Build - displayName: 'Python E2E CI Run -- 1ES PT' + displayName: 'Python E2E CI Tests' jobs: - job: Build pool: @@ -38,9 +50,7 @@ extends: image: 1es-ubuntu-22.04 os: linux steps: - - name: Checkout code. - uses: actions/checkout@v4 - - name: Set up Dotnet 8.0.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "8.0.x" + - task: UseDotNet@2 + displayName: 'Install .NET Core SDK 8' + inputs: + version: '8.x' \ No newline at end of file From 0f1aa3bb34dbd929e87483f221eedec91914ec85 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 5 Jun 2024 17:14:30 -0500 Subject: [PATCH 05/14] same template as openai pipeline --- .github/workflows/ci_e2e_workflow.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index 1d5985ff4..b2b014ddc 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -1,10 +1,7 @@ -# This workflow will install Python dependencies and run end to end tests with single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - pr: branches: include: - - main + - dev paths: exclude: - '**.md' @@ -12,7 +9,7 @@ pr: trigger: branches: include: - - main + - dev paths: exclude: - '**.md' @@ -29,7 +26,7 @@ schedules: displayName: At 12:00 AM, only on Monday branches: include: - - main + - dev always: true extends: @@ -42,7 +39,7 @@ extends: stages: - stage: Build - displayName: 'Python E2E CI Tests' + displayName: 'Build extension and samples' jobs: - job: Build pool: @@ -51,6 +48,6 @@ extends: os: linux steps: - task: UseDotNet@2 - displayName: 'Install .NET Core SDK 8' + displayName: 'Install .NET Core SDK 6 LTS' inputs: - version: '8.x' \ No newline at end of file + version: '6.x' \ No newline at end of file From c458fca3628fcc118434b097ee26f0fc21b98350 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 5 Jun 2024 17:26:35 -0500 Subject: [PATCH 06/14] official build template --- .github/workflows/ci_e2e_workflow.yml | 4 --- eng/ci/official-build.yml | 48 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 eng/ci/official-build.yml diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index b2b014ddc..84c7b38ba 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -42,10 +42,6 @@ extends: displayName: 'Build extension and samples' jobs: - job: Build - pool: - name: 1es-pool-azfunc - image: 1es-ubuntu-22.04 - os: linux steps: - task: UseDotNet@2 displayName: 'Install .NET Core SDK 6 LTS' diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml new file mode 100644 index 000000000..d4de81de0 --- /dev/null +++ b/eng/ci/official-build.yml @@ -0,0 +1,48 @@ +trigger: + branches: + include: + - dev + paths: + exclude: + - '**.md' + +# CI only, does not trigger on PRs. +pr: none + +schedules: + - cron: '0 0 * * MON' + displayName: At 12:00 AM, only on Monday + branches: + include: + - main + always: true + +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + - repository: eng + type: git + name: engineering + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + stages: + - stage: BuildDotNet + displayName: 'Build DotNet' + jobs: + - job: Build + steps: + - task: UseDotNet@2 + displayName: 'Install .NET Core SDK 6 LTS' + inputs: + version: '6.x' \ No newline at end of file From e94ab04e75c890e630ec64414c230e3c97b29447 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 5 Jun 2024 18:22:34 -0500 Subject: [PATCH 07/14] official, public, e2e builds --- .github/workflows/ci_e2e_workflow.yml | 200 ++++++++++++++---- eng/ci/official-build.yml | 62 +++--- eng/ci/public-build.yml | 25 +++ .../official/jobs/build-artifacts.yml | 80 +++++++ eng/templates/official/jobs/ci-e2e-tests.yml | 161 ++++++++++++++ 5 files changed, 455 insertions(+), 73 deletions(-) create mode 100644 eng/ci/public-build.yml create mode 100644 eng/templates/official/jobs/build-artifacts.yml create mode 100644 eng/templates/official/jobs/ci-e2e-tests.yml diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index 84c7b38ba..ebe3b93df 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -1,49 +1,161 @@ -pr: - branches: - include: - - dev - paths: - exclude: - - '**.md' +# This workflow will install Python dependencies and run end to end tests with single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -trigger: - branches: - include: - - dev - paths: - exclude: - - '**.md' +name: CI E2E tests -resources: - repositories: - - repository: 1es - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release +on: + workflow_dispatch: + inputs: + archive_webhost_logging: + description: "For debugging purposes, archive test webhost logs" + required: false + default: "false" + push: + branches: [dev, main, release/*] + pull_request: + branches: [dev, main, release/*] + schedule: + # Monday to Friday 3 AM CST build + # * is a special character in YAML so you have to quote this string + - cron: "0 8 * * 1,2,3,4,5" -schedules: - - cron: '0 0 * * MON' - displayName: At 12:00 AM, only on Monday - branches: - include: - - dev - always: true +jobs: + build: + name: "Python E2E CI Run" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] + # Currently runs FWPC E2E tests, classic E2E tests, and DefBindings E2E tests. + # To run tests from another script, add the script name to this matrix + test-type: [fwpc-e2e-tests, e2e-tests, deferred-bindings-e2e-tests] + permissions: read-all + steps: + - name: Checkout code. + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Dotnet 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + - name: Install dependencies and the worker + run: | + retry() { + local -r -i max_attempts="$1"; shift + local -r cmd="$@" + local -i attempt_num=1 + until $cmd + do + if (( attempt_num == max_attempts )) + then + echo "Attempt $attempt_num failed and there are no more attempts left!" + return 1 + else + echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..." + sleep 1 + fi + done + } -extends: - template: v1/1ES.Official.PipelineTemplate.yml@1es - parameters: - pool: - name: 1es-pool-azfunc - image: 1es-windows-2022 - os: windows + python -m pip install --upgrade pip + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre + python -m pip install -U -e .[dev] + + if [[ "${{ matrix.python-version }}" != "3.7" ]]; then + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] + fi + if [[ "${{ matrix.python-version }}" != "3.7" && "${{ matrix.python-version }}" != "3.8" ]]; then + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-deferred-bindings] + fi - stages: - - stage: Build - displayName: 'Build extension and samples' - jobs: - - job: Build - steps: - - task: UseDotNet@2 - displayName: 'Install .NET Core SDK 6 LTS' - inputs: - version: '6.x' \ No newline at end of file + # Retry a couple times to avoid certificate issue + retry 5 python setup.py build + retry 5 python setup.py webhost --branch-name=dev + retry 5 python setup.py extension + mkdir logs + - name: Grant execute permission + run: | + chmod +x .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.7 ${{ matrix.test-type }} + if: matrix.python-version == 3.7 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.8 ${{ matrix.test-type }} + if: matrix.python-version == 3.8 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.9 ${{ matrix.test-type }} + if: matrix.python-version == 3.9 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.10 ${{ matrix.test-type }} + if: matrix.python-version == 3.10 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.11 ${{ matrix.test-type }} + if: matrix.python-version == 3.11 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString311 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString311 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString311 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.xml # optional + flags: unittests # optional + name: codecov # optional + fail_ci_if_error: false # optional (default = false) + - name: Publish Logs to Artifact + if: failure() + uses: actions/upload-artifact@v4 + with: + name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} + path: logs/*.log + if-no-files-found: ignore \ No newline at end of file diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index d4de81de0..d4a178d50 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -1,32 +1,27 @@ trigger: + batch: true branches: include: - - dev - paths: - exclude: - - '**.md' + - dev + - release/* # CI only, does not trigger on PRs. pr: none -schedules: - - cron: '0 0 * * MON' - displayName: At 12:00 AM, only on Monday - branches: - include: - - main - always: true - resources: repositories: - - repository: 1es - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release - - repository: eng - type: git - name: engineering - ref: refs/tags/release + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + - repository: eng + type: git + name: engineering + ref: refs/tags/release + +variables: + - template: ci/variables/build.yml@eng + - template: ci/variables/cfs.yml@eng extends: template: v1/1ES.Official.PipelineTemplate.yml@1es @@ -37,12 +32,21 @@ extends: os: windows stages: - - stage: BuildDotNet - displayName: 'Build DotNet' - jobs: - - job: Build - steps: - - task: UseDotNet@2 - displayName: 'Install .NET Core SDK 6 LTS' - inputs: - version: '6.x' \ No newline at end of file + - stage: Build + + jobs: + - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self + + - stage: TestWindows + dependsOn: Build + + jobs: + - template: /eng/ci/templates/official/jobs/run-e2e-tests-windows.yml@self + + - stage: TestLinux + dependsOn: + - Build + - TestWindows + + jobs: + - template: /eng/ci/templates/official/jobs/run-e2e-tests-linux.yml@self \ No newline at end of file diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml new file mode 100644 index 000000000..b02e99bc4 --- /dev/null +++ b/eng/ci/public-build.yml @@ -0,0 +1,25 @@ +trigger: + batch: true + branches: + include: + - dev + +pr: + branches: + include: + - dev + +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc-public + image: 1es-windows-2022 + os: windows \ No newline at end of file diff --git a/eng/templates/official/jobs/build-artifacts.yml b/eng/templates/official/jobs/build-artifacts.yml new file mode 100644 index 000000000..79dbd2475 --- /dev/null +++ b/eng/templates/official/jobs/build-artifacts.yml @@ -0,0 +1,80 @@ +jobs: + - job: "Build" + displayName: 'Build python worker' + + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - output: pipelineArtifact + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: 'drop' + - output: nuget + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], true)) + useDotNetTask: false + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' + packageParentPath: '$(Build.ArtifactStagingDirectory)' + publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df' + nuGetFeedType: 'internal' + allowPackageConflicts: true + + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + variables: + ${{ if contains(variables['Build.SourceBranch'], '/tags/' ) }}: + isTagTemp: true + isTag: $[variables.isTagTemp] + + strategy: + matrix: + Python37V4: + pythonVersion: '3.7' + workerPath: $(PROD_V4_WORKER_PY) + Python38V4: + pythonVersion: '3.8' + workerPath: $(PROD_V4_WORKER_PY) + Python39V4: + pythonVersion: '3.9' + workerPath: $(PROD_V4_WORKER_PY) + Python310V4: + pythonVersion: '3.10' + workerPath: $(PROD_V4_WORKER_PY) + Python311V4: + pythonVersion: '3.11' + workerPath: $(PROD_V4_WORKER_PY) + + steps: + - template: pack/templates/win_env_gen.yml + displayName: 'Build Windows x64' + parameters: + pythonVersion: '$(pythonVersion)' + workerPath: '$(workerPath)' + architecture: 'x64' + artifactName: '$(pythonVersion)_WINDOWS_X64' + - template: pack/templates/win_env_gen.yml + displayName: 'Build Windows x86' + parameters: + pythonVersion: '$(pythonVersion)' + workerPath: '$(workerPath)' + architecture: 'x86' + artifactName: '$(pythonVersion)_WINDOWS_x86' + - template: pack/templates/nix_env_gen.yml + displayName: 'Build Linux x64' + parameters: + pythonVersion: '$(pythonVersion)' + workerPath: '$(workerPath)' + artifactName: '$(pythonVersion)_LINUX_X64' + - template: pack/templates/nix_env_gen.yml + displayName: 'Build OSX X64' + parameters: + pythonVersion: '$(pythonVersion)' + workerPath: '$(workerPath)' + artifactName: '$(pythonVersion)_OSX_X64' + - template: pack/templates/macos_64_env_gen.yml + displayName: 'Build OSX ARM64' + parameters: + pythonVersion: '$(pythonVersion)' + workerPath: '$(workerPath)' + artifactName: '$(pythonVersion)_OSX_ARM64' diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml new file mode 100644 index 000000000..ebe3b93df --- /dev/null +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -0,0 +1,161 @@ +# This workflow will install Python dependencies and run end to end tests with single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: CI E2E tests + +on: + workflow_dispatch: + inputs: + archive_webhost_logging: + description: "For debugging purposes, archive test webhost logs" + required: false + default: "false" + push: + branches: [dev, main, release/*] + pull_request: + branches: [dev, main, release/*] + schedule: + # Monday to Friday 3 AM CST build + # * is a special character in YAML so you have to quote this string + - cron: "0 8 * * 1,2,3,4,5" + +jobs: + build: + name: "Python E2E CI Run" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] + # Currently runs FWPC E2E tests, classic E2E tests, and DefBindings E2E tests. + # To run tests from another script, add the script name to this matrix + test-type: [fwpc-e2e-tests, e2e-tests, deferred-bindings-e2e-tests] + permissions: read-all + steps: + - name: Checkout code. + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Dotnet 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + - name: Install dependencies and the worker + run: | + retry() { + local -r -i max_attempts="$1"; shift + local -r cmd="$@" + local -i attempt_num=1 + until $cmd + do + if (( attempt_num == max_attempts )) + then + echo "Attempt $attempt_num failed and there are no more attempts left!" + return 1 + else + echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..." + sleep 1 + fi + done + } + + python -m pip install --upgrade pip + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre + python -m pip install -U -e .[dev] + + if [[ "${{ matrix.python-version }}" != "3.7" ]]; then + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] + fi + if [[ "${{ matrix.python-version }}" != "3.7" && "${{ matrix.python-version }}" != "3.8" ]]; then + python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-deferred-bindings] + fi + + # Retry a couple times to avoid certificate issue + retry 5 python setup.py build + retry 5 python setup.py webhost --branch-name=dev + retry 5 python setup.py extension + mkdir logs + - name: Grant execute permission + run: | + chmod +x .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.7 ${{ matrix.test-type }} + if: matrix.python-version == 3.7 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString37 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString37 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString37 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.8 ${{ matrix.test-type }} + if: matrix.python-version == 3.8 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString38 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString38 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString38 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.9 ${{ matrix.test-type }} + if: matrix.python-version == 3.9 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString39 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString39 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString39 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.10 ${{ matrix.test-type }} + if: matrix.python-version == 3.10 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString310 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Running 3.11 ${{ matrix.test-type }} + if: matrix.python-version == 3.11 + env: + AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }} + AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }} + AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString311 }} + AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString311 }} + AzureWebJobsSqlConnectionString: ${{ secrets.LinuxSqlConnectionString311 }} + AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }} + AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }} + ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} + run: | + .github/Scripts/${{ matrix.test-type }}.sh + - name: Codecov + uses: codecov/codecov-action@v3 + with: + file: ./coverage.xml # optional + flags: unittests # optional + name: codecov # optional + fail_ci_if_error: false # optional (default = false) + - name: Publish Logs to Artifact + if: failure() + uses: actions/upload-artifact@v4 + with: + name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} + path: logs/*.log + if-no-files-found: ignore \ No newline at end of file From 3b795b452c48f5086a7b7d14a67d77fecc32b7ff Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 5 Jun 2024 18:34:59 -0500 Subject: [PATCH 08/14] yml formatting --- .github/workflows/ci_e2e_workflow.yml | 6 +- eng/ci/code-mirror.yml | 14 ++-- eng/ci/official-build.yml | 46 ++++++------- eng/ci/public-build.yml | 14 ++-- .../official/jobs/build-artifacts.yml | 66 +++++++++---------- eng/templates/official/jobs/ci-e2e-tests.yml | 6 +- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index ebe3b93df..a8eb91136 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -64,7 +64,7 @@ jobs: python -m pip install --upgrade pip python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre python -m pip install -U -e .[dev] - + if [[ "${{ matrix.python-version }}" != "3.7" ]]; then python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] fi @@ -79,7 +79,7 @@ jobs: mkdir logs - name: Grant execute permission run: | - chmod +x .github/Scripts/${{ matrix.test-type }}.sh + chmod +x .github/Scripts/${{ matrix.test-type }}.sh - name: Running 3.7 ${{ matrix.test-type }} if: matrix.python-version == 3.7 env: @@ -158,4 +158,4 @@ jobs: with: name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} path: logs/*.log - if-no-files-found: ignore \ No newline at end of file + if-no-files-found: ignore diff --git a/eng/ci/code-mirror.yml b/eng/ci/code-mirror.yml index fec4062bd..dbfb1361d 100644 --- a/eng/ci/code-mirror.yml +++ b/eng/ci/code-mirror.yml @@ -1,18 +1,18 @@ trigger: branches: include: - - dev - - release/* + - dev + - release/* resources: repositories: - - repository: eng - type: git - name: engineering - ref: refs/tags/release + - repository: eng + type: git + name: engineering + ref: refs/tags/release variables: - template: ci/variables/cfs.yml@eng extends: - template: ci/code-mirror.yml@eng \ No newline at end of file + template: ci/code-mirror.yml@eng diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index d4a178d50..62aecd366 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -2,22 +2,22 @@ trigger: batch: true branches: include: - - dev - - release/* + - dev + - release/* # CI only, does not trigger on PRs. pr: none resources: repositories: - - repository: 1es - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release - - repository: eng - type: git - name: engineering - ref: refs/tags/release + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + - repository: eng + type: git + name: engineering + ref: refs/tags/release variables: - template: ci/variables/build.yml@eng @@ -32,21 +32,21 @@ extends: os: windows stages: - - stage: Build + - stage: Build - jobs: - - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self + jobs: + - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self - - stage: TestWindows - dependsOn: Build + - stage: TestWindows + dependsOn: Build - jobs: - - template: /eng/ci/templates/official/jobs/run-e2e-tests-windows.yml@self + jobs: + - template: /eng/ci/templates/official/jobs/run-e2e-tests-windows.yml@self - - stage: TestLinux - dependsOn: - - Build - - TestWindows + - stage: TestLinux + dependsOn: + - Build + - TestWindows - jobs: - - template: /eng/ci/templates/official/jobs/run-e2e-tests-linux.yml@self \ No newline at end of file + jobs: + - template: /eng/ci/templates/official/jobs/run-e2e-tests-linux.yml@self diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml index b02e99bc4..880644d3a 100644 --- a/eng/ci/public-build.yml +++ b/eng/ci/public-build.yml @@ -2,19 +2,19 @@ trigger: batch: true branches: include: - - dev + - dev pr: branches: include: - - dev + - dev resources: repositories: - - repository: 1es - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es @@ -22,4 +22,4 @@ extends: pool: name: 1es-pool-azfunc-public image: 1es-windows-2022 - os: windows \ No newline at end of file + os: windows diff --git a/eng/templates/official/jobs/build-artifacts.yml b/eng/templates/official/jobs/build-artifacts.yml index 79dbd2475..29fa6dd43 100644 --- a/eng/templates/official/jobs/build-artifacts.yml +++ b/eng/templates/official/jobs/build-artifacts.yml @@ -1,20 +1,20 @@ jobs: - job: "Build" - displayName: 'Build python worker' + displayName: "Build python worker" templateContext: outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - output: pipelineArtifact targetPath: $(Build.ArtifactStagingDirectory) - artifactName: 'drop' + artifactName: "drop" - output: nuget condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), eq(variables['UPLOADPACKAGETOPRERELEASEFEED'], true)) useDotNetTask: false - packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' - packageParentPath: '$(Build.ArtifactStagingDirectory)' - publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df' - nuGetFeedType: 'internal' + packagesToPush: "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg" + packageParentPath: "$(Build.ArtifactStagingDirectory)" + publishVstsFeed: "e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df" + nuGetFeedType: "internal" allowPackageConflicts: true pool: @@ -30,51 +30,51 @@ jobs: strategy: matrix: Python37V4: - pythonVersion: '3.7' + pythonVersion: "3.7" workerPath: $(PROD_V4_WORKER_PY) Python38V4: - pythonVersion: '3.8' + pythonVersion: "3.8" workerPath: $(PROD_V4_WORKER_PY) Python39V4: - pythonVersion: '3.9' + pythonVersion: "3.9" workerPath: $(PROD_V4_WORKER_PY) Python310V4: - pythonVersion: '3.10' + pythonVersion: "3.10" workerPath: $(PROD_V4_WORKER_PY) Python311V4: - pythonVersion: '3.11' + pythonVersion: "3.11" workerPath: $(PROD_V4_WORKER_PY) steps: - template: pack/templates/win_env_gen.yml - displayName: 'Build Windows x64' + displayName: "Build Windows x64" parameters: - pythonVersion: '$(pythonVersion)' - workerPath: '$(workerPath)' - architecture: 'x64' - artifactName: '$(pythonVersion)_WINDOWS_X64' + pythonVersion: "$(pythonVersion)" + workerPath: "$(workerPath)" + architecture: "x64" + artifactName: "$(pythonVersion)_WINDOWS_X64" - template: pack/templates/win_env_gen.yml - displayName: 'Build Windows x86' + displayName: "Build Windows x86" parameters: - pythonVersion: '$(pythonVersion)' - workerPath: '$(workerPath)' - architecture: 'x86' - artifactName: '$(pythonVersion)_WINDOWS_x86' + pythonVersion: "$(pythonVersion)" + workerPath: "$(workerPath)" + architecture: "x86" + artifactName: "$(pythonVersion)_WINDOWS_x86" - template: pack/templates/nix_env_gen.yml - displayName: 'Build Linux x64' + displayName: "Build Linux x64" parameters: - pythonVersion: '$(pythonVersion)' - workerPath: '$(workerPath)' - artifactName: '$(pythonVersion)_LINUX_X64' + pythonVersion: "$(pythonVersion)" + workerPath: "$(workerPath)" + artifactName: "$(pythonVersion)_LINUX_X64" - template: pack/templates/nix_env_gen.yml - displayName: 'Build OSX X64' + displayName: "Build OSX X64" parameters: - pythonVersion: '$(pythonVersion)' - workerPath: '$(workerPath)' - artifactName: '$(pythonVersion)_OSX_X64' + pythonVersion: "$(pythonVersion)" + workerPath: "$(workerPath)" + artifactName: "$(pythonVersion)_OSX_X64" - template: pack/templates/macos_64_env_gen.yml - displayName: 'Build OSX ARM64' + displayName: "Build OSX ARM64" parameters: - pythonVersion: '$(pythonVersion)' - workerPath: '$(workerPath)' - artifactName: '$(pythonVersion)_OSX_ARM64' + pythonVersion: "$(pythonVersion)" + workerPath: "$(workerPath)" + artifactName: "$(pythonVersion)_OSX_ARM64" diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index ebe3b93df..a8eb91136 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -64,7 +64,7 @@ jobs: python -m pip install --upgrade pip python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre python -m pip install -U -e .[dev] - + if [[ "${{ matrix.python-version }}" != "3.7" ]]; then python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] fi @@ -79,7 +79,7 @@ jobs: mkdir logs - name: Grant execute permission run: | - chmod +x .github/Scripts/${{ matrix.test-type }}.sh + chmod +x .github/Scripts/${{ matrix.test-type }}.sh - name: Running 3.7 ${{ matrix.test-type }} if: matrix.python-version == 3.7 env: @@ -158,4 +158,4 @@ jobs: with: name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} path: logs/*.log - if-no-files-found: ignore \ No newline at end of file + if-no-files-found: ignore From 1a5d145b22528783286879510d17e79ce0491c31 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 12 Jun 2024 10:11:26 -0500 Subject: [PATCH 09/14] tests typo --- eng/ci/official-build.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index 62aecd366..23c7c05b7 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -37,16 +37,8 @@ extends: jobs: - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self - - stage: TestWindows + - stage: RunTests dependsOn: Build jobs: - - template: /eng/ci/templates/official/jobs/run-e2e-tests-windows.yml@self - - - stage: TestLinux - dependsOn: - - Build - - TestWindows - - jobs: - - template: /eng/ci/templates/official/jobs/run-e2e-tests-linux.yml@self + - template: /eng/ci/templates/official/jobs/ci-e2e-tests.yml@self From 7d238230f12512206464d85e4b79305c7872afa8 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 12 Jun 2024 14:31:16 -0500 Subject: [PATCH 10/14] formatting & feedback --- .github/workflows/ci_e2e_workflow.yml | 2 +- eng/ci/code-mirror.yml | 2 +- eng/ci/official-build.yml | 12 +- eng/ci/public-build.yml | 13 ++ .../official/jobs/build-artifacts.yml | 2 +- eng/templates/official/jobs/ci-e2e-tests.yml | 188 +++++++++--------- 6 files changed, 116 insertions(+), 103 deletions(-) diff --git a/.github/workflows/ci_e2e_workflow.yml b/.github/workflows/ci_e2e_workflow.yml index a8eb91136..0d97b962f 100644 --- a/.github/workflows/ci_e2e_workflow.yml +++ b/.github/workflows/ci_e2e_workflow.yml @@ -158,4 +158,4 @@ jobs: with: name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} path: logs/*.log - if-no-files-found: ignore + if-no-files-found: ignore \ No newline at end of file diff --git a/eng/ci/code-mirror.yml b/eng/ci/code-mirror.yml index dbfb1361d..04c800eae 100644 --- a/eng/ci/code-mirror.yml +++ b/eng/ci/code-mirror.yml @@ -15,4 +15,4 @@ variables: - template: ci/variables/cfs.yml@eng extends: - template: ci/code-mirror.yml@eng + template: ci/code-mirror.yml@eng \ No newline at end of file diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index 23c7c05b7..d7a08c62e 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -8,6 +8,14 @@ trigger: # CI only, does not trigger on PRs. pr: none +schedules: + - cron: '0 0 * * MON' + displayName: At 12:00 AM, only on Monday + branches: + include: + - main + always: true + resources: repositories: - repository: 1es @@ -33,12 +41,10 @@ extends: stages: - stage: Build - jobs: - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self - stage: RunTests dependsOn: Build - jobs: - - template: /eng/ci/templates/official/jobs/ci-e2e-tests.yml@self + - template: /eng/ci/templates/official/jobs/ci-e2e-tests.yml@self \ No newline at end of file diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml index 880644d3a..b98c80f4d 100644 --- a/eng/ci/public-build.yml +++ b/eng/ci/public-build.yml @@ -9,6 +9,14 @@ pr: include: - dev +schedules: + - cron: '0 0 * * MON' + displayName: At 12:00 AM, only on Monday + branches: + include: + - main + always: true + resources: repositories: - repository: 1es @@ -23,3 +31,8 @@ extends: name: 1es-pool-azfunc-public image: 1es-windows-2022 os: windows + + stages: + - stage: Build + jobs: + - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self \ No newline at end of file diff --git a/eng/templates/official/jobs/build-artifacts.yml b/eng/templates/official/jobs/build-artifacts.yml index 29fa6dd43..0d9c41648 100644 --- a/eng/templates/official/jobs/build-artifacts.yml +++ b/eng/templates/official/jobs/build-artifacts.yml @@ -77,4 +77,4 @@ jobs: parameters: pythonVersion: "$(pythonVersion)" workerPath: "$(workerPath)" - artifactName: "$(pythonVersion)_OSX_ARM64" + artifactName: "$(pythonVersion)_OSX_ARM64" \ No newline at end of file diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index a8eb91136..6ed7c21ed 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -1,74 +1,76 @@ -# This workflow will install Python dependencies and run end to end tests with single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: CI E2E tests +jobs: + - job: "TestPython" + displayName: "Run Python E2E Tests" -on: - workflow_dispatch: - inputs: - archive_webhost_logging: - description: "For debugging purposes, archive test webhost logs" - required: false - default: "false" - push: - branches: [dev, main, release/*] - pull_request: - branches: [dev, main, release/*] - schedule: - # Monday to Friday 3 AM CST build - # * is a special character in YAML so you have to quote this string - - cron: "0 8 * * 1,2,3,4,5" + pool: + name: 1es-pool-azfunc + image: 1es-ubuntu-22.04 + os: linux -jobs: - build: - name: "Python E2E CI Run" - runs-on: ubuntu-latest strategy: - fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] - # Currently runs FWPC E2E tests, classic E2E tests, and DefBindings E2E tests. - # To run tests from another script, add the script name to this matrix - test-type: [fwpc-e2e-tests, e2e-tests, deferred-bindings-e2e-tests] - permissions: read-all + python-37-fwpc: + PYTHON_VERSION: '3.7' + TEST_TYPE: 'fwpc-e2e-tests' + python-37-e2e: + PYTHON_VERSION: '3.7' + TEST_TYPE: 'e2e-tests' + python-37-deferred-bindings: + PYTHON_VERSION: '3.7' + TEST_TYPE: 'deferred-bindings-e2e-tests' + python-38-fwpc: + PYTHON_VERSION: '3.8' + TEST_TYPE: 'fwpc-e2e-tests' + python-38-e2e: + PYTHON_VERSION: '3.8' + TEST_TYPE: 'e2e-tests' + python-38-deferred-bindings: + PYTHON_VERSION: '3.8' + TEST_TYPE: 'deferred-bindings-e2e-tests' + python-39-fwpc: + PYTHON_VERSION: '3.9' + TEST_TYPE: 'fwpc-e2e-tests' + python-39-e2e: + PYTHON_VERSION: '3.9' + TEST_TYPE: 'e2e-tests' + python-39-deferred-bindings: + PYTHON_VERSION: '3.9' + TEST_TYPE: 'deferred-bindings-e2e-tests' + python-310-fwpc: + PYTHON_VERSION: '3.10' + TEST_TYPE: 'fwpc-e2e-tests' + python-310-e2e: + PYTHON_VERSION: '3.10' + TEST_TYPE: 'e2e-tests' + python-310-deferred-bindings: + PYTHON_VERSION: '3.10' + TEST_TYPE: 'deferred-bindings-e2e-tests' + python-311-fwpc: + PYTHON_VERSION: '3.11' + TEST_TYPE: 'fwpc-e2e-tests' + python-311-e2e: + PYTHON_VERSION: '3.11' + TEST_TYPE: 'e2e-tests' + python-311-deferred-bindings: + PYTHON_VERSION: '3.11' + TEST_TYPE: 'deferred-bindings-e2e-tests' steps: - - name: Checkout code. - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Set up Dotnet 8.0.x - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "8.0.x" - - name: Install dependencies and the worker - run: | - retry() { - local -r -i max_attempts="$1"; shift - local -r cmd="$@" - local -i attempt_num=1 - until $cmd - do - if (( attempt_num == max_attempts )) - then - echo "Attempt $attempt_num failed and there are no more attempts left!" - return 1 - else - echo "Attempt $attempt_num failed! Trying again in $attempt_num seconds..." - sleep 1 - fi - done - } - + - task: UsePythonVersion@0 + inputs: + versionSpec: $(PYTHON_VERSION) + - task: UseDotNet@2 + displayName: 'Install .NET 6' + inputs: + version: 6.0.x + - bash: | python -m pip install --upgrade pip python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre python -m pip install -U -e .[dev] - if [[ "${{ matrix.python-version }}" != "3.7" ]]; then + if [[ "${{ PYTHON_VERSION }}" != "3.7" ]]; then python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-http-v2] fi - if [[ "${{ matrix.python-version }}" != "3.7" && "${{ matrix.python-version }}" != "3.8" ]]; then + if [[ "${{ PYTHON_VERSION }}" != "3.7" && "${{ PYTHON_VERSION }}" != "3.8" ]]; then python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple --pre -U -e .[test-deferred-bindings] fi @@ -77,11 +79,14 @@ jobs: retry 5 python setup.py webhost --branch-name=dev retry 5 python setup.py extension mkdir logs - - name: Grant execute permission - run: | - chmod +x .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.7 ${{ matrix.test-type }} - if: matrix.python-version == 3.7 + displayName: 'Install dependencies and the worker' + - bash: | + chmod +x .github/Scripts/${{ TEST_TYPE }}.sh + displayName: 'Grant execute permission' + - bash: | + if [[ "${{ PYTHON_VERSION }}" == "3.7" ]]; then + .github/Scripts/${{ TEST_TYPE }}.sh + fi env: AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString37 }} AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString37 }} @@ -91,10 +96,11 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString37 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString37 }} ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.8 ${{ matrix.test-type }} - if: matrix.python-version == 3.8 + displayName: "Running 3.7 $(TEST_TYPE) tests" + - bash: | + if [[ "${{ PYTHON_VERSION }}" == "3.8" ]]; then + .github/Scripts/${{ TEST_TYPE }}.sh + fi env: AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString38 }} AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString38 }} @@ -104,10 +110,11 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString38 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString38 }} ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.9 ${{ matrix.test-type }} - if: matrix.python-version == 3.9 + displayName: "Running 3.8 $(TEST_TYPE) tests" + - bash: | + if [[ "${{ PYTHON_VERSION }}" == "3.9" ]]; then + .github/Scripts/${{ TEST_TYPE }}.sh + fi env: AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString39 }} AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString39 }} @@ -117,10 +124,11 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString39 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }} ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.10 ${{ matrix.test-type }} - if: matrix.python-version == 3.10 + displayName: "Running 3.9 $(TEST_TYPE) tests" + - bash: | + if [[ "${{ PYTHON_VERSION }}" == "3.10" ]]; then + .github/Scripts/${{ TEST_TYPE }}.sh + fi env: AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }} AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }} @@ -130,10 +138,11 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }} ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Running 3.11 ${{ matrix.test-type }} - if: matrix.python-version == 3.11 + displayName: "Running 3.10 $(TEST_TYPE) tests" + - bash: | + if [[ "${{ PYTHON_VERSION }}" == "3.11" ]]; then + .github/Scripts/${{ TEST_TYPE }}.sh + fi env: AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString311 }} AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString311 }} @@ -143,19 +152,4 @@ jobs: AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString311 }} AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString311 }} ARCHIVE_WEBHOST_LOGS: ${{ github.event.inputs.archive_webhost_logging }} - run: | - .github/Scripts/${{ matrix.test-type }}.sh - - name: Codecov - uses: codecov/codecov-action@v3 - with: - file: ./coverage.xml # optional - flags: unittests # optional - name: codecov # optional - fail_ci_if_error: false # optional (default = false) - - name: Publish Logs to Artifact - if: failure() - uses: actions/upload-artifact@v4 - with: - name: Test WebHost Logs ${{ github.run_id }} ${{ matrix.python-version }} - path: logs/*.log - if-no-files-found: ignore + displayName: "Running 3.11 $(TEST_TYPE) tests" From 3ff15113751b8dfb17c429478e0c795e19c75b79 Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 12 Jun 2024 14:53:33 -0500 Subject: [PATCH 11/14] removed nuget internal reference --- eng/templates/official/jobs/build-artifacts.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/templates/official/jobs/build-artifacts.yml b/eng/templates/official/jobs/build-artifacts.yml index 0d9c41648..52a39385f 100644 --- a/eng/templates/official/jobs/build-artifacts.yml +++ b/eng/templates/official/jobs/build-artifacts.yml @@ -14,7 +14,6 @@ jobs: packagesToPush: "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg" packageParentPath: "$(Build.ArtifactStagingDirectory)" publishVstsFeed: "e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df" - nuGetFeedType: "internal" allowPackageConflicts: true pool: From 7c12fb5981f11e14087c45099ed15d741a82811d Mon Sep 17 00:00:00 2001 From: Victoria Hall Date: Wed, 12 Jun 2024 15:04:49 -0500 Subject: [PATCH 12/14] removed official folder --- eng/ci/official-build.yml | 4 ++-- eng/ci/public-build.yml | 2 +- eng/templates/{official/jobs => }/build-artifacts.yml | 0 eng/templates/{official/jobs => }/ci-e2e-tests.yml | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename eng/templates/{official/jobs => }/build-artifacts.yml (100%) rename eng/templates/{official/jobs => }/ci-e2e-tests.yml (100%) diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index d7a08c62e..1a740883f 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -42,9 +42,9 @@ extends: stages: - stage: Build jobs: - - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self + - template: /eng/ci/templates/build-artifacts.yml@self - stage: RunTests dependsOn: Build jobs: - - template: /eng/ci/templates/official/jobs/ci-e2e-tests.yml@self \ No newline at end of file + - template: /eng/ci/templates/ci-e2e-tests.yml@self \ No newline at end of file diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml index b98c80f4d..0f935604a 100644 --- a/eng/ci/public-build.yml +++ b/eng/ci/public-build.yml @@ -35,4 +35,4 @@ extends: stages: - stage: Build jobs: - - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self \ No newline at end of file + - template: /eng/ci/templates/build-artifacts.yml@self \ No newline at end of file diff --git a/eng/templates/official/jobs/build-artifacts.yml b/eng/templates/build-artifacts.yml similarity index 100% rename from eng/templates/official/jobs/build-artifacts.yml rename to eng/templates/build-artifacts.yml diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/ci-e2e-tests.yml similarity index 100% rename from eng/templates/official/jobs/ci-e2e-tests.yml rename to eng/templates/ci-e2e-tests.yml From 64d9e5bc1dcf9cc4c0b8cf446fdd321568373c3c Mon Sep 17 00:00:00 2001 From: hallvictoria Date: Thu, 13 Jun 2024 11:48:02 -0500 Subject: [PATCH 13/14] feedback, updating public build --- eng/ci/official-build.yml | 6 ++--- eng/ci/public-build.yml | 4 ++-- eng/templates/jobs/build.yml | 22 +++++++++++++++++++ .../{ => official/jobs}/build-artifacts.yml | 1 + .../{ => official/jobs}/ci-e2e-tests.yml | 0 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 eng/templates/jobs/build.yml rename eng/templates/{ => official/jobs}/build-artifacts.yml (98%) rename eng/templates/{ => official/jobs}/ci-e2e-tests.yml (100%) diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index 1a740883f..bb6afa21f 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -13,7 +13,7 @@ schedules: displayName: At 12:00 AM, only on Monday branches: include: - - main + - dev always: true resources: @@ -42,9 +42,9 @@ extends: stages: - stage: Build jobs: - - template: /eng/ci/templates/build-artifacts.yml@self + - template: /eng/ci/templates/official/jobs/build-artifacts.yml@self - stage: RunTests dependsOn: Build jobs: - - template: /eng/ci/templates/ci-e2e-tests.yml@self \ No newline at end of file + - template: /eng/ci/templates/official/jobs/ci-e2e-tests.yml@self \ No newline at end of file diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml index 0f935604a..929634b69 100644 --- a/eng/ci/public-build.yml +++ b/eng/ci/public-build.yml @@ -14,7 +14,7 @@ schedules: displayName: At 12:00 AM, only on Monday branches: include: - - main + - dev always: true resources: @@ -35,4 +35,4 @@ extends: stages: - stage: Build jobs: - - template: /eng/ci/templates/build-artifacts.yml@self \ No newline at end of file + - template: /eng/ci/templates/jobs/build.yml@self \ No newline at end of file diff --git a/eng/templates/jobs/build.yml b/eng/templates/jobs/build.yml new file mode 100644 index 000000000..dd35febf1 --- /dev/null +++ b/eng/templates/jobs/build.yml @@ -0,0 +1,22 @@ +jobs: + - job: "Build" + displayName: 'Build python worker' + + pool: + name: 1es-pool-azfunc-public + image: 1es-windows-2022 + os: windows + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: "3.11" + - bash: | + python --version + displayName: 'Check python version' + - bash: | + python -m venv .env + source .env/bin/activate + python -m pip install --upgrade pip==23.0 + python -m pip install . + displayName: 'Build python worker' \ No newline at end of file diff --git a/eng/templates/build-artifacts.yml b/eng/templates/official/jobs/build-artifacts.yml similarity index 98% rename from eng/templates/build-artifacts.yml rename to eng/templates/official/jobs/build-artifacts.yml index 52a39385f..0d9c41648 100644 --- a/eng/templates/build-artifacts.yml +++ b/eng/templates/official/jobs/build-artifacts.yml @@ -14,6 +14,7 @@ jobs: packagesToPush: "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg" packageParentPath: "$(Build.ArtifactStagingDirectory)" publishVstsFeed: "e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df" + nuGetFeedType: "internal" allowPackageConflicts: true pool: diff --git a/eng/templates/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml similarity index 100% rename from eng/templates/ci-e2e-tests.yml rename to eng/templates/official/jobs/ci-e2e-tests.yml From 790bdf5c00447899a8426bbd03f74daf11b8ec25 Mon Sep 17 00:00:00 2001 From: hallvictoria Date: Fri, 14 Jun 2024 11:35:31 -0500 Subject: [PATCH 14/14] updating build cmd and dotnet version --- eng/templates/jobs/build.yml | 2 +- eng/templates/official/jobs/ci-e2e-tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/templates/jobs/build.yml b/eng/templates/jobs/build.yml index dd35febf1..dadd88fb5 100644 --- a/eng/templates/jobs/build.yml +++ b/eng/templates/jobs/build.yml @@ -16,7 +16,7 @@ jobs: displayName: 'Check python version' - bash: | python -m venv .env - source .env/bin/activate + .env\Scripts\Activate.ps1 python -m pip install --upgrade pip==23.0 python -m pip install . displayName: 'Build python worker' \ No newline at end of file diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index 6ed7c21ed..3ebdaca64 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -59,9 +59,9 @@ jobs: inputs: versionSpec: $(PYTHON_VERSION) - task: UseDotNet@2 - displayName: 'Install .NET 6' + displayName: 'Install .NET 8' inputs: - version: 6.0.x + version: 8.0.x - bash: | python -m pip install --upgrade pip python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre