@@ -28,20 +28,30 @@ permissions:
2828
2929jobs :
3030 test :
31- runs-on : ubuntu-24.04
31+ name : " Unit Tests (py${{ matrix.python-version }}, ${{ matrix.runs-on }})"
32+
33+ strategy :
34+ matrix :
35+ python-version : ["3.11"]
36+ runs-on : [ubuntu-24.04]
37+ runs-on : ${{matrix.runs-on}}
38+ defaults :
39+ run :
40+ shell : bash
3241 env :
3342 PIP_CACHE_DIR : " ${{ github.workspace }}/.pip-cache"
3443
3544 steps :
36- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+ - uses : actions/checkout@v5
3746
3847 - name : Set up Python
39- uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
48+ id : setup_python
49+ uses : actions/setup-python@v6
4050 with :
41- python-version : ' 3.10.12 '
51+ python-version : ${{matrix.python-version}}
4252
43- - name : Cache pip
44- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
53+ - name : Cache pip packages
54+ uses : actions/cache@v4
4555 id : cache-pip
4656 with :
4757 path : ${{ env.PIP_CACHE_DIR }}
6171 -e sharktuner/
6272 pip freeze
6373
74+ - name : Run mypy type checker
75+ run : mypy sharktuner --python-version ${{ matrix.python-version }}
76+
6477 - name : Run sharktuner tests with coverage
78+ if : ${{ !cancelled() }}
6579 run : |
6680 pytest sharktuner/ \
6781 --cov=sharktuner \
@@ -72,17 +86,46 @@ jobs:
7286 COVERAGE_FILE : .coverage.sharktuner
7387
7488 - name : Upload coverage data
75- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
89+ if : runner.os != 'Windows'
90+ uses : actions/upload-artifact@v4
7691 with :
7792 name : coverage-data-sharktuner
7893 path : .coverage.sharktuner
7994 include-hidden-files : true
8095
8196 - name : Upload sharktuner coverage to Codecov
82- if : ${{ github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
83- uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
97+ if : ${{ github.event_name == 'pull_request' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
98+ uses : codecov/codecov-action@v5
8499 with :
85100 files : sharktuner-cov.xml
86101
87- - name : Run mypy type checker
88- run : mypy sharktuner --python-version 3.11
102+ coverage :
103+ name : Coverage
104+ runs-on : ubuntu-24.04
105+ needs : test
106+ permissions :
107+ pull-requests : write
108+ contents : write
109+ actions : read
110+ steps :
111+ - uses : actions/checkout@v5
112+ - uses : actions/download-artifact@v5
113+ id : download
114+ with :
115+ name : coverage-data-sharktuner
116+
117+ - name : Coverage comment
118+ id : coverage_comment
119+ uses : py-cov-action/python-coverage-comment-action@v3
120+ with :
121+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122+ MERGE_COVERAGE_FILES : true
123+ MINIMUM_GREEN : 90
124+ MINIMUM_ORANGE : 70
125+
126+ - name : Store Pull Request comment to be posted
127+ uses : actions/upload-artifact@v4
128+ if : steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
129+ with :
130+ name : python-coverage-comment-action
131+ path : python-coverage-comment-action.txt
0 commit comments