Switch to GitHub Actions

Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
This commit is contained in:
Stephan Lachnit 2021-05-25 00:14:58 +02:00 committed by afayaz-feral
parent 6c60565f33
commit ab06ba419e
6 changed files with 70 additions and 40 deletions

38
.github/workflows/build-and-test.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Build and test
on: [push, pull_request]
jobs:
build-and-test:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt install build-essential meson appstream clang clang-format clang-tools libdbus-1-dev libinih-dev libsystemd-dev
- name: Check format
env:
CI: "true"
run: |
./scripts/format-check.sh
- name: Build and install
env:
CI: "true"
run: |
./bootstrap.sh -Dwith-examples=true
- name: Tests
run: |
meson test -C builddir
- name: Simulate game
run: |
dbus-run-session -- gamemode-simulate-game
- name: Static analyser check
run: |
./scripts/static-analyser-check.sh
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: logs
path: |
builddir/meson-logs/

View File

@ -1,25 +0,0 @@
os: linux
dist: focal
language: c
compiler: gcc
addons:
apt:
packages:
- appstream
- clang
- clang-format
- libinih-dev
- libdbus-1-dev
- libsystemd-dev
- meson
artifacts:
paths:
- $(git ls-files -o | tr "\n" ":")
script:
- ./scripts/format-check.sh
- ./bootstrap.sh -Dwith-examples=true
- meson test -C builddir
- dbus-run-session -- gamemode-simulate-game
- ./scripts/static-analyser-check.sh

View File

@ -75,7 +75,7 @@ Other apps which can integrate with GameMode include:
* Lutris - Enables GameMode for all games by default if available (must have both 32- and 64-bit GameMode libraries installed), configurable in preferences. * Lutris - Enables GameMode for all games by default if available (must have both 32- and 64-bit GameMode libraries installed), configurable in preferences.
--- ---
## Development [![Build Status](https://travis-ci.org/FeralInteractive/gamemode.svg?branch=master)](https://travis-ci.org/FeralInteractive/gamemode) ## Development [![Build and test](https://github.com/FeralInteractive/gamemode/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/FeralInteractive/gamemode/actions/workflows/build-and-test.yml)
The design of GameMode has a clear-cut abstraction between the host daemon and library (`gamemoded` and `libgamemode`), and the client loaders (`libgamemodeauto` and `gamemode_client.h`) that allows for safe use without worrying about whether the daemon is installed or running. This design also means that while the host library currently relies on `systemd` for exchanging messages with the daemon, it's entirely possible to implement other internals that still work with the same clients. The design of GameMode has a clear-cut abstraction between the host daemon and library (`gamemoded` and `libgamemode`), and the client loaders (`libgamemodeauto` and `gamemode_client.h`) that allows for safe use without worrying about whether the daemon is installed or running. This design also means that while the host library currently relies on `systemd` for exchanging messages with the daemon, it's entirely possible to implement other internals that still work with the same clients.

View File

@ -14,9 +14,9 @@ if [ ! -f "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" ]; then
echo "This probably means that you have disabled processor scheduling features in your BIOS. See README.md (or GitHub issue #44) for more information." echo "This probably means that you have disabled processor scheduling features in your BIOS. See README.md (or GitHub issue #44) for more information."
echo "This means GameMode's CPU governor control feature will not work (other features will still work)." echo "This means GameMode's CPU governor control feature will not work (other features will still work)."
if [ "$TRAVIS" != "true" ]; then if [ "$CI" != "true" ]; then
# Allow to continue the install, as gamemode has other useful features # Allow to continue the install, as gamemode has other useful features
read -p "Would you like to continue anyway [Y/N]? " -r read -p "Would you like to continue anyway [y/N]? " -r
[[ $REPLY =~ ^[Yy]$ ]] [[ $REPLY =~ ^[Yy]$ ]]
fi fi
fi fi
@ -31,7 +31,7 @@ ninja -C builddir
# Verify user wants to install # Verify user wants to install
set +x set +x
if [ "$TRAVIS" != "true" ]; then if [ "$CI" != "true" ]; then
read -p "Install to $prefix? [y/N] " -r read -p "Install to $prefix? [y/N] " -r
[[ $REPLY =~ ^[Yy]$ ]] [[ $REPLY =~ ^[Yy]$ ]]
fi fi
@ -39,6 +39,7 @@ set -x
sudo ninja install -C builddir sudo ninja install -C builddir
if [ "$CI" != "true" ]; then
# Restart polkit so we don't get pop-ups whenever we pkexec # Restart polkit so we don't get pop-ups whenever we pkexec
if systemctl list-unit-files | grep -q polkit.service; then if systemctl list-unit-files | grep -q polkit.service; then
sudo systemctl try-restart polkit sudo systemctl try-restart polkit
@ -46,3 +47,4 @@ fi
# Reload systemd configuration so that it picks up the new service. # Reload systemd configuration so that it picks up the new service.
systemctl --user daemon-reload systemctl --user daemon-reload
fi

View File

@ -10,6 +10,21 @@ if [[ "$1" == "--pre-commit" ]]; then
git-clang-format git-clang-format
exit exit
fi fi
if [[ "$CI" == "true" ]]; then
# used in ci, assumes clean repo
clang-format -i $(find . -name '*.[ch]' -not -path "*subprojects/*")
GIT_DIFF_OUTPUT=$(git diff)
if [[ ! -z ${GIT_DIFF_OUTPUT} ]]; then
echo "Failed clang format check:"
echo "${GIT_DIFF_OUTPUT}"
exit 1
else
echo "Passed clang format check"
exit 0
fi
fi
CLANG_FORMAT_OUTPUT=$(git-clang-format HEAD^ HEAD --diff) CLANG_FORMAT_OUTPUT=$(git-clang-format HEAD^ HEAD --diff)
if [[ ! ${CLANG_FORMAT_OUTPUT} == "no modified files to format" ]] && [[ ! -z ${CLANG_FORMAT_OUTPUT} ]]; then if [[ ! ${CLANG_FORMAT_OUTPUT} == "no modified files to format" ]] && [[ ! -z ${CLANG_FORMAT_OUTPUT} ]]; then
echo "Failed clang format check:" echo "Failed clang format check:"
@ -17,4 +32,5 @@ if [[ ! ${CLANG_FORMAT_OUTPUT} == "no modified files to format" ]] && [[ ! -z ${
exit 1 exit 1
else else
echo "Passed clang format check" echo "Passed clang format check"
exit 0
fi fi

View File

@ -1,11 +1,10 @@
#!/bin/bash #!/bin/bash
# Exit on failure # Ensure we are at the project root
set -e cd "$(dirname $0)"/..
# Collect scan-build output # Collect scan-build output
ninja scan-build -C builddir | tee /tmp/scan-build-results.txt ninja scan-build -C builddir | tee builddir/meson-logs/scan-build.txt
# Invert the output - if this string exists it's a fail # Invert the output - if this string exists it's a fail
! grep -E '[0-9]+ bugs? found.' /tmp/scan-build-results.txt exit ! grep -E '[0-9]+ bugs? found.' builddir/meson-logs/scan-build.txt