-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (79 loc) · 2.98 KB
/
ci.yml
File metadata and controls
95 lines (79 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI & Test Report
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Best Practice: Prevent race conditions on the gh-pages branch
concurrency:
group: "pages"
cancel-in-progress: true
# These permissions are required for the actions to post comments and push to the gh-pages branch
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install Poetry
run: pipx install poetry
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
- name: Install Allure Commandline
run: |
wget https://github.com/allure-framework/allure2/releases/download/2.29.0/allure-2.29.0.tgz
sudo tar -zxvf allure-2.29.0.tgz -C /opt/
sudo ln -s /opt/allure-2.29.0/bin/allure /usr/bin/allure
allure --version
- name: Run CI Pipeline (Lint, Typecheck, Test)
# This runs all checks and generates the raw 'allure-results'
run: poetry run task ci
- name: Check out gh-pages branch for history
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
ref: gh-pages
# Checkout to a specific path
path: gh-pages
- name: Copy history from previous report
run: |
# This command enables the history trend graph in the new report
cp -r gh-pages/history test/allure-results/ || echo "No history found on first run."
- name: Create CI report metadata
run: |
# This creates the executor.json for clickable history links
echo '{"name": "GitHub Actions", "type": "github", "buildName": "Run #${{ github.run_number }}", "buildUrl": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", "reportUrl": "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"}' > ./test/allure-results/executor.json
- name: Build Allure Report
# This calls your new 'report_ci' task
run: poetry run task report_ci
- name: Set up Pages
# This action prepares the artifact for deployment
uses: actions/configure-pages@v5
- name: Upload artifact
# This action uploads the report as a Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: './test/allure-report'
# This job deploys the report
deploy:
# It requires the 'build' job to finish successfully
needs: build
# Only run this job on pushes to the main branch
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4