Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test reports to checks #2147

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/actions/post-fabric-tests/action.yml
Original file line number Diff line number Diff line change
@@ -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

40 changes: 35 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,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
Expand All @@ -92,7 +98,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
Expand All @@ -107,7 +119,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
Expand All @@ -122,7 +140,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
Expand All @@ -137,4 +161,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
Loading