-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (47 loc) · 1.71 KB
/
check.yml
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
name: Code check
on:
pull_request:
push:
branches:
- main
jobs:
Check:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install -r requirements/dev.txt --upgrade pip
- name: Run codecheck
run: bash scripts/codecheck.sh
- name: Run tests
run: bash -x scripts/run_tests.sh
- name: Post coverage check
if: github.event_name == 'pull_request'
run: |
coverage=$(python scripts/extract_coverage.py)
pr_number=$(jq --raw-output .number "$GITHUB_EVENT_PATH")
repo_full_name=$(jq --raw-output .repository.full_name "$GITHUB_EVENT_PATH")
check_run_url=$(curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/json" \
-d '{"name": "Coverage Report", "head_sha": "'"$GITHUB_SHA"'", "status": "completed", "conclusion": "success", "output": {"title": "Coverage Report", "summary": "Coverage: '"$coverage"'%"}}' \
"https://api.github.com/repos/$repo_full_name/check-runs" | jq -r .url)
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: always() # always run even if the previous step fails
with:
report_paths: 'reports/junit.xml'
check_name: tests
- name: Archive reports
if: always()
uses: actions/upload-artifact@v4
with:
name: reports
path: reports