Skip to content

Commit 1da5c77

Browse files
committed
Updated test workflow
Running QA, then tests on a handful of targets and getting coverage
1 parent 518392d commit 1da5c77

1 file changed

Lines changed: 14 additions & 54 deletions

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ name: test
22
on: [push]
33

44
env:
5-
LIBZIM_VERSION: 8.1.0
6-
LIBZIM_INCLUDE_PATH: include/zim
5+
# TODO: use a release (once available)
6+
CIBW_ENVIRONMENT: "LIBZIM_DL_VERSION=2023-04-14"
77
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8-
PROFILE: 1
98

109
jobs:
1110
lint:
@@ -16,7 +15,7 @@ jobs:
1615
- name: Set up Python ${{ matrix.python }}
1716
uses: actions/setup-python@v4.2.0
1817
with:
19-
python-version: "3.10"
18+
python-version: "3.11"
2019
architecture: x64
2120

2221
- name: Check formatting and linting
@@ -29,7 +28,7 @@ jobs:
2928
runs-on: ${{ matrix.os }}
3029
strategy:
3130
matrix:
32-
os: [ubuntu-20.04, macos-12]
31+
os: [ubuntu-22.04, macos-12]
3332
python: ["3.6.15", "3.7", "3.8", "3.9", "3.10", "3.11"]
3433

3534
steps:
@@ -41,60 +40,21 @@ jobs:
4140
python-version: ${{ matrix.python }}
4241
architecture: x64
4342

44-
- name: set macOS environ
45-
if: matrix.os == 'macos-12'
46-
run: |
47-
echo LIBZIM_EXT=dylib >> $GITHUB_ENV
48-
echo LIBZIM_RELEASE=libzim_macos-x86_64-$LIBZIM_VERSION >> $GITHUB_ENV
49-
echo LIBZIM_LIBRARY_PATH=lib/libzim.8.dylib >> $GITHUB_ENV
50-
51-
- name: set linux environ
52-
if: matrix.os == 'ubuntu-20.04'
53-
run: |
54-
echo LIBZIM_EXT=so >> $GITHUB_ENV
55-
echo LIBZIM_RELEASE=libzim_linux-x86_64-$LIBZIM_VERSION >> $GITHUB_ENV
56-
echo LIBZIM_LIBRARY_PATH=lib/x86_64-linux-gnu/libzim.so.$LIBZIM_VERSION >> $GITHUB_ENV
57-
58-
- name: Cache libzim dylib & headers
59-
uses: actions/cache@v3.0.11
60-
id: cache-libzim
61-
with:
62-
path: libzim_dist
63-
key: ${{ env.LIBZIM_RELEASE }}-libzim-cache
64-
65-
- name: Download libzim dylib & headers from OpenZIM.org releases
66-
if: steps.cache-libzim.outputs.cache-hit != 'true'
67-
run: |
68-
wget -q https://download.openzim.org/release/libzim/$LIBZIM_RELEASE.tar.gz
69-
tar --extract --file=$LIBZIM_RELEASE.tar.gz
70-
mv $LIBZIM_RELEASE libzim_dist
71-
72-
- name: Link libzim dylib & headers into workspace lib and include folders
73-
run: |
74-
cp -p $GITHUB_WORKSPACE/libzim_dist/$LIBZIM_LIBRARY_PATH lib/libzim.$LIBZIM_EXT
75-
cp -p $GITHUB_WORKSPACE/libzim_dist/$LIBZIM_LIBRARY_PATH lib/
76-
ln -s $GITHUB_WORKSPACE/libzim_dist/$LIBZIM_INCLUDE_PATH include/zim
77-
export LD_LIBRARY_PATH="$PWD/lib:$LD_LIBRARY_PATH"
43+
- name: Installing dependencies
44+
run: pip install -U pip setuptools build
7845

79-
- name: update Linux shared objects cache
80-
if: matrix.os == 'ubuntu-20.04'
81-
run: |
82-
sudo ldconfig $PWD/lib
83-
84-
- name: Build cython, sdist, and bdist_wheel
85-
run: |
86-
pip install --upgrade pip install "cython>=0.29.32,<3.0" setuptools pip wheel
87-
python3 setup.py build_ext --inplace
88-
python3 setup.py sdist bdist_wheel
46+
- name: Building & installing for tests (with profiling)
47+
env:
48+
PROFILE: 1
49+
run: pip install -e .
8950

90-
- name: Test built package with pytest
51+
- name: Testing
9152
run: |
92-
pip install pytest pytest-cov
93-
pip install -e .
94-
export DYLD_LIBRARY_PATH="$PWD:$PWD/lib:$DYLD_LIBRARY_PATH"
95-
pytest --cov=libzim --cov-report=term --cov-report term-missing .
53+
pip install pytest pytest-cov cython
54+
py.test --cov=libzim --cov-report=term --cov-report term-missing .
9655
9756
- name: Upload coverage report to codecov
57+
if: matrix.os == 'ubuntu-22.04' && matrix.python == '3.11'
9858
run: |
9959
pip install codecov
10060
codecov

0 commit comments

Comments
 (0)