mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-03 06:07:20 +02:00
Switch to GitHub Actions
Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
This commit is contained in:
parent
6c60565f33
commit
ab06ba419e
38
.github/workflows/build-and-test.yml
vendored
Normal file
38
.github/workflows/build-and-test.yml
vendored
Normal 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/
|
25
.travis.yml
25
.travis.yml
@ -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
|
@ -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.
|
||||
|
||||
---
|
||||
## Development [](https://travis-ci.org/FeralInteractive/gamemode)
|
||||
## Development [](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.
|
||||
|
||||
|
20
bootstrap.sh
20
bootstrap.sh
@ -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 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
|
||||
read -p "Would you like to continue anyway [Y/N]? " -r
|
||||
read -p "Would you like to continue anyway [y/N]? " -r
|
||||
[[ $REPLY =~ ^[Yy]$ ]]
|
||||
fi
|
||||
fi
|
||||
@ -31,7 +31,7 @@ ninja -C builddir
|
||||
|
||||
# Verify user wants to install
|
||||
set +x
|
||||
if [ "$TRAVIS" != "true" ]; then
|
||||
if [ "$CI" != "true" ]; then
|
||||
read -p "Install to $prefix? [y/N] " -r
|
||||
[[ $REPLY =~ ^[Yy]$ ]]
|
||||
fi
|
||||
@ -39,10 +39,12 @@ set -x
|
||||
|
||||
sudo ninja install -C builddir
|
||||
|
||||
# Restart polkit so we don't get pop-ups whenever we pkexec
|
||||
if systemctl list-unit-files |grep -q polkit.service; then
|
||||
sudo systemctl try-restart polkit
|
||||
fi
|
||||
if [ "$CI" != "true" ]; then
|
||||
# Restart polkit so we don't get pop-ups whenever we pkexec
|
||||
if systemctl list-unit-files | grep -q polkit.service; then
|
||||
sudo systemctl try-restart polkit
|
||||
fi
|
||||
|
||||
# Reload systemd configuration so that it picks up the new service.
|
||||
systemctl --user daemon-reload
|
||||
# Reload systemd configuration so that it picks up the new service.
|
||||
systemctl --user daemon-reload
|
||||
fi
|
||||
|
@ -10,6 +10,21 @@ if [[ "$1" == "--pre-commit" ]]; then
|
||||
git-clang-format
|
||||
exit
|
||||
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)
|
||||
if [[ ! ${CLANG_FORMAT_OUTPUT} == "no modified files to format" ]] && [[ ! -z ${CLANG_FORMAT_OUTPUT} ]]; then
|
||||
echo "Failed clang format check:"
|
||||
@ -17,4 +32,5 @@ if [[ ! ${CLANG_FORMAT_OUTPUT} == "no modified files to format" ]] && [[ ! -z ${
|
||||
exit 1
|
||||
else
|
||||
echo "Passed clang format check"
|
||||
exit 0
|
||||
fi
|
||||
|
@ -1,11 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit on failure
|
||||
set -e
|
||||
# Ensure we are at the project root
|
||||
cd "$(dirname $0)"/..
|
||||
|
||||
# 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
|
||||
! grep -E '[0-9]+ bugs? found.' /tmp/scan-build-results.txt
|
||||
|
||||
exit ! grep -E '[0-9]+ bugs? found.' builddir/meson-logs/scan-build.txt
|
||||
|
Loading…
x
Reference in New Issue
Block a user