Skip to content

Commit

Permalink
fix: Update behave.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
robbrad authored Jan 3, 2025
1 parent 2554e6e commit 7c26dcd
Showing 1 changed file with 26 additions and 81 deletions.
107 changes: 26 additions & 81 deletions .github/workflows/behave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,127 +154,72 @@ jobs:
run: make matrix=${{ matrix.python-version }} councils="${{ env.COUNCIL_TESTS }}" integration-tests
continue-on-error: true

# Only generate and upload Allure reports on schedule
report:
name: Generate and Upload Reports
needs: [unit-tests, parity-check, integration-tests]
runs-on: ubuntu-latest
if: github.event_name == 'schedule' # only run this job on schedule
strategy:
matrix:
python-version: [3.12]
steps:
- uses: actions/checkout@v4

# Fetch existing gh-pages to preserve history if on master branch and it's a push or schedule
- name: Get Existing History
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'schedule')
# Fetch Allure history for the full report (optional)
- name: Get Allure history - Full Report
uses: actions/checkout@v4
continue-on-error: true
with:
ref: gh-pages
path: allure-history
continue-on-error: true

# If PR doesn't need existing history, we can skip fetching. If you do want partial history across PRs,
# you could add another condition for pull_request here.
path: gh-pages

# Generate Full Run Allure Reports (push/schedule on master)
# Generate Allure Reports (Full)
- name: Allure report action for Full Run
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master'
uses: simple-elf/allure-report-action@master
with:
allure_results: build/${{ matrix.python-version }}/allure-results
allure_history: allure-history/full
subfolder: ${{ matrix.python-version }}
allure_history: allure-history
keep_reports: 20

# Generate Partial Run Allure Reports (pull_request)
- name: Allure report action for Partial Run
if: github.event_name == 'pull_request'
uses: simple-elf/allure-report-action@master
with:
allure_results: build/${{ matrix.python-version }}/allure-results
allure_history: allure-history/partial
keep_reports: 20

# Archive Full Reports
# Archive the Full Report
- name: Tar full report
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master'
run: tar -cvf allure_full_history_${{ matrix.python-version }}.tar allure-history/full/${{ matrix.python-version }}

# Archive Partial Reports
- name: Tar partial report
if: github.event_name == 'pull_request'
run: tar -cvf allure_partial_history_${{ matrix.python-version }}.tar allure-history/partial/${{ matrix.python-version }}
run: tar -cvf allure_full_history_${{ matrix.python-version }}.tar allure-history/${{ matrix.python-version }}

# Upload artifacts
# Upload the Full Report artifact
- name: Upload artifact for Full Report
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: allure_full_history_${{ matrix.python-version }}
path: allure_full_history_${{ matrix.python-version }}.tar

- name: Upload artifact for Partial Report
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: allure_partial_history_${{ matrix.python-version }}
path: allure_partial_history_${{ matrix.python-version }}.tar
name: allure_history_${{ matrix.python-version }}
path: allure_history_${{ matrix.python-version }}.tar

# Deploy only on schedule + master branch
deploy:
name: Deploy Reports
runs-on: ubuntu-latest
needs: report
if: github.ref == 'refs/heads/master'
if: github.event_name == 'schedule' && github.ref == 'refs/heads/master'
steps:
# Download Full Artifacts (push/schedule)
# Download Full Artifacts
- uses: actions/download-artifact@v4
name: Download Full Artifacts
if: github.event_name == 'push' || github.event_name == 'schedule'
with:
name: allure_full_history_3.12
path: allure-history/tars/full

# Download Partial Artifacts (pull_request)
- uses: actions/download-artifact@v4
name: Download Partial Artifacts
if: github.event_name == 'pull_request'
with:
name: allure_partial_history_3.12
path: allure-history/tars/partial

# Create directories if needed
- name: Create Full / Partial dirs
run: |
mkdir -p allure-history/full allure-history/partial
path: allure-history/tars

# Untar Full Reports
- name: Untar Full Reports
if: github.event_name == 'push' || github.event_name == 'schedule'
run: |
shopt -s nullglob
for i in allure-history/tars/full/*.tar; do tar -xvf "$i" -C allure-history/full; done
- name: Untar reports
run: for i in allure-history/tars/*.tar; do tar -xvf "$i" allure-history ;done

# Untar Partial Reports
- name: Untar Partial Reports
if: github.event_name == 'pull_request'
run: |
shopt -s nullglob
for i in allure-history/tars/partial/*.tar; do tar -xvf "$i" -C allure-history/partial; done
# Remove Tar Reports
- name: Remove Tar Reports
- name: Remove tar reports
run: rm -rf allure-history/tars

# Ensure not empty
- name: Ensure not empty
run: |
if [ ! "$(ls -A allure-history)" ]; then
touch allure-history/.placeholder
fi
- name: Display structure of downloaded files
run: ls -R

# Deploy everything to gh-pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history

0 comments on commit 7c26dcd

Please sign in to comment.