Skip to content

Commit

Permalink
Merge pull request #81 from launchableinc/github-test-result-action
Browse files Browse the repository at this point in the history
add example for `launchableinc/record-build-and-test-results-action` action
  • Loading branch information
Konboi authored Aug 9, 2024
2 parents 129d5d6 + e1e859a commit d3c6387
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/record-build-and-test-results-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: record-build-and-test-results-action
on:
push:
branches:
- main
- github-test-result-action # for debug
paths:
- "launchable-test-result//**"
- ".github/workflows/record-build-and-test-results-action.yml" # for debug

pull_request:
branches:
- main
- github-test-result-action # for debug
paths:
- "launchable-test-result//**"
- ".github/workflows/record-build-and-test-results-action.yml" # for debug

env:
LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN_PYTEST }}
LAUNCHABLE_DEBUG: 1
LAUNCHABLE_REPORT_ERROR: 1

jobs:
basic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Record build and test results action
uses: launchableinc/record-build-and-test-results-action@support-flavor-and-test-session-name-options
with:
report_path: launchable-test-result/test-results.xml
test_runner: pytest
if: always()
- name: Record build and test results action with no build
uses: launchableinc/record-build-and-test-results-action@support-flavor-and-test-session-name-options
with:
report_path: launchable-test-result/test-results.xml
test_runner: pytest
no_build: true
if: always()
custom-values:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Record build and test results action with test_session_name option
uses: launchableinc/record-build-and-test-results-action@support-flavor-and-test-session-name-options
with:
report_path: launchable-test-result/test-results.xml
test_runner: pytest
test_session_name: ${{ github.run_id }}
if: always()
- name: Record build and test results action with test_session_name option part 2
uses: launchableinc/record-build-and-test-results-action@support-flavor-and-test-session-name-options
with:
report_path: launchable-test-result/test-results.xml
test_runner: pytest
test_session_name: ${{ github.run_id }}
if: always()
- name: Record build and test results action with custom build name
uses: launchableinc/record-build-and-test-results-action@support-flavor-and-test-session-name-options
with:
report_path: launchable-test-result/test-results.xml
test_runner: pytest
build_name: ${{ github.run_id }}-${{ github.job }}
matrix-case:
strategy:
matrix:
python_version: ['3.12', '3.11', '3.10']
os: ['ubuntu-latest', 'windows-latest']
runs-on: ubuntu-latest
steps:
- name: Replace python version's dot to hyphen
run: |
python_version=$(echo "${{ matrix.python_version }}" | sed 's/\./-/g')
echo "python_version=$python_version" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Record build and test results action with custom build name and test_session_name option with flavor
uses: launchableinc/record-build-and-test-results-action@support-flavor-and-test-session-name-options
with:
report_path: launchable-test-result/test-results.xml
test_runner: pytest
build_name: ${{ github.run_id }}-${{ github.job }}
test_session_name: ${{ github.run_id }}-${{ github.job }}-${{ matrix.os }}-${{ env.python_version }}
flavors: 'build_name=true, test_session_name=true, flavors=true, count=1, python_version=${{ matrix.python_version }}, os=${{ matrix.os }}'
if: always()
- name: Record build and test results action with custom build name and test_session_name option with flavor part 2
uses: launchableinc/record-build-and-test-results-action@support-flavor-and-test-session-name-options
with:
report_path: launchable-test-result/test-results.xml
test_runner: pytest
build_name: ${{ github.run_id }}-${{ github.job }}
test_session_name: ${{ github.run_id }}-${{ github.job }}-${{ matrix.os }}-${{ env.python_version }}
flavors: 'build_name=true, test_session_name=true, flavors=true, count=2, python_version=${{ matrix.python_version }}, os=${{ matrix.os }}'
if: always()
7 changes: 7 additions & 0 deletions launchable-test-result/test-results.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<testsuites>
<testsuite name="pytest" launchable_subset_command="launchable subset --build f1fab5c --target 30% pytest" launchable_subset_input="pytest/tests/test_func5.py::test_func5[3+5-8],pytest/tests/test_func5.py::test_func5[2+4-6],pytest/tests/test_func5.py::test_func5[6*9-54],pytest/tests/test_func5.py::test_foo[2-0],pytest/tests/test_func5.py::test_foo[2-1],pytest/tests/test_func5.py::test_foo[3-0],pytest/tests/test_func5.py::test_foo[3-1],pytest/tests/test_funcs1.py::test_func1,pytest/tests/test_funcs1.py::test_func2,pytest/tests/test_funcs2.py::test_func3,pytest/tests/test_funcs2.py::test_func4,pytest/tests/test_mod.py::TestClass::test__can_print_aaa,pytest/tests/fooo/test_func4.py::test_func6" launchable_raw_subset_response="pytest/tests/test_funcs2.py::test_func3&#10;pytest/tests/test_func5.py::test_foo[2-0]&#10;pytest/tests/test_func5.py::test_func5[2+4-6]&#10;">
<testcase classname="pytest.tests.test_func5" name="test_func5[2+4-6]" time="0.0002689579999999303" setup_time="0.0005939169999997773" teardown_time="0.00020679100000009498" launchable_test_path="file=pytest/tests/test_func5.py#testcase=test_func5[2+4-6]" launchable_subset_category="subset"></testcase>
<testcase classname="pytest.tests.test_func5" name="test_foo[2-0]" time="1.0058546250000002" setup_time="0.00019029200000009183" teardown_time="0.0006497500000000045" launchable_test_path="file=pytest/tests/test_func5.py#testcase=test_foo[2-0]" launchable_subset_category="subset"></testcase>
<testcase classname="pytest.tests.test_funcs2" name="test_func3" time="9.187500000007454e-05" setup_time="0.00023500000000020727" teardown_time="6.924999999990966e-05" launchable_test_path="file=pytest/tests/test_funcs2.py#testcase=test_func3" launchable_subset_category="subset"></testcase>
</testsuite>
</testsuites>

0 comments on commit d3c6387

Please sign in to comment.