Skip to content

Commit

Permalink
init gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
robbrad committed Jan 3, 2025
1 parent 2554e6e commit b484229
Show file tree
Hide file tree
Showing 330 changed files with 19 additions and 41,471 deletions.
94 changes: 19 additions & 75 deletions .github/workflows/behave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,117 +164,61 @@ jobs:
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 only for the full report
- name: Get Allure history - Full Report
if: github.event_name == 'schedule' || github.event_name == 'push'
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/allure-full-history

# 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
if: github.event_name == 'schedule' || github.event_name == 'push'
with:
allure_results: build/${{ matrix.python-version }}/allure-results
allure_history: allure-history/full
subfolder: ${{ matrix.python-version }}
allure_history: gh-pages/allure-full-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 }}
if: github.event_name == 'schedule' || github.event_name == 'push'
run: tar -cvf allure_full_history_${{ matrix.python-version }}.tar gh-pages/allure-full-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
if: github.event_name == 'schedule' || github.event_name == 'push'
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

deploy:
name: Deploy Reports
runs-on: ubuntu-latest
needs: report
if: 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
# 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
# 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
run: for i in allure-history/tars/full/*.tar; do tar -xvf "$i" -C allure-history/full; done

# 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
# Deploy everything to gh-pages
- name: Deploy
# Deploy the Full Report to GH Pages
- name: Deploy Full Report
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history
publish_dir: allure-history/full
Loading

0 comments on commit b484229

Please sign in to comment.