forked from sigma67/ytmusicapi
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (66 loc) · 2.31 KB
/
Copy pathcoverage.yml
File metadata and controls
69 lines (66 loc) · 2.31 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
name: Code coverage
on:
push:
branches:
- main
paths:
- ytmusicapi/**
- tests/**
pull_request_target:
paths:
- ytmusicapi/**
- tests/**
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
# For pull_request_target events, requires maintainer approval via the
# 'coverage' environment before the job runs and secrets are exposed.
# Configure in Settings → Environments → coverage → Required reviewers.
# Enable "Prevent administrators from bypassing configured protection rules"
# to enforce this for admins too.
environment: ${{ github.event_name != 'push' && 'coverage' || '' }}
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
fetch-depth: 1
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
- name: Setup PDM
uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4.4
- name: Write OAuth credentials
env:
OAUTH_JSON: ${{ secrets.OAUTH_JSON }}
run: printf '%s\n' "$OAUTH_JSON" > tests/oauth.json
- name: Install dependencies
run: pdm install
- name: Generate coverage report
env:
HEADERS_AUTH: ${{ secrets.HEADERS_AUTH }}
TEST_CFG: ${{ secrets.TEST_CFG }}
run: |
curl -fsSL -o tests/test.mp3 https://www.kozco.com/tech/piano2-CoolEdit.mp3
cat <<< "$HEADERS_AUTH" > tests/browser.json
cat <<< "$TEST_CFG" > tests/test.cfg
pdm run pytest --junitxml=test-results.xml
pdm run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
if: ${{ !cancelled() }}
with:
flags: unittests
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: test-results.xml