From deccda9f96f7d814763fe25fa38269878b07a460 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Wed, 14 Jul 2021 11:55:17 -0500 Subject: [PATCH] ci: run GHA workflow for macOS on all commits to master and PRs Also split out the build of libqrcodegen on macOS into a separate step, and make the workflows for Ubuntu and macOS as consistent as possible; may require more changes depending on what passes and doesn't pass on macOS. The GHA workflow for Windows will be revised in a separate PR. --- .github/workflows/macos_test.yml | 42 ++++++++++++++++++++---------- .github/workflows/ubuntu_test.yml | 31 +++++++++++----------- .github/workflows/windows_test.yml | 3 ++- README.md | 3 ++- python/setup.py | 17 +++++++++--- 5 files changed, 61 insertions(+), 35 deletions(-) diff --git a/.github/workflows/macos_test.yml b/.github/workflows/macos_test.yml index 4c93737f2..888928828 100644 --- a/.github/workflows/macos_test.yml +++ b/.github/workflows/macos_test.yml @@ -1,8 +1,11 @@ --- -name: 🍎 MacOS Tests +name: macOS on: - workflow_dispatch: + pull_request: + push: + branches: + - master jobs: tests: @@ -10,6 +13,7 @@ jobs: COLORTERM: truecolor NPROC: 2 TERM: xterm + name: 🍎 build, test, & install runs-on: macos-latest steps: @@ -27,24 +31,27 @@ jobs: - uses: actions/checkout@v2 - - name: cmake + - name: Build libqrcodegen run: | - pushd . mkdir "${HOME}/repos" && cd "${HOME}/repos" git clone https://github.com/nayuki/QR-Code-generator.git cd QR-Code-generator/c AR=/usr/local/opt/llvm/bin/llvm-ar make AR="${AR}" - PREFIX=/usr/local - cd ${PREFIX}/include && \ - ln -s "${HOME}/repos/QR-Code-generator/c" qrcodegen - cd ${PREFIX}/lib && \ - ln -s "${HOME}/repos/QR-Code-generator/c/libqrcodegen.a" . - popd + mkdir -p "${HOME}"/opt/qrcodegen/{include,lib} + cd "${HOME}/opt/qrcodegen/include" \ + && ln -s "${HOME}/repos/QR-Code-generator/c" ./qrcodegen + cd "${HOME}/opt/qrcodegen/lib" \ + && ln -s "${HOME}/repos/QR-Code-generator/c/libqrcodegen.a" ./libqrcodegen.a + cd /usr/local/opt && ln -s "${HOME}/opt/qrcodegen" ./qrcodegen + + - name: cmake + run: | + export PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig" mkdir build && cd build cmake .. \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_FLAGS="-I/usr/local/include -L/usr/local/lib" \ + -DCMAKE_C_FLAGS="-I/usr/local/opt/qrcodegen/include -L/usr/local/opt/qrcodegen/lib" \ -DUSE_QRCODEGEN=on - name: make @@ -61,20 +68,27 @@ jobs: run: | cd build sudo make install - sudo ldconfig - - name: python wrappers + - name: python wrappers (old) run: | python3 -m pip install --upgrade pip - pip install pypandoc + pip install cffi pypandoc cd cffi python3 setup.py sdist build sudo python3 setup.py install notcurses-pydemo > /dev/null ncdirect-pydemo > /dev/null + - name: python wrappers (new) + run: | + cd python + python3 setup.py build + sudo python3 setup.py install + python3 examples/000-print-version.py + - name: rust wrappers run: | + export PKG_CONFIG_PATH="/usr/local/libdata/pkgconfig" cd rust rustc --version cargo build diff --git a/.github/workflows/ubuntu_test.yml b/.github/workflows/ubuntu_test.yml index 17eb2193b..0e04538bd 100644 --- a/.github/workflows/ubuntu_test.yml +++ b/.github/workflows/ubuntu_test.yml @@ -1,8 +1,7 @@ --- -name: 🐧 Tests on Ubuntu +name: Ubuntu on: - workflow_dispatch: pull_request: push: branches: @@ -10,11 +9,15 @@ on: jobs: tests: - runs-on: ubuntu-latest env: COLORTERM: truecolor + NPROC: 2 TERM: xterm + name: 🐧 build, test, & install + runs-on: ubuntu-latest + steps: + - name: Install tools and libraries via APT run: | sudo apt update @@ -37,9 +40,7 @@ jobs: python3-dev \ python3-setuptools - - name: Checkout manually - run: | - git clone "https://github.com/${GITHUB_REPOSITORY}" . + - uses: actions/checkout@v2 - name: cmake run: | @@ -51,7 +52,7 @@ jobs: - name: make run: | cd build - make -j"$(nproc)" + make -j${NPROC} - name: ctest run: | @@ -64,7 +65,7 @@ jobs: sudo make install sudo ldconfig - - name: old python wrappers + - name: python wrappers (old) run: | python3 -m pip install --upgrade pip pip install pypandoc @@ -74,16 +75,16 @@ jobs: notcurses-pydemo > /dev/null ncdirect-pydemo > /dev/null + - name: python wrappers (new) + run: | + cd python + python3 setup.py build + sudo python3 setup.py install + python3 examples/000-print-version.py + - name: rust wrappers run: | cd rust rustc --version cargo build cargo t_all - - - name: Build new python wrappers - run: | - cd python - python3 setup.py build - sudo python3 setup.py install - python3 examples/000-print-version.py diff --git a/.github/workflows/windows_test.yml b/.github/workflows/windows_test.yml index 2686d80b3..be9f87e7f 100644 --- a/.github/workflows/windows_test.yml +++ b/.github/workflows/windows_test.yml @@ -1,5 +1,5 @@ --- -name: 🏁 Windows Tests +name: Windows on: workflow_dispatch: @@ -10,6 +10,7 @@ jobs: COLORTERM: truecolor NPROC: 2 TERM: xterm + name: 🏁 build, test, & install runs-on: windows-latest steps: diff --git a/README.md b/README.md index 07e792478..e933fba3b 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ sudo apt-get update [![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/dankamongmen) [![Build](https://drone.dsscaw.com:4443/api/badges/dankamongmen/notcurses/status.svg)](https://drone.dsscaw.com:4443/dankamongmen/notcurses) -[![🐧 UbuntuTests](https://github.com/dankamongmen/notcurses/actions/workflows/ubuntu_test.yml/badge.svg)](https://github.com/dankamongmen/notcurses/actions/workflows/ubuntu_test.yml) +[![Ubuntu](https://github.com/dankamongmen/notcurses/actions/workflows/ubuntu_test.yml/badge.svg?branch=master)](https://github.com/dankamongmen/notcurses/actions/workflows/ubuntu_test.yml?query=branch%3Amaster) +[![macOS](https://github.com/dankamongmen/notcurses/actions/workflows/macos_test.yml/badge.svg?branch=master)](https://github.com/dankamongmen/notcurses/actions/workflows/macos_test.yml?query=branch%3Amaster) [![pypi_version](https://img.shields.io/pypi/v/notcurses?label=pypi)](https://pypi.org/project/notcurses) [![crates.io](https://img.shields.io/crates/v/libnotcurses-sys.svg)](https://crates.io/crates/libnotcurses-sys) diff --git a/python/setup.py b/python/setup.py index 3c0bafc6e..2c058b7d1 100644 --- a/python/setup.py +++ b/python/setup.py @@ -19,13 +19,22 @@ from os import environ from setuptools import Extension, setup +from sys import platform + if environ.get('CFLAGS') is None: - environ['CFLAGS'] = ( - "-Werror " - "-Wextra -Wconversion -Wall") + if platform == "darwin": + environ['CFLAGS'] = ( + "-Wextra -Wconversion -Wall") + else: + environ['CFLAGS'] = ( + "-Werror " + "-Wextra -Wconversion -Wall") if environ.get('LDFLAGS') is None: - environ['LDFLAGS'] = "-Wl,--no-as-needed" + if platform == "darwin": + environ['LDFLAGS'] = "-Wl,-all_load" + else: + environ['LDFLAGS'] = "-Wl,--no-as-needed" setup( name="notcurses",