-
Notifications
You must be signed in to change notification settings - Fork 333
173 lines (134 loc) · 5.84 KB
/
ccpp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# If Github does not properly accept this YAML file, try
# https://rhysd.github.io/actionlint/ from
# https://github.com/rhysd/actionlint.
name: 'CI build'
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
LC_ALL: C
COMMON_CONFIGURE_FLAGS: >-
--enable-vusb
--with-camlibs=everything
SLEEP=no
jobs:
build:
runs-on: ${{ matrix.os }}
name: '${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: 'Determine number of cores to build on (Linux)'
if: runner.os == 'Linux'
run: echo NPROC=$(nproc) >> $GITHUB_ENV
- name: 'Determine number of cores to build on (macOS)'
if: runner.os == 'macOS'
run: echo NPROC=$(sysctl -n hw.logicalcpu) >> $GITHUB_ENV
# Setting MAKE interferes with Makefile{,.in,.am} using $(MAKE) internally
- name: 'Prepare concurrent make'
run: if test "x$NPROC" = x; then echo ci_MAKE="make" >> $GITHUB_ENV; echo "NPROC must be set"; exit 1; else echo ci_MAKE="make -j${NPROC} -l${NPROC}" >> $GITHUB_ENV; fi
- name: 'Update software database (Linux)'
if: runner.os == 'Linux'
run: sudo apt-get update
- name: 'Update software database (macOS)'
if: runner.os == 'macOS'
run: brew update
- name: 'Work around apt-get 3rd party repo libgd-dev dependency (Linux)'
if: runner.os == 'Linux'
run: sudo apt-get remove nginx libgd3
- name: 'Install build requirements (Linux)'
if: runner.os == 'Linux'
run: sudo apt-get install -y autopoint gettext libusb-1.0-0-dev libcurl4-openssl-dev libgd-dev libltdl-dev
- name: 'Install build requirements (macOS)'
if: runner.os == 'macOS'
run: brew install automake gd gettext libexif libtool libusb
- name: 'OS specific build flags (Linux)'
if: runner.os == 'Linux'
run: echo OS_SPECIFIC_CPPFLAGS="" >> $GITHUB_ENV
# FIXME: Fix source to build without the -D_DARWIN_C_SOURCE here
- name: 'OS specific build flags (macOS)'
if: runner.os == 'macOS'
run: echo OS_SPECIFIC_CPPFLAGS="-D_DARWIN_C_SOURCE -I$(brew --prefix)/include" >> $GITHUB_ENV
- name: 'autoreconf'
run: autoreconf -i -f
- name: 'configure'
run: ./configure ${COMMON_CONFIGURE_FLAGS} --prefix=$PWD/__prefix
- name: 'make'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}"
- name: 'make check'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" check
# FIXME: fix make distcheck to run on macOS
- name: 'make distcheck (non-macOS)'
if: runner.os != 'macOS'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" DISTCHECK_CONFIGURE_FLAGS="${COMMON_CONFIGURE_FLAGS}" distcheck
- name: 'make install'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" install
- name: 'make installcheck'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" installcheck
- name: 'find ldd replacement (MacOS)'
if: runner.os == 'macOS'
run: echo 'LDD=otool -L' >> $GITHUB_ENV
- name: 'find ldd replacement (Linux)'
if: runner.os == 'Linux'
run: echo 'LDD=ldd' >> $GITHUB_ENV
- 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-false} ambs-lgp2-frontend
./ambs-lgp2-frontend
make install
${LDD-false} __pref/bin/ambs-lgp2-frontend
__pref/bin/ambs-lgp2-frontend
cross-build:
runs-on: ubuntu-latest
container: debian:11
strategy:
matrix:
include:
- { arch: i386, processor: i686, prefix: i686-linux-gnu, inc-lib: i386-linux-gnu }
- { arch: armhf, processor: armhf, prefix: arm-linux-gnueabihf, inc-lib: arm-linux-gnueabihf }
- { arch: arm64, processor: aarch64, prefix: aarch64-linux-gnueabihf, inc-lib: aarch64-linux-gnueabihf }
steps:
- uses: actions/checkout@v4
- name: 'Add architecture and update software database'
run: |
dpkg --add-architecture ${{ matrix.arch }}
apt-get update
- name: 'Install build requirements'
run: >-
apt-get install -y
autopoint
gettext
crossbuild-essential-${{matrix.arch}}
libusb-1.0-0-dev:${{matrix.arch}}
libcurl4-openssl-dev:${{matrix.arch}}
libgd-dev:${{matrix.arch}}
libltdl-dev:${{matrix.arch}}
- name: 'Determine number of cores to build on (Linux)'
run: echo NPROC=$(nproc) >> $GITHUB_ENV
# Setting MAKE interferes with Makefile{,.in,.am} using $(MAKE) internally
- name: 'Prepare concurrent make'
run: if test "x$NPROC" = x; then echo ci_MAKE="make" >> $GITHUB_ENV; echo "NPROC must be set"; exit 1; else echo ci_MAKE="make -j${NPROC} -l${NPROC}" >> $GITHUB_ENV; fi
- name: 'autoreconf'
run: autoreconf -i -f
- name: 'configure'
run: ./configure ${COMMON_CONFIGURE_FLAGS} --prefix=$PWD/__prefix --host=${{ matrix.prefix }}
- name: 'make'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}"
- name: 'make check'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" check || { cat libgphoto2_port/tests/testsuite.log ||:; cat tests/testsuite.log ||:; exit 1; }
- name: 'make install'
run: set -x; ${ci_MAKE} CPPFLAGS="${OS_SPECIFIC_CPPFLAGS}" install