-
Notifications
You must be signed in to change notification settings - Fork 75
80 lines (64 loc) · 2.29 KB
/
publisher_coverage.yaml
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
name: Publisher Coverage
on:
schedule:
- cron: '0 14 * * *' # Runs at 14:00
workflow_dispatch:
jobs:
validate_crawlers:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install Fundus
run: pip install -e .
- name: Validate Crawlers
env:
PYTHONPATH: .
run: |
set -o pipefail
exec python scripts/publisher_coverage.py | tee publisher_coverage.txt
- name: Upload Coverage Report
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: Publisher Coverage
path: publisher_coverage.txt
create_badge:
runs-on: ubuntu-latest
needs: validate_crawlers
if: success() || failure()
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Download Coverage Report
uses: actions/download-artifact@v4
with:
name: Publisher Coverage
- name: Get Success Rate
run: echo "SUCCESS_RATE=$(tail -n 1 publisher_coverage.txt | grep -P -o '\d+\/\d+')" >> $GITHUB_ENV
- name: Get Coverage Bounds
run: |
echo "TOTAL_PUBLISHERS=$(echo ${{ env.SUCCESS_RATE }} | grep -P -o '\d+' | tail -1)" >> $GITHUB_ENV
echo "PASSED_PUBLISHERS=$(echo ${{ env.SUCCESS_RATE }} | grep -P -o '\d+' | head -1)" >> $GITHUB_ENV
- name: Get Red Threshold
# We set the badge colour to red when at least one publisher failed the tests.
run: echo "RED_THRESHOLD=$(( ${{ env.TOTAL_PUBLISHERS }} - 1 ))" >> $GITHUB_ENV
- name: Create Badge
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.DOBBERSC_GIST_SECRET }}
gistID: ca0ae056b05cbfeaf30fa42f84ddf458
filename: fundus_publisher_coverage.json
label: Publisher Coverage
message: ${{ env.SUCCESS_RATE }}
valColorRange: ${{ env.PASSED_PUBLISHERS }}
maxColorRange: ${{ env.TOTAL_PUBLISHERS }}
minColorRange: ${{ env.RED_THRESHOLD }}