Skip to content

Commit 5531e09

Browse files
committed
record and report code coverage in macosx jobs
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
1 parent d76ecd9 commit 5531e09

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/macosx.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,29 @@ jobs:
1616
run: |
1717
pip install --upgrade pip setuptools wheel
1818
brew install libxml2 libxmlsec1 pkg-config
19+
- name: Build macosx_x86_64 wheel
20+
run: |
21+
python setup.py bdist_wheel
1922
- name: Set environment variables
2023
shell: bash
2124
run: |
2225
echo ::set-env name=PKGVER::$(python setup.py --version)
23-
- name: Build macosx_x86_64 wheel
24-
run: |
25-
python setup.py bdist_wheel
26+
echo ::set-env name=LLVM_PROFILE_FILE::"pyxmlsec-%p.profraw"
2627
- name: Install test dependencies
28+
env:
29+
CC: clang
30+
CFLAGS: "-fprofile-instr-generate -fcoverage-mapping"
31+
LDFLAGS: "-fprofile-instr-generate -fcoverage-mapping"
2732
run: |
28-
pip install --upgrade -r requirements-test.txt
29-
pip install xmlsec --only-binary=xmlsec --no-index --find-links=dist/
33+
rm -rf build/
34+
pip install coverage --upgrade -r requirements-test.txt
35+
pip install --editable .
3036
- name: Run tests
3137
run: |
32-
pytest -v --color=yes
38+
coverage run -m pytest -v --color=yes
39+
- name: Report coverage to codecov
40+
run: |
41+
LIBFILE=$(python -c "import xmlsec; print(xmlsec.__file__)")
42+
/Library/Developer/CommandLineTools/usr/bin/llvm-profdata merge -sparse pyxmlsec-*.profraw -output pyxmlsec.profdata
43+
/Library/Developer/CommandLineTools/usr/bin/llvm-cov show ${LIBFILE} -instr-profile=pyxmlsec.profdata src > coverage.txt
44+
bash <(curl -s https://codecov.io/bash) -f coverage.txt

0 commit comments

Comments
 (0)