ci: Use github actions

This commit is contained in:
patrick96 2020-12-11 21:37:54 +01:00 committed by Patrick Ziegler
parent 54e2490aa5
commit cf739ed295
8 changed files with 158 additions and 52 deletions

88
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,88 @@
name: CI
on: [push, pull_request]
jobs:
docs:
runs-on: ubuntu-20.04
env:
COLOR: "ON"
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
run: sudo apt-get install -y python3-sphinx
- name: Build Documentation
run: |
mkdir -p doc/build
cd doc/build
cmake ..
make doc
build:
runs-on: ubuntu-20.04
strategy:
matrix:
cxx: [g++, clang++]
polybar_build_type: ["full"]
build_type: ["Release"]
include:
- cxx: g++
polybar_build_type: "tests"
build_type: "Coverage"
- cxx: g++
polybar_build_type: "minimal"
build_type: "Release"
env:
CXX: ${{ matrix.cxx }}
BUILD_TYPE: ${{ matrix.build_type }}
POLYBAR_BUILD_TYPE: ${{ matrix.polybar_build_type }}
POLYBAR_DIR: ${{ github.workspace }}
BUILD_DIR: "${{ github.workspace}}/build"
MAKEFLAGS: "-j4"
COLOR: "ON"
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libxcb-composite0-dev \
libxcb-ewmh-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-randr0-dev \
libxcb-util0-dev \
libxcb1-dev \
libcairo2-dev \
python3-xcbgen \
xcb-proto
if [ "$POLYBAR_BUILD_TYPE" != "minimal" ]; then
sudo apt-get install -y \
libxcb-xkb-dev \
libxcb-cursor-dev \
libxcb-xrm-dev \
i3-wm \
libcurl4-openssl-dev \
libjsoncpp-dev \
libasound2-dev \
libpulse-dev \
libiw-dev \
libmpdclient-dev
fi
- uses: actions/checkout@v2
with:
submodules: true
- name: Summary
run: ./common/ci/summary.sh
- name: Configure
run: ./common/ci/configure.sh
- name: Build
run: |
cd $BUILD_DIR
make
- name: Tests
if: ${{ matrix.polybar_build_type == 'tests' }}
run: |
cd $BUILD_DIR
make check
cd $POLYBAR_DIR
bash <(curl -s https://codecov.io/bash) -F unittests -a "-ap" -Z

View File

@ -37,7 +37,7 @@ addons:
- libiw-dev
- libmpdclient-dev
script: source ${TRAVIS_BUILD_DIR}/common/travis/build.sh
script: source ${TRAVIS_BUILD_DIR}/common/ci/build.sh
matrix:
include:
@ -59,7 +59,7 @@ matrix:
addons: {apt: {packages: [*base_deps, *optional_deps]}}
- compiler: gcc
env: BUILD_TYPE=Coverage POLYBAR_BUILD_TYPE=tests BUILD_TESTS=ON
env: BUILD_TYPE=Coverage POLYBAR_BUILD_TYPE=tests
addons: {apt: {packages: [*base_deps, *optional_deps]}}
script: make check
after_success:
@ -82,8 +82,8 @@ cache:
apt: true
before_script:
- source ${TRAVIS_BUILD_DIR}/common/travis/summary.sh
- source ${TRAVIS_BUILD_DIR}/common/travis/configure.sh
- source ${TRAVIS_BUILD_DIR}/common/ci/summary.sh
- source ${TRAVIS_BUILD_DIR}/common/ci/configure.sh
# Only fetch the newest 5 commits instead of 50
git:

View File

@ -8,6 +8,7 @@ A fast and easy-to-use tool for creating status bars.
<p align="center">
<a href="https://github.com/polybar/polybar/releases"><img src="https://img.shields.io/github/release/polybar/polybar.svg"></a>
<a href="https://github.com/polybar/polybar/actions?query=workflow%3ACI"><img src="https://github.com/polybar/polybar/workflows/CI/badge.svg?event=push"></a>
<a href="https://travis-ci.com/polybar/polybar"><img src="https://travis-ci.com/polybar/polybar.svg?branch=master"></a>
<a href="https://polybar.readthedocs.io"><img src="https://readthedocs.org/projects/polybar/badge/?version=latest"></a>
<a href="https://gitter.im/polybar/polybar"><img src="https://badges.gitter.im/polybar/polybar.svg"></a>

46
common/ci/configure.sh Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -eo pipefail
if [ -d "$BUILD_DIR" ]; then
rm -Rf "$BUILD_DIR"
fi
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
if [ "$POLYBAR_BUILD_TYPE" != "minimal" ]; then
ENABLE_PULSEAUDIO=ON
ENABLE_NETWORK=ON
ENABLE_MPD=ON
ENABLE_CURL=ON
ENABLE_ALSA=ON
ENABLE_I3=ON
WITH_XRM=ON
WITH_XKB=ON
WITH_XRANDR_MONITORS=ON
WITH_XCURSOR=ON
fi
if [ "$POLYBAR_BUILD_TYPE" = "tests" ]; then
BUILD_TESTS=ON
fi
cmake \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS} -Werror" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" \
-DBUILD_DOC:BOOL="${BUILD_DOC:-OFF}" \
-DWITH_XRANDR=ON \
-DENABLE_PULSEAUDIO="${ENABLE_PULSEAUDIO:-OFF}" \
-DENABLE_NETWORK="${ENABLE_NETWORK:-OFF}" \
-DENABLE_MPD="${ENABLE_MPD:-OFF}" \
-DENABLE_CURL="${ENABLE_CURL:-OFF}" \
-DENABLE_ALSA="${ENABLE_ALSA:-OFF}" \
-DENABLE_I3="${ENABLE_I3:-OFF}" \
-DWITH_XRM="${WITH_XRM:-OFF}" \
-DWITH_XKB="${WITH_XKB:-OFF}" \
-DWITH_XRANDR_MONITORS="${WITH_XRANDR_MONITORS:-OFF}" \
-DWITH_XCURSOR="${WITH_XCURSOR:-OFF}" \
..

