Use parallel make for builds. We use the GNU coreutils' "nproc" utility to determine the number of cores available for us to use. We then tell make to launch up to that number of processes (-j$(nproc)) in parallel, but only if the system load is below $(nproc) (-l$(nproc)). That should make reasonably good use of however many cores github makes available to us, while not overloading the build server or the build server VM.
46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: C/C++ CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: apt-get install
|
|
run: sudo apt-get update && sudo apt-get install -y autopoint gettext libusb-1.0-0-dev libcurl4-openssl-dev libgd-dev
|
|
- name: autoreconf
|
|
run: autoreconf -i -f
|
|
- name: configure
|
|
run: ./configure --prefix=$PWD/__prefix
|
|
- name: make
|
|
run: NPROC=$(nproc); set -x; make -j$NPROC -l$NPROC
|
|
- name: make check
|
|
run: NPROC=$(nproc); set -x; make -j$NPROC -l$NPROC check
|
|
- name: make distcheck
|
|
run: NPROC=$(nproc); set -x; make -j$NPROC -l$NPROC distcheck
|
|
- name: make install
|
|
run: NPROC=$(nproc); set -x; make -j$NPROC -l$NPROC install
|
|
- name: build and run example libgphoto2 frontend (ambs-lgp2-frontend)
|
|
run: |
|
|
set -x
|
|
exec 2>&1
|
|
abs_top_builddir="$PWD"
|
|
export PKG_CONFIG_PATH="${abs_top_builddir}/__prefix/lib/pkgconfig"
|
|
export LD_LIBRARY_PATH="${abs_top_builddir}/__prefix/lib"
|
|
cd examples/ambs-lgp2-frontend
|
|
autoreconf -vis
|
|
./configure --prefix="$PWD/__pref"
|
|
make
|
|
ldd ambs-lgp2-frontend
|
|
./ambs-lgp2-frontend
|
|
make install
|
|
ldd __pref/bin/ambs-lgp2-frontend
|
|
__pref/bin/ambs-lgp2-frontend
|