notcurses/.github/workflows/tests.yml

172 lines
4.5 KiB
YAML
Raw Normal View History

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