mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
Add a GitHub Workflow as CI run (#1238)
CircleCI is limiting how many runs we can do, which results in pipelines randomly failing when we've used up the credits for this month. Let's add a github workflow instead. Unfortunately github workflows are a bit of a toy api, no support for YAML anchors or extending other jobs, so there's a lot of duplication needed to get a job to do something. The actions added in this patch help a bit to make the jobs easier to understand (copied from libwacom). This only runs on Ubuntu right now. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
39
.github/actions/meson/action.yml
vendored
Normal file
39
.github/actions/meson/action.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# A Github Action to build a repository with meson
|
||||
name: "Setup and run meson"
|
||||
description: "Setup and run meson"
|
||||
inputs:
|
||||
builddir:
|
||||
description: "The build directory"
|
||||
default: "builddir"
|
||||
srcdir:
|
||||
description: "The source directory"
|
||||
default: "."
|
||||
meson_args:
|
||||
description: "Arguments passed to meson setup"
|
||||
default: ""
|
||||
meson_skip_test:
|
||||
description: "Set to a nonempty string to skip meson test"
|
||||
default: ""
|
||||
meson_test_args:
|
||||
description: "Arguments passed to meson test"
|
||||
default: ""
|
||||
meson_precmd:
|
||||
description: "Set to 'sudo' to run with sudo"
|
||||
default: ""
|
||||
ninja_args:
|
||||
description: "Arguments passed to ninja"
|
||||
default: ""
|
||||
ninja_precmd:
|
||||
description: "Set to 'sudo' to run with sudo"
|
||||
default: ""
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: |
|
||||
${{inputs.meson_precmd}} meson setup ${{inputs.builddir}} ${{inputs.srcdir}} ${{inputs.meson_args}}
|
||||
${{inputs.meson_precmd}} meson configure ${{inputs.builddir}}
|
||||
${{inputs.ninja_precmd}} ninja -C ${{inputs.builddir}} ${{inputs.ninja_args}}
|
||||
if [[ -z "${{inputs.meson_skip_test}}" ]]; then
|
||||
${{inputs.meson_precmd}} meson test -C ${{inputs.builddir}} --print-errorlogs ${{inputs.meson_test_args}};
|
||||
fi
|
||||
shell: bash
|
||||
17
.github/actions/pkginstall/action.yml
vendored
Normal file
17
.github/actions/pkginstall/action.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: "Install packages"
|
||||
description: "Install a set of packages from sources"
|
||||
inputs:
|
||||
apt:
|
||||
description: "The package list to install with apt"
|
||||
pip:
|
||||
description: "The package list to install with pip"
|
||||
pip_precmd:
|
||||
description: "Set to the string 'sudo' to run through sudo"
|
||||
default: ""
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: sudo ${{ github.action_path }}/install-apt.sh ${{ inputs.apt }}
|
||||
shell: bash
|
||||
- run: ${{inputs.pip_precmd}} ${{ github.action_path }}/install-pip.sh ${{ inputs.pip }}
|
||||
shell: bash
|
||||
14
.github/actions/pkginstall/install-apt.sh
vendored
Executable file
14
.github/actions/pkginstall/install-apt.sh
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# If called without arguments, just skip the rest
|
||||
if [[ -z "$@" ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Don't care about these bits
|
||||
echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
|
||||
echo 'path-exclude=/usr/share/locale/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
|
||||
echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
|
||||
|
||||
apt-get update
|
||||
apt-get install -yq --no-install-suggests --no-install-recommends $@
|
||||
9
.github/actions/pkginstall/install-pip.sh
vendored
Executable file
9
.github/actions/pkginstall/install-pip.sh
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# If called without arguments, just skip the rest
|
||||
if [[ -z "$@" ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade "$@"
|
||||
Reference in New Issue
Block a user