Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
11 changes: 11 additions & 0 deletions .allurerc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
name: "Allure Python",
output: "./out/allure-report",
plugins: {
testops: {
options: {
launchName: `Allure Python GitHub actions run (${new Date().toISOString()})`,
},
},
},
};
80 changes: 78 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.changes }}
matrix: ${{ steps.matrix.outputs.matrix }}
count: ${{ steps.matrix.outputs.count }}
steps:
- uses: dorny/paths-filter@v3
id: filter
Expand Down Expand Up @@ -108,6 +110,7 @@ jobs:
env:
TEST_TMP: /tmp
ALLURE_INDENT_OUTPUT: yep
ALLURE_TEST_DUMP_NAME: allure-results-test-${{ matrix.python-version }}-pytest-${{ matrix.pytest-version }}
steps:
- uses: actions/checkout@v4

Expand All @@ -116,6 +119,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- uses: actions/setup-node@v6
with:
node-version: '20.x'

- name: Normalize ALLURE_MATRIX_ENV
run: |
value="ubuntu-python-${{ matrix.python-version }}-pytest-${{ matrix.pytest-version }}"
value="${value//./_}"
echo "ALLURE_MATRIX_ENV=${value//\*/x}" >> "$GITHUB_ENV"

- name: Install packages
run: |
pip install ./allure-python-commons \
Expand All @@ -127,13 +140,20 @@ jobs:

- name: Test allure-pytest
working-directory: allure-pytest
run: poe tests
run: npx -y allure@3 run --config ../.allurerc.mjs --rerun 2 --environment="${{ env.ALLURE_MATRIX_ENV }}" --dump="${{ env.ALLURE_TEST_DUMP_NAME }}" -- poe tests
Comment thread
epszaw marked this conversation as resolved.
Outdated

- name: Upload report
uses: actions/upload-artifact@v7
with:
name: ${{ env.ALLURE_TEST_DUMP_NAME }}
path: ./${{ env.ALLURE_TEST_DUMP_NAME }}.zip
retention-days: 1

test-others:
name: Test other packages
runs-on: ubuntu-latest
needs: [other-changes]
if: ${{ needs.other-changes.outputs.packages != '[]' }}
if: ${{ needs.other-changes.outputs.count != '0' }}
strategy:
matrix:
package: ${{ fromJSON(needs.other-changes.outputs.packages) }}
Expand All @@ -143,6 +163,7 @@ jobs:
env:
TEST_TMP: /tmp
ALLURE_INDENT_OUTPUT: yep
ALLURE_TEST_DUMP_NAME: allure-results-test-${{ matrix.package }}-python-${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4

Expand All @@ -151,6 +172,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- uses: actions/setup-node@v6
with:
node-version: '20.x'

- name: Normalize ALLURE_MATRIX_ENV
run: |
value="ubuntu-package-${{ matrix.package }}-python-${{ matrix.python-version }}"
value="${value//./_}"
echo "ALLURE_MATRIX_ENV=${value//\*/x}" >> "$GITHUB_ENV"

- name: Install packages
run: |
pip install ./allure-python-commons \
Expand All @@ -162,3 +193,48 @@ jobs:
- name: Test ${{ matrix.package }}
working-directory: ${{ matrix.package }}
run: poe tests
Comment thread
epszaw marked this conversation as resolved.
Outdated

- name: Upload report
uses: actions/upload-artifact@v7
with:
name: ${{ env.ALLURE_TEST_DUMP_NAME }}
path: ./${{ env.ALLURE_TEST_DUMP_NAME }}.zip
retention-days: 1

report:
needs: [test-pytest, test-others]
name: Build Allure report
runs-on: ubuntu-latest
if: always()
permissions:
contents: read
pull-requests: write
checks: write
env:
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
ALLURE_ENDPOINT: ${{ secrets.ALLURE_ENDPOINT }}
ALLURE_PROJECT_ID: ${{ secrets.ALLURE_PROJECT_ID }}
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v6
with:
node-version: '20.x'

- name: Download Allure dumps
uses: actions/download-artifact@v8
continue-on-error: true
with:
pattern: allure-results-*
path: ./
merge-multiple: true

- name: Generate Allure report
run: npx -y allure@3 generate --config ./.allurerc.mjs --dump="allure-results-*.zip" --output=./out/allure-report

- name: Post Allure summary
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
uses: allure-framework/allure-action@v0
with:
report-directory: ./out/allure-report
github-token: ${{ secrets.GITHUB_TOKEN }}
Loading