|
18 | 18 |
|
19 | 19 | base-tests:
|
20 | 20 | runs-on: ubuntu-22.04
|
| 21 | + env: |
| 22 | + COVERAGE_FILE: ".coverage.base" |
21 | 23 | steps:
|
22 | 24 | - uses: actions/setup-python@v5
|
23 | 25 | with:
|
@@ -53,13 +55,20 @@ jobs:
|
53 | 55 | with:
|
54 | 56 | name: base-tests-coverage-results
|
55 | 57 | path: |
|
56 |
| - .coverage |
| 58 | + .coverage* |
57 | 59 | coverage-html
|
58 | 60 | coverage.json
|
| 61 | + include-hidden-files: true |
59 | 62 | retention-days: 5
|
| 63 | + - name: "Report coverage" |
| 64 | + if: (success() || failure()) && inputs.code_coverage |
| 65 | + run: | |
| 66 | + coverage report --data-file="$COVERAGE_FILE" --skip-empty --format="markdown" > "$GITHUB_STEP_SUMMARY" |
60 | 67 |
|
61 | 68 | pytorch-tests:
|
62 | 69 | runs-on: ubuntu-22.04
|
| 70 | + env: |
| 71 | + COVERAGE_FILE: ".coverage.pytorch" |
63 | 72 | steps:
|
64 | 73 | - uses: actions/setup-python@v5
|
65 | 74 | with:
|
@@ -96,14 +105,20 @@ jobs:
|
96 | 105 | with:
|
97 | 106 | name: pytorch-tests-coverage-results
|
98 | 107 | path: |
|
99 |
| - .coverage |
| 108 | + .coverage* |
100 | 109 | coverage-html
|
101 | 110 | coverage.json
|
| 111 | + include-hidden-files: true |
102 | 112 | retention-days: 5
|
103 |
| - |
| 113 | + - name: "Report coverage" |
| 114 | + if: (success() || failure()) && inputs.code_coverage |
| 115 | + run: | |
| 116 | + coverage report --data-file="$COVERAGE_FILE" --skip-empty --format="markdown" > "$GITHUB_STEP_SUMMARY" |
104 | 117 |
|
105 | 118 | compat-pytorch-1_9-pytorch-tests:
|
106 | 119 | runs-on: ubuntu-22.04
|
| 120 | + env: |
| 121 | + COVERAGE_FILE: ".coverage.compat-pytorch-1.9" |
107 | 122 | steps:
|
108 | 123 | - uses: actions/setup-python@v5
|
109 | 124 | with:
|
@@ -139,8 +154,60 @@ jobs:
|
139 | 154 | uses: actions/upload-artifact@v4
|
140 | 155 | with:
|
141 | 156 | name: compat-pytorch-tests-coverage-results
|
| 157 | + path: | |
| 158 | + .coverage* |
| 159 | + coverage-html |
| 160 | + coverage.json |
| 161 | + include-hidden-files: true |
| 162 | + retention-days: 5 |
| 163 | + - name: "Report coverage" |
| 164 | + if: (success() || failure()) && inputs.code_coverage |
| 165 | + run: | |
| 166 | + coverage report --data-file="$COVERAGE_FILE" --skip-empty --format="markdown" > "$GITHUB_STEP_SUMMARY" |
| 167 | +
|
| 168 | + combine-coverage: |
| 169 | + runs-on: ubuntu-22.04 |
| 170 | + needs: [base-tests, pytorch-tests, compat-pytorch-1_9-pytorch-tests] |
| 171 | + if: (success() || failure()) && inputs.code_coverage |
| 172 | + steps: |
| 173 | + - name: "Checkout llm-compressor" |
| 174 | + uses: actions/checkout@v4 |
| 175 | + |
| 176 | + - name: "Download coverage artifacts" |
| 177 | + uses: actions/download-artifact@v4 |
| 178 | + with: |
| 179 | + merge-multiple: true |
| 180 | + |
| 181 | + - uses: actions/setup-python@v5 |
| 182 | + with: |
| 183 | + python-version: '3.12' |
| 184 | + |
| 185 | + - name: "Install dependencies" |
| 186 | + run: | |
| 187 | + pip3 install -U pip setuptools |
| 188 | + pip3 install coverage setuptools-scm |
| 189 | + make build # need to build to generate the version.py file |
| 190 | +
|
| 191 | + - name: "Combine and report coverage" |
| 192 | + run: | |
| 193 | + cat << EOF > .coveragerc |
| 194 | + [paths] |
| 195 | + source = |
| 196 | + src/ |
| 197 | + */site-packages/ |
| 198 | + EOF |
| 199 | + coverage combine |
| 200 | + coverage report --skip-empty --format="markdown" >> "$GITHUB_STEP_SUMMARY" |
| 201 | + coverage html --directory coverage-html |
| 202 | + coverage json -o coverage.json |
| 203 | +
|
| 204 | + - name: "Upload coverage report" |
| 205 | + uses: actions/upload-artifact@v4 |
| 206 | + with: |
| 207 | + name: combined-coverage-results |
142 | 208 | path: |
|
143 | 209 | .coverage
|
144 | 210 | coverage-html
|
145 | 211 | coverage.json
|
| 212 | + include-hidden-files: true |
146 | 213 | retention-days: 5
|
0 commit comments