define target, try matrix #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
jobs: | |
linux: | |
name: Linux | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [gcc, clang] | |
env: | |
CC: ${{ matrix.compiler }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: sudo apt-get install libbluetooth-dev libusb-1.0-0-dev | |
- run: autoreconf --install --force | |
- run: ./configure --prefix=/usr | |
- run: make | |
- run: make distcheck | |
- name: Package artifacts | |
run: | | |
make install DESTDIR=$PWD/artifacts | |
tar -czf ${{ github.job }}-${{ matrix.compiler }}.tar.gz -C artifacts usr | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.job }}-${{ matrix.compiler }} | |
path: ${{ github.job }}-${{ matrix.compiler }}.tar.gz | |
mac-x86_64: | |
name: Mac (x86_64) | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [gcc, clang] | |
env: | |
CC: ${{ matrix.compiler }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: brew install autoconf automake libtool hidapi libusb | |
- run: autoreconf --install --force | |
- run: ./configure --prefix=/usr | |
- run: make | |
- run: make distcheck | |
- name: Package artifacts | |
run: | | |
make install DESTDIR=$PWD/artifacts | |
tar -czf ${{ github.job }}-${{ matrix.compiler }}-x86_64.tar.gz -C artifacts usr | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.job }}-${{ matrix.compiler }}-x86_64 | |
path: ${{ github.job }}-${{ matrix.compiler }}-x86_64.tar.gz | |
mac-arm64: | |
name: Mac (arm64) | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [gcc, clang] | |
env: | |
CC: 'clang' | |
CFLAGS: '-target arm64-apple-macos11' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: brew install autoconf automake libtool hidapi libusb | |
- run: autoreconf --install --force | |
- run: ./configure --prefix=/usr --host=x86_64-apple-darwin --build=x86_64-apple-darwin --target=aarch64-apple-darwin | |
- run: make | |
- run: make distcheck | |
- name: Package artifacts | |
run: | | |
make install DESTDIR=$PWD/artifacts | |
tar -czf ${{ github.job }}-${{ matrix.compiler }}-arm64.tar.gz -C artifacts usr | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.job }}-${{ matrix.compiler }}-arm64 | |
path: ${{ github.job }}-${{ matrix.compiler }}-arm64.tar.gz | |
windows: | |
name: Windows | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [i686, x86_64] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 mingw-w64-tools | |
- name: Install libusb | |
env: | |
LIBUSB_VERSION: 1.0.26 | |
run: | | |
wget -c https://github.com/libusb/libusb/archive/refs/tags/v${LIBUSB_VERSION}.tar.gz | |
tar xzf v${LIBUSB_VERSION}.tar.gz | |
pushd libusb-${LIBUSB_VERSION} | |
autoreconf --install --force | |
./configure --host=${{ matrix.arch }}-w64-mingw32 --prefix=/usr | |
make | |
make install DESTDIR=$PWD/../artifacts | |
popd | |
- name: Install hidapi | |
env: | |
HIDAPI_VERSION: 0.12.0 | |
run: | | |
wget -c https://github.com/libusb/hidapi/archive/refs/tags/hidapi-${HIDAPI_VERSION}.tar.gz | |
tar xzf hidapi-${HIDAPI_VERSION}.tar.gz | |
pushd hidapi-hidapi-${HIDAPI_VERSION} | |
autoreconf --install --force | |
./configure --host=${{ matrix.arch }}-w64-mingw32 --prefix=/usr LDFLAGS='-static-libgcc' | |
make | |
make install DESTDIR=$PWD/../artifacts | |
popd | |
- run: autoreconf --install --force | |
- run: ./configure --host=${{ matrix.arch }}-w64-mingw32 --prefix=/usr | |
env: | |
PKG_CONFIG_LIBDIR: ${{ github.workspace }}/artifacts/usr/lib/pkgconfig | |
PKG_CONFIG_SYSROOT_DIR: ${{ github.workspace }}/artifacts | |
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS: 1 | |
PKG_CONFIG_ALLOW_SYSTEM_LIBS: 1 | |
- run: make | |
- run: make distcheck | |
- name: Package artifacts | |
run: | | |
make install DESTDIR=$PWD/artifacts | |
tar -czf ${{ github.job }}-${{ matrix.arch }}.tar.gz -C artifacts usr | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.job }}-${{ matrix.arch }} | |
path: ${{ github.job }}-${{ matrix.arch }}.tar.gz | |
msvc: | |
name: Visual Studio | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [x86, x64] | |
env: | |
CONFIGURATION: Release | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
install: autoconf automake libtool pkg-config make gcc | |
- run: | | |
autoreconf --install --force | |
./configure --prefix=/usr | |
make -C src revision.h | |
shell: msys2 {0} | |
- uses: microsoft/setup-msbuild@v1 | |
- run: msbuild -m -p:Platform=${{ matrix.platform }} -p:Configuration=${{ env.CONFIGURATION }} contrib/msvc/libdivecomputer.vcxproj | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.job }}-${{ matrix.platform }} | |
path: contrib/msvc/${{ matrix.platform }}/${{ env.CONFIGURATION }}/bin | |
android: | |
name: Android | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
autoreconf --install --force | |
./configure --prefix=/usr | |
make -C src revision.h | |
- run: $ANDROID_NDK/ndk-build -C contrib/android NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.job }} | |
path: contrib/android/libs |