github actions workflow: macos, ubuntu, windows+msys2

This commit is contained in:
Michael Bradley, Jr 2021-06-06 10:48:49 -05:00 committed by Nick Black
parent 3dbb3c149d
commit 28b2555195
3 changed files with 180 additions and 3 deletions

171
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,171 @@
name: Tests
on:
pull_request:
push:
branches:
- master
jobs:
tests:
env:
COLORTERM: truecolor
NPROC: 2
TERM: xterm
strategy:
fail-fast: false
matrix:
platform:
- {
icon: 🍎,
os: macos,
shell: bash --noprofile --norc -eo pipefail
}
- {
icon: 🐧,
os: ubuntu,
shell: bash --noprofile --norc -eo pipefail
}
- {
icon: 🏁,
os: windows,
shell: msys2
}
name: ${{ matrix.platform.icon }} ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform.os }}-latest
defaults:
run:
shell: ${{ matrix.platform.shell }} {0}
steps:
- name: Install tools and libraries via APT
if: matrix.platform.os == 'ubuntu'
run: |
sudo apt install -y \
build-essential \
cmake \
doctest-dev \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libncurses-dev \
libqrcodegen-dev \
libreadline-dev \
libswscale-dev \
libunistring-dev \
pandoc \
pkg-config \
python3-cffi \
python3-dev \
python3-setuptools
- name: Install tools and libraries via Homebrew
if: matrix.platform.os == 'macos'
run: |
brew install \
coreutils \
doctest \
ffmpeg \
libunistring \
ncurses \
pandoc \
readline
- name: Install tools and libraries via MSYS2
if: matrix.platform.os == 'windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
# installing mingw-w64-x86_64-libxml2 is a workaround for:
# https://github.com/msys2/MINGW-packages/issues/8658
install: >
base-devel
git
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ffmpeg
mingw-w64-x86_64-libunistring
mingw-w64-x86_64-libxml2
mingw-w64-x86_64-ncurses
mingw-w64-x86_64-rust
mingw-w64-x86_64-toolchain
- uses: actions/checkout@v2
- name: cmake
run: |
if [[ ${{ matrix.platform.os }} != ubuntu ]]; then
pushd .
mkdir "${HOME}/repos" && cd "${HOME}/repos"
git clone https://github.com/nayuki/QR-Code-generator.git
cd QR-Code-generator/c
if [[ ${{ matrix.platform.os }} = macos ]]; then
AR=/usr/local/opt/llvm/bin/llvm-ar
else
AR="$(which ar)"
fi
make AR="${AR}"
if [[ ${{ matrix.platform.os }} = macos ]]; then
PREFIX=/usr/local
else
PREFIX=/mingw64
fi
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
fi
mkdir build && cd build
if [[ ${{ matrix.platform.os }} = macos ]]; then
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-I/usr/local/include -L/usr/local/lib" \
-DUSE_QRCODEGEN=on
elif [[ ${{ matrix.platform.os }} = windows ]]; then
cmake .. \
-G "MSYS Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_DOCTEST=off \
-DUSE_PANDOC=off \
-DUSE_QRCODEGEN=on
else
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_QRCODEGEN=on
fi
- name: make
run: |
cd build
make -j${NPROC}
- name: ctest
run: |
cd build
ctest --output-on-failure
- name: make install
run: |
cd build
sudo make install
sudo ldconfig
- name: python wrappers
run: |
python3 -m pip install --upgrade pip
pip install pypandoc
cd cffi
python3 setup.py sdist build
sudo python3 setup.py install
notcurses-pydemo > /dev/null
ncdirect-pydemo > /dev/null
- name: rust wrappers
run: |
cd rust
rustc --version
cargo build
cargo t_all

View File

@ -97,7 +97,9 @@ elseif(${USE_OIIO})
pkg_check_modules(OIIO REQUIRED OpenImageIO>=2.1)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND OpenImageIO)
endif()
if (NOT MSYS)
find_library(MATH_LIBRARIES m)
endif()
if(${USE_DOCTEST})
find_package(doctest 2.3.5)
set_package_properties(doctest PROPERTIES TYPE REQUIRED)
@ -121,8 +123,11 @@ if(NOT "${HAVE_QRCODEGEN_H}")
endif()
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND qrcodegen)
endif()
if (NOT MSYS)
find_library(LIBM m)
find_library(LIBRT rt)
endif()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
file(GLOB COMPATSRC CONFIGURE_DEPENDS src/compat/compat.c)

View File

@ -44,6 +44,7 @@ sudo apt-get update
![Linux](https://img.shields.io/badge/-Linux-grey?logo=linux)
![FreeBSD](https://img.shields.io/badge/-FreeBSD-grey?logo=freebsd)
[![Build](https://drone.dsscaw.com:4443/api/badges/dankamongmen/notcurses/status.svg)](https://drone.dsscaw.com:4443/dankamongmen/notcurses)
[![Tests (GitHub Actions)](https://github.com/dankamongmen/notcurses/workflows/Tests/badge.svg?branch=master)](https://github.com/dankamongmen/notcurses/actions?query=workflow%3ATests+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)
![Matrix](https://img.shields.io/matrix/notcursesdev:matrix.org?label=matrixchat)