-
Notifications
You must be signed in to change notification settings - Fork 99
50 lines (50 loc) · 2.1 KB
/
macosx.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: MacOS
on: [push, pull_request]
jobs:
macosx:
runs-on: macos-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
static_deps: ["static", ""]
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install build dependencies
run: |
pip install --upgrade pip setuptools wheel build
brew install libxml2 libxmlsec1 pkg-config
- name: Build macosx_x86_64 wheel
env:
CC: clang
CFLAGS: "-fprofile-instr-generate -fcoverage-mapping"
LDFLAGS: "-fprofile-instr-generate -fcoverage-mapping"
PYXMLSEC_STATIC_DEPS: ${{ matrix.static_deps }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PKG_CONFIG_PATH="$(brew --prefix)/opt/libxml2/lib/pkgconfig"
python -m build
rm -rf build/
- name: Set environment variables
shell: bash
run: |
echo "PKGVER=$(python setup.py --version)" >> $GITHUB_ENV
echo "LLVM_PROFILE_FILE=pyxmlsec.profraw" >> $GITHUB_ENV
- name: Install test dependencies
run: |
export PKG_CONFIG_PATH="$(brew --prefix)/opt/libxml2/lib/pkgconfig"
pip install coverage --upgrade --no-binary=lxml -r requirements-test.txt
pip install xmlsec --only-binary=xmlsec --no-index --find-links=dist/
echo "PYXMLSEC_LIBFILE=$(python -c 'import xmlsec; print(xmlsec.__file__)')" >> $GITHUB_ENV
- name: Run tests
run: |
coverage run -m pytest -v --color=yes
- name: Report coverage to codecov
run: |
/Library/Developer/CommandLineTools/usr/bin/llvm-profdata merge -sparse ${{ env.LLVM_PROFILE_FILE }} -output pyxmlsec.profdata
/Library/Developer/CommandLineTools/usr/bin/llvm-cov show ${{ env.PYXMLSEC_LIBFILE }} --arch=$(uname -m) --instr-profile=pyxmlsec.profdata src > coverage.txt
bash <(curl -s https://codecov.io/bash) -f coverage.txt
if: matrix.static_deps != 'static'