From f920357f952b1c3f48c34bc4500b3872b17f033a Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:14:59 +0200 Subject: [PATCH 01/12] solution e2e test on pull requests --- .github/workflows/solutions_ci.yml | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/solutions_ci.yml diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml new file mode 100644 index 000000000..b459df0d5 --- /dev/null +++ b/.github/workflows/solutions_ci.yml @@ -0,0 +1,43 @@ +name: CI for SAF templates +on: + pull_request: + +jobs: + check-solution-templates-changes: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.check.outputs.has_changes}} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Check for changes + id: check + run: | + CHANGES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- 'src/python/solution' 'src/python/osl_solution') + if [ -z "$CHANGES" ]; then + echo "has_changes=false" >> $GITHUB_OUTPUT + echo "No changes in the solution templates." + else + echo "has_changes=true" >> $GITHUB_OUTPUT + echo "Found changes in the solution templates." + fi + + solutions-e2e-tests: + needs: [check-solution-templates-changes] + if: | + needs.check-solution-templates-changes.outputs.changed == 'true' + name: Trigger solutions e2e tests + runs-on: ubuntu-latest + steps: + - name: github workflow dispatch + shell: bash + run: | + curl -L \ + -X POST \ + -H 'Accept: application/vnd.github+json' \ + -H "Authorization: Bearer $WORKFLOW_TOKEN"\ + "https://api.github.com/repos/Solution-Applications/solution-templates-end-to-end-testing/actions/workflows/_ansys-templates-remote-ci.yml/dispatches" \ + -d '{"ref":"refs/heads/main", "inputs":{"ansys-templates-ref": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file From 7f0b9b22d789990a9644013fbf46c219175e1a5a Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Thu, 26 Oct 2023 09:54:27 +0200 Subject: [PATCH 02/12] use secret token --- .github/workflows/solutions_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index b459df0d5..8c6240afe 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -38,6 +38,6 @@ jobs: curl -L \ -X POST \ -H 'Accept: application/vnd.github+json' \ - -H "Authorization: Bearer $WORKFLOW_TOKEN"\ + -H "Authorization: Bearer ${{ secrets.ANSYS_SOLUTIONS_E2E_TESTS }}"\ "https://api.github.com/repos/Solution-Applications/solution-templates-end-to-end-testing/actions/workflows/_ansys-templates-remote-ci.yml/dispatches" \ -d '{"ref":"refs/heads/main", "inputs":{"ansys-templates-ref": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file From b47a30e02d393d825a34ff51284f7a2d39a418b8 Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Thu, 26 Oct 2023 09:57:50 +0200 Subject: [PATCH 03/12] test before merging --- .github/workflows/solutions_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index 8c6240afe..d8c8a3593 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -27,8 +27,8 @@ jobs: solutions-e2e-tests: needs: [check-solution-templates-changes] - if: | - needs.check-solution-templates-changes.outputs.changed == 'true' + # if: | + # needs.check-solution-templates-changes.outputs.changed == 'true' name: Trigger solutions e2e tests runs-on: ubuntu-latest steps: From 8670f08ffd52ac059672b372e4f189d3ab475a28 Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:05:18 +0200 Subject: [PATCH 04/12] fix payload input name --- .github/workflows/solutions_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index d8c8a3593..491447aaf 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -40,4 +40,4 @@ jobs: -H 'Accept: application/vnd.github+json' \ -H "Authorization: Bearer ${{ secrets.ANSYS_SOLUTIONS_E2E_TESTS }}"\ "https://api.github.com/repos/Solution-Applications/solution-templates-end-to-end-testing/actions/workflows/_ansys-templates-remote-ci.yml/dispatches" \ - -d '{"ref":"refs/heads/main", "inputs":{"ansys-templates-ref": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file + -d '{"ref":"refs/heads/main", "inputs":{"ansys_templates_sha": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file From 203d752d48601f19330c56a274e06b054891c867 Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:14:26 +0200 Subject: [PATCH 05/12] debug --- .github/workflows/solutions_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index 491447aaf..aca6146ac 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -40,4 +40,4 @@ jobs: -H 'Accept: application/vnd.github+json' \ -H "Authorization: Bearer ${{ secrets.ANSYS_SOLUTIONS_E2E_TESTS }}"\ "https://api.github.com/repos/Solution-Applications/solution-templates-end-to-end-testing/actions/workflows/_ansys-templates-remote-ci.yml/dispatches" \ - -d '{"ref":"refs/heads/main", "inputs":{"ansys_templates_sha": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file + -d '{"ref":"refs/heads/debug", "inputs":{"ansys_templates_sha": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file From 185835dadf05802cd2e4bd6b14b40452c67be156 Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:12:03 +0200 Subject: [PATCH 06/12] revert debugging state --- .github/workflows/solutions_ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index aca6146ac..1f687ebb9 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -27,8 +27,8 @@ jobs: solutions-e2e-tests: needs: [check-solution-templates-changes] - # if: | - # needs.check-solution-templates-changes.outputs.changed == 'true' + if: | + needs.check-solution-templates-changes.outputs.changed == 'true' name: Trigger solutions e2e tests runs-on: ubuntu-latest steps: @@ -40,4 +40,4 @@ jobs: -H 'Accept: application/vnd.github+json' \ -H "Authorization: Bearer ${{ secrets.ANSYS_SOLUTIONS_E2E_TESTS }}"\ "https://api.github.com/repos/Solution-Applications/solution-templates-end-to-end-testing/actions/workflows/_ansys-templates-remote-ci.yml/dispatches" \ - -d '{"ref":"refs/heads/debug", "inputs":{"ansys_templates_sha": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file + -d '{"ref":"refs/heads/main", "inputs":{"ansys_templates_sha": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file From 1b505452a5cb65afb94b6f04ccb247ba28ecc941 Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:46:32 +0200 Subject: [PATCH 07/12] dummy change - test trigger --- .../{{cookiecutter.__project_name_slug}}/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst b/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst index 23139c05b..1502684c7 100644 --- a/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst +++ b/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst @@ -4,7 +4,7 @@ |python| .. note:: - This content needs to be configured according to the project specifics. + This content needs to be configured according to the project specifics. Introduction From 3c3d209101edc72cb6f6ddb1221f0088bf2cb7b5 Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:52:34 +0200 Subject: [PATCH 08/12] fix git diff --- .github/workflows/solutions_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index 1f687ebb9..87a4fb25f 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -16,7 +16,7 @@ jobs: - name: Check for changes id: check run: | - CHANGES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- 'src/python/solution' 'src/python/osl_solution') + CHANGES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- './src/ansys/templates/python/solution' './src/ansys/templates/python/osl_solution') if [ -z "$CHANGES" ]; then echo "has_changes=false" >> $GITHUB_OUTPUT echo "No changes in the solution templates." From f85b4c83c3f8e7614796d5ac4465264edbf4557e Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Fri, 27 Oct 2023 17:36:40 +0200 Subject: [PATCH 09/12] filter paths --- .github/workflows/solutions_ci.yml | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index 87a4fb25f..90c62b197 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -1,34 +1,13 @@ -name: CI for SAF templates +name: Trigger end-to-end tests for solution templates on: pull_request: + paths: + - 'src/ansys/templates/python/solution/**' + - 'src/ansys/templates/python/osl_solution/**' jobs: - check-solution-templates-changes: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - outputs: - changed: ${{ steps.check.outputs.has_changes}} - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Check for changes - id: check - run: | - CHANGES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- './src/ansys/templates/python/solution' './src/ansys/templates/python/osl_solution') - if [ -z "$CHANGES" ]; then - echo "has_changes=false" >> $GITHUB_OUTPUT - echo "No changes in the solution templates." - else - echo "has_changes=true" >> $GITHUB_OUTPUT - echo "Found changes in the solution templates." - fi solutions-e2e-tests: - needs: [check-solution-templates-changes] - if: | - needs.check-solution-templates-changes.outputs.changed == 'true' name: Trigger solutions e2e tests runs-on: ubuntu-latest steps: From 0185305bd949a50e24c6fcb9a4e7760550d0786c Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Fri, 27 Oct 2023 17:59:51 +0200 Subject: [PATCH 10/12] use gh cli --- .github/workflows/solutions_ci.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index 90c62b197..24920c1d4 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -13,10 +13,11 @@ jobs: steps: - name: github workflow dispatch shell: bash + env: + GH_TOKEN: ${{ secrets.ANSYS_SOLUTIONS_E2E_TESTS }} run: | - curl -L \ - -X POST \ - -H 'Accept: application/vnd.github+json' \ - -H "Authorization: Bearer ${{ secrets.ANSYS_SOLUTIONS_E2E_TESTS }}"\ - "https://api.github.com/repos/Solution-Applications/solution-templates-end-to-end-testing/actions/workflows/_ansys-templates-remote-ci.yml/dispatches" \ - -d '{"ref":"refs/heads/main", "inputs":{"ansys_templates_sha": "${{ github.event.pull_request.head.sha }}"}}' \ No newline at end of file + gh workflow run \ + _ansys-templates-remote-ci.yml \ + --repo "https://github.com/Solution-Applications/solution-templates-end-to-end-testing" \ + --field ansys_templates_sha="${{ github.event.pull_request.head.sha }}" + --ref "refs/heads/main" From c6e2df0b48dee699bd3d577f75d824c3136e3919 Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Fri, 27 Oct 2023 18:01:15 +0200 Subject: [PATCH 11/12] fix newline --- .github/workflows/solutions_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/solutions_ci.yml b/.github/workflows/solutions_ci.yml index 24920c1d4..5c6acd34d 100644 --- a/.github/workflows/solutions_ci.yml +++ b/.github/workflows/solutions_ci.yml @@ -19,5 +19,5 @@ jobs: gh workflow run \ _ansys-templates-remote-ci.yml \ --repo "https://github.com/Solution-Applications/solution-templates-end-to-end-testing" \ - --field ansys_templates_sha="${{ github.event.pull_request.head.sha }}" + --field ansys_templates_sha="${{ github.event.pull_request.head.sha }}" \ --ref "refs/heads/main" From 72ffe9def48ff02d54f5c1ba02e10c64fb678f4d Mon Sep 17 00:00:00 2001 From: ccpansys <122904344+ccpansys@users.noreply.github.com> Date: Fri, 27 Oct 2023 18:03:59 +0200 Subject: [PATCH 12/12] remove dummy change --- .../{{cookiecutter.__project_name_slug}}/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst b/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst index 1502684c7..23139c05b 100644 --- a/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst +++ b/src/ansys/templates/python/osl_solution/{{cookiecutter.__project_name_slug}}/README.rst @@ -4,7 +4,7 @@ |python| .. note:: - This content needs to be configured according to the project specifics. + This content needs to be configured according to the project specifics. Introduction