Skip to content

Commit

Permalink
CI: fix tests for macos & ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk committed Sep 11, 2024
1 parent 0de85c7 commit 7ff3c10
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 71 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -48,22 +48,14 @@ jobs:
if: steps.cache-pango.outputs.cache-hit != 'true'
run: |
source packing/build_pango_tests.sh
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Build Project
run: python setup.py build_ext -i
- name: Run Tests
run: |
python setup.py build_ext -i
python setup.py sdist
pip install .
pytest
- name: Coverage
run: |
coverage report
coverage html
coverage xml
run: pytest -s
- uses: codecov/codecov-action@v3
with:
file: ./.coverage/coverage.xml
Expand Down
49 changes: 6 additions & 43 deletions packing/build_pango_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
# build and install pango
set -e

PANGO_VERSION=1.50.11
GLIB_VERSION=2.74.0
FRIBIDI_VERSION=1.0.10
CAIRO_VERSION=1.17.6
HARFBUZZ_VERSION=5.3.1
PANGO_VERSION=1.54.0

FILE_PATH=$PWD
PREFIX="$HOME/pangoprefix"
Expand All @@ -18,14 +14,7 @@ mkdir pango
cd pango
echo "::group::Downloading Files"

python -m pip install requests
python $FILE_PATH/packing/download_and_extract.py "http://download.gnome.org/sources/pango/${PANGO_VERSION%.*}/pango-${PANGO_VERSION}.tar.xz" pango
python $FILE_PATH/packing/download_and_extract.py "http://download.gnome.org/sources/glib/${GLIB_VERSION%.*}/glib-${GLIB_VERSION}.tar.xz" glib
python $FILE_PATH/packing/download_and_extract.py "https://github.com/fribidi/fribidi/releases/download/v${FRIBIDI_VERSION}/fribidi-${FRIBIDI_VERSION}.tar.xz" fribidi
python $FILE_PATH/packing/download_and_extract.py "https://gitlab.freedesktop.org/cairo/cairo/-/archive/${CAIRO_VERSION}/cairo-${CAIRO_VERSION}.tar.gz" cairo
python $FILE_PATH/packing/download_and_extract.py "https://github.com/harfbuzz/harfbuzz/releases/download/${HARFBUZZ_VERSION}/harfbuzz-${HARFBUZZ_VERSION}.tar.xz" harfbuzz

python -m pip uninstall -y requests

echo "::endgroup::"

Expand All @@ -37,38 +26,12 @@ echo "Installing Meson and Ninja"
pip3 install -U meson ninja
echo "::endgroup::"

echo "::group::Building and Install Glib"
meson setup --prefix=$PREFIX --buildtype=release -Dselinux=disabled -Dlibmount=disabled glib_builddir glib
meson compile -C glib_builddir
meson install -C glib_builddir
echo "::endgroup::"

echo "::group::Building and Install Fribidi"
meson setup --prefix=$PREFIX --buildtype=release fribidi_builddir fribidi
meson compile -C fribidi_builddir
meson install -C fribidi_builddir
echo "::endgroup::"

echo "::group::Building and Installing Cairo"
echo "Getting patch"
curl -L https://gitlab.freedesktop.org/cairo/cairo/-/commit/cdb7c298c7b89307ad69b94a1126221bd7c06579.patch -o test.diff
cd cairo
patch -Nbp1 -i "$PWD/../test.diff" || true
# it is fine to fail because the CI config is missing.
cd ..
meson setup --prefix=$PREFIX --default-library=shared --buildtype=release -Dfontconfig=enabled -Dfreetype=enabled -Dglib=enabled -Dzlib=enabled -Dtee=enabled cairo_builddir cairo
meson compile -C cairo_builddir
meson install --no-rebuild -C cairo_builddir
echo "::endgroup::"

echo "::group::Building and Installing Harfbuzz"
meson setup --prefix=$PREFIX -Dcoretext=enabled --buildtype=release -Dtests=disabled -Ddocs=disabled harfbuzz_builddir harfbuzz
meson compile -C harfbuzz_builddir
meson install -C harfbuzz_builddir
echo "::endgroup::"

echo "::group::Buildling and Installing Pango"
meson setup --prefix=$PREFIX --buildtype=release -Dintrospection=disabled pango_builddir pango
meson setup --prefix=$PREFIX --buildtype=release \
-Dintrospection=disabled \
-Dfontconfig=enabled \
--force-fallback-for=fontconfig \
pango_builddir pango
meson compile -C pango_builddir
meson install -C pango_builddir
echo "::endgroup::"
28 changes: 12 additions & 16 deletions packing/download_and_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,31 @@
import shutil
import tarfile
import tempfile
import urllib.request
from pathlib import Path

import requests

logging.basicConfig(format="%(levelname)s - %(message)s", level=logging.INFO)
parser = argparse.ArgumentParser(description="Download things.")
parser.add_argument("url", help="the url to download")
parser.add_argument("folder", help="folder name to extract")
args = parser.parse_args()

a = requests.get(args.url)
logging.info("Download Complete Extracting")
assert a.status_code != 404, "Does not exist."
with tempfile.TemporaryDirectory() as tmpdirname:
tmpdirname = Path(tmpdirname)
fname = Path(args.url).name
for i in tmpdirname.iterdir():
print(i)
with open(tmpdirname / fname, "wb") as f:
logging.info(f"Saving to {tmpdirname / fname}")
f.write(a.content)
with tarfile.open(tmpdirname / fname, "r") as tar:
logging.info(f"Extracting {tmpdirname / fname} to {tmpdirname}")
fname = Path(tmpdirname, Path(args.url).name)

logging.info(f"Download & Saving file to {fname}")

urllib.request.urlretrieve(args.url, fname)

with tarfile.open(fname, "r") as tar:
logging.info(f"Extracting {fname} to {tmpdirname}")
tar.extractall(tmpdirname)

logging.info(
f"Moving {str(tmpdirname / Path(Path(args.url).stem).stem)} "
f"Moving {Path(tmpdirname, Path(Path(args.url).stem).stem)} "
f"to {str(args.folder)}"
)
shutil.move(
str(tmpdirname / Path(Path(args.url).stem).stem),
Path(tmpdirname, Path(Path(args.url).stem).stem),
str(args.folder),
)

0 comments on commit 7ff3c10

Please sign in to comment.