19
common/ci/summary.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -eo pipefail
set -x
"${CXX}" --version
cmake --version
set +x
echo "PATH=${PATH}"
echo "CXX=${CXX}"
echo "CXXFLAGS=${CXXFLAGS}"
echo "LDFLAGS=${LDFLAGS}"
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
echo "MAKEFLAGS=${MAKEFLAGS}"
echo "POLYBAR_BUILD_TYPE=${POLYBAR_BUILD_TYPE}"
echo "CMAKE_BUILD_TYPE=${BUILD_TYPE}"

View File

@ -1,3 +0,0 @@
#!/bin/bash
cd "${TRAVIS_BUILD_DIR}/build" || false
make || exit $?

View File

@ -1,32 +0,0 @@
#!/bin/bash
mkdir -p "${TRAVIS_BUILD_DIR}/build"
cd "${TRAVIS_BUILD_DIR}/build" || false
FLAGS=""
# Disable all extra modules and X extensions for minimal builds
# Most of these should already be turned off because their libraries are not
# installed, but some may not be
if [ "$POLYBAR_BUILD_TYPE" == "minimal" ]; then
FLAGS=(
"-DENABLE_PULSEAUDIO=OFF"
"-DENABLE_NETWORK=OFF"
"-DENABLE_MPD=OFF"
"-DENABLE_CURL=OFF"
"-DENABLE_ALSA=OFF"
"-DENABLE_I3=OFF"
"-DWITH_XRM=OFF"
"-DWITH_XKB=OFF"
"-DWITH_XRANDR_MONITORS=OFF"
"-DWITH_XCURSOR=OFF"
"-DWITH_XRANDR=ON"
)
fi
cmake \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS} -Werror" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" \
-DBUILD_DOC:BOOL="${BUILD_DOC:-OFF}" \
"${FLAGS[@]}" ..

View File

@ -1,13 +0,0 @@
#!/bin/bash
echo "${CXX} --version"
eval "${CXX} --version"
echo "cmake --version"
cmake --version
echo "PATH=${PATH}"
echo "CXX=${CXX}"
echo "CXXFLAGS=${CXXFLAGS}"
echo "LDFLAGS=${LDFLAGS}"
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
echo "JOBS=${JOBS}"