4444 code-quality :
4545 name : Code Quality
4646
47- runs-on : ubuntu-latest
47+ runs-on : linux- ubuntu-latest
4848 timeout-minutes : 10
4949
5050 strategy :
6868 unit :
6969 name : unit test / python ${{ matrix.python-version }}
7070
71- runs-on : ubuntu-latest
72- timeout-minutes : 10
71+ runs-on : linux-ubuntu-latest
72+ timeout-minutes : 15
73+
74+ permissions :
75+ # Gives the action the necessary permissions for publishing new
76+ # comments in pull requests.
77+ pull-requests : write
78+ # Gives the action the necessary permissions for pushing data to the
79+ # python-coverage-comment-action branch, and for editing existing
80+ # comments (to avoid publishing multiple comments in the same PR)
81+ contents : write
7382
7483 strategy :
7584 fail-fast : false
@@ -88,12 +97,26 @@ jobs:
8897 - name : Install Hatch
8998 uses : pypa/hatch@install
9099
91- - name : Run Unit Tests
92- run : hatch run -v +py=${{ matrix.python-version }} test:unit
100+ - name : Run Unit Tests and Generate Coverage
101+ run : hatch run -v +py=${{ matrix.python-version }} test:unit-with-cov
102+
103+ # Only run coverage comment once (not for all python versions)
104+ - name : Coverage Comment
105+ if : matrix.python-version == '3.12' && github.event_name == 'pull_request'
106+ uses : py-cov-action/python-coverage-comment-action@v3
107+ with :
108+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
109+
110+ - name : Store Pull Request comment to be posted
111+ uses : actions/upload-artifact@v4
112+ if : steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
113+ with :
114+ name : python-coverage-comment-action
115+ path : python-coverage-comment-action.txt
93116
94117 build :
95118 name : Build and Verify Packages
96- runs-on : ubuntu-latest
119+ runs-on : linux- ubuntu-latest
97120
98121 steps :
99122 - name : Check out the repository
0 commit comments