From 849f735ad8d40fbdf151cf82c3b296cfe9381757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Niesiob=C4=99dzki?= Date: Mon, 11 Mar 2024 08:38:03 +0000 Subject: [PATCH] Add test reports to checks --- .github/actions/post-fabric-tests/action.yml | 33 +++++++++++++++ .github/workflows/tests.yml | 42 +++++++++++++++++--- 2 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 .github/actions/post-fabric-tests/action.yml diff --git a/.github/actions/post-fabric-tests/action.yml b/.github/actions/post-fabric-tests/action.yml new file mode 100644 index 0000000000..8fe774d6f2 --- /dev/null +++ b/.github/actions/post-fabric-tests/action.yml @@ -0,0 +1,33 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: post-fabric-tests +description: Create test reports +inputs: + MODULE: + required: true +runs: + using: composite + steps: + - name: Reformat test-results.xml + shell: bash + run: | + sed -e 's/\\n/\n/g' test-results-raw.xml > test-results.xml + + - name: Test report + uses: pmeier/pytest-results-action@035bda205f160abee0b277db11ac6ca01175ca7d # v0.6.0 + with: + path: test-results.xml + title: ${{ inputs.MODULE }} Test report + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8adef331ca..4b3ff78aa1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -# Copyright 2023 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,7 +76,13 @@ jobs: TERRAFORM_VERSION: ${{ env.TF_VERSION }} - name: Run tests on documentation examples - run: pytest -vv -n4 --tb=line -k blueprints/ tests/examples + run: pytest -vv -n4 --tb=line --junit-xml=test-results-raw.xml -k blueprints/ tests/examples + + - name: Create report + uses: ./.github/actions/post-fabric-tests + if: always() + with: + MODULE: Blueprint Examples examples-modules: runs-on: ubuntu-latest @@ -91,7 +97,13 @@ jobs: TERRAFORM_VERSION: ${{ env.TF_VERSION }} - name: Run tests on documentation examples - run: pytest -vv -n4 --tb=line -k modules/ tests/examples + run: pytest -vv -n4 --tb=line --junit-xml=test-results-raw.xml -k modules/ tests/examples + + - name: Create report + uses: ./.github/actions/post-fabric-tests + if: always() + with: + MODULE: Module Examples blueprints: runs-on: ubuntu-latest @@ -106,7 +118,13 @@ jobs: TERRAFORM_VERSION: ${{ env.TF_VERSION }} - name: Run tests environments - run: pytest -vv -n4 --tb=line tests/blueprints + run: pytest -vv -n4 --tb=line --junit-xml=test-results-raw.xml tests/blueprints + + - name: Create report + uses: ./.github/actions/post-fabric-tests + if: always() + with: + MODULE: Blueprints modules: runs-on: ubuntu-latest @@ -121,7 +139,13 @@ jobs: TERRAFORM_VERSION: ${{ env.TF_VERSION }} - name: Run tests modules - run: pytest -vv -n4 --tb=line tests/modules + run: pytest -vv -n4 --tb=line --junit-xml=test-results-raw.xml tests/modules + + - name: Create report + uses: ./.github/actions/post-fabric-tests + if: always() + with: + MODULE: Modules fast: runs-on: ubuntu-latest @@ -136,4 +160,10 @@ jobs: TERRAFORM_VERSION: ${{ env.TF_VERSION }} - name: Run tests on FAST stages - run: pytest -vv -n4 --tb=line tests/fast + run: pytest -vv -n4 --tb=line --junit-xml=test-results-raw.xml tests/fast + + - name: Create report + uses: ./.github/actions/post-fabric-tests + if: always() + with: + MODULE: FAST