Skip to content

Commit a76db16

Browse files
authored
Combine coverage from all CI jobs (#2553)
1 parent 328b2cd commit a76db16

File tree

3 files changed

+79
-77
lines changed

3 files changed

+79
-77
lines changed

.github/workflows/android.yml

-70
This file was deleted.

.github/workflows/ci.yml

+75-7
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,76 @@ jobs:
240240
docker stop $container_id
241241
sudo chown -R runner:runner /home/runner/libcdb-cache
242242
243+
android-test:
244+
runs-on: ubuntu-latest
245+
timeout-minutes: 30
246+
continue-on-error: true
247+
steps:
248+
- uses: actions/checkout@v4
249+
250+
- name: Set up Python 3.12
251+
uses: actions/setup-python@v5
252+
with:
253+
python-version: '3.12'
254+
cache: 'pip'
255+
cache-dependency-path: |
256+
**/pyproject.toml
257+
**/requirements*.txt
258+
259+
- name: Install Linux dependencies
260+
run: |
261+
sudo apt-get update
262+
sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \
263+
gdb gdbserver socat \
264+
qemu-user-static \
265+
binutils-aarch64-linux-gnu \
266+
binutils-arm-linux-gnueabihf \
267+
libc6-dbg
268+
269+
- name: Cache for avd
270+
uses: actions/cache@v4
271+
id: cache-avd
272+
with:
273+
path: |
274+
~/.android
275+
/usr/local/lib/android/sdk/emulator
276+
/usr/local/lib/android/sdk/platform-tools
277+
/usr/local/lib/android/sdk/system-images
278+
key: ${{ matrix.os }}-cache-avd-${{ hashFiles('travis/setup_avd*.sh') }}
279+
restore-keys: |
280+
${{ matrix.os }}-cache-avd-
281+
282+
- name: Install Android AVD
283+
run: |
284+
sudo usermod -aG kvm $USER
285+
source travis/setup_avd_fast.sh
286+
sed -i 's/skip_android = True/skip_android = False/' docs/source/conf.py
287+
set | grep ^PATH >.android.env
288+
289+
- name: Install dependencies
290+
run: |
291+
pip install --upgrade pip
292+
pip install --upgrade wheel build
293+
pip install --upgrade flake8 appdirs
294+
pip install --upgrade --editable .
295+
296+
- name: Sanity checks
297+
run: PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)'
298+
299+
- name: Install documentation dependencies
300+
run: pip install -r docs/requirements.txt
301+
302+
- name: Coverage Doctests (Android Only)
303+
run: |
304+
source .android.env
305+
PWNLIB_NOTERM=1 coverage run -m sphinx -b doctest docs/source docs/build/doctest docs/source/adb.rst
306+
307+
- uses: actions/upload-artifact@v4
308+
with:
309+
name: coverage-android
310+
path: .coverage*
311+
include-hidden-files: true
312+
243313
windows-test:
244314
runs-on: windows-latest
245315
timeout-minutes: 30
@@ -269,13 +339,11 @@ jobs:
269339
run: |
270340
python -bb -m coverage run -m sphinx -b doctest docs/source docs/build/doctest
271341
272-
# FIXME: Paths are broken when uploading coverage on ubuntu
273-
# coverage.exceptions.NoSource: No source for code: '/home/runner/work/pwntools/pwntools/D:\a\pwntools\pwntools\pwn\__init__.py'.
274-
# - uses: actions/upload-artifact@v4
275-
# with:
276-
# name: coverage-windows
277-
# path: .coverage*
278-
# include-hidden-files: true
342+
- uses: actions/upload-artifact@v4
343+
with:
344+
name: coverage-windows
345+
path: .coverage*
346+
include-hidden-files: true
279347

280348
upload-coverage:
281349
runs-on: ubuntu-latest

pyproject.toml

+4
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,7 @@ source = [
8484
"~/.cache/.pwntools-cache-3.13/",
8585
]
8686
disable_warnings = ["module-not-imported"]
87+
88+
[tool.coverage.paths]
89+
pwnlib = ["pwnlib", "*/pwntools/pwnlib", "*\\pwntools\\pwnlib"]
90+
pwn = ["pwn", "*/pwntools/pwn", "*\\pwntools\\pwn"]

0 commit comments

Comments
 (0)