Skip to content

Commit

Permalink
Merge pull request #32 from hartwork/cmake-linux-msys2
Browse files Browse the repository at this point in the history
CMake build system + msys2 windows binaries CI
  • Loading branch information
gkdr authored Jan 31, 2022
2 parents 86f0317 + 1e5cb97 commit 31f6922
Show file tree
Hide file tree
Showing 11 changed files with 418 additions and 214 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ on:

jobs:
checks:
name: Build for Linux (${{ matrix.libsignal }} libsignal)
name: Build for Linux (shared=${{ matrix.BUILD_SHARED_LIBS }}, pthreads=${{ matrix.AXC_WITH_PTHREADS }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
libsignal: ['system', 'bundled']
BUILD_SHARED_LIBS: ['ON', 'OFF']
AXC_WITH_PTHREADS: ['ON', 'OFF']
steps:

- uses: actions/[email protected]

- name: Install build dependencies (all but libsignal-protocol-c)
- name: Install build dependencies
run: |-
set -x
sudo apt-get update
Expand All @@ -29,37 +31,41 @@ jobs:
libcmocka-dev \
libgcrypt20-dev \
libglib2.0-dev \
libsqlite3-dev
libsignal-protocol-c-dev \
libsqlite3-dev \
ninja-build
- name: Install build dependency libsignal-protocol-c
if: ${{ matrix.libsignal == 'system' }}
- name: Configure
run: |-
sudo apt-get install --yes --no-install-recommends -V \
libsignal-protocol-c-dev
- name: Fetch Git submodule for build dependency libsignal-protocol-c
if: ${{ matrix.libsignal == 'bundled' }}
run: |-
git submodule update --init --recursive
set -x
cmake \
-B build \
-G Ninja \
-DAXC_WITH_PTHREADS=${{ matrix.AXC_WITH_PTHREADS }} \
-DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} \
-D_AXC_WITH_COVERAGE=ON
- name: Build
run: |-
set -x
make -j $(nproc) all build/libaxc-nt.a
ninja -v -C build all
cat build/libaxc.pc
- name: Test
run: |-
make coverage # includes tests
set -x
CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
ninja -C build coverage
- name: Install
run: |-
set -x -o pipefail
make DESTDIR="${PWD}"/ROOT install
DESTDIR="${PWD}"/ROOT ninja -v -C build install
find ROOT/ -not -type d | sort | xargs ls -l
- name: Store coverage HTML report
uses: actions/[email protected]
with:
name: coverage_${{ matrix.libsignal }}
path: coverage/
name: axc_coverage_shared_${{ matrix.BUILD_SHARED_LIBS }}_pthreads_${{ matrix.AXC_WITH_PTHREADS }}
path: build/coverage*.html
if-no-files-found: error
80 changes: 80 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright (c) 2022 Sebastian Pipping <[email protected]>
# Licensed under the GPL v2 or later

name: Build for Windows

on:
pull_request:
push:
schedule:
- cron: '0 2 * * 5' # Every Friday at 2am

jobs:
checks:
name: Build for Windows (shared=${{ matrix.BUILD_SHARED_LIBS }}, pthreads=${{ matrix.AXC_WITH_PTHREADS }})
runs-on: windows-2019
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
BUILD_SHARED_LIBS: ['ON', 'OFF']
AXC_WITH_PTHREADS: ['ON', 'OFF']
steps:

- uses: actions/[email protected]

- name: Install build dependencies
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
install: |
cmake
mingw-w64-i686-cmocka
mingw-w64-i686-glib2
mingw-w64-i686-libgcrypt
mingw-w64-i686-libsignal-protocol-c
mingw-w64-i686-sqlite3
mingw-w64-i686-toolchain
ninja
- name: Configure
run: |-
set -x
cmake \
-B build \
-G Ninja \
-DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_SYSTEM_NAME=Windows -DWIN32=ON -DMINGW=ON \
-DAXC_WITH_PTHREADS=${{ matrix.AXC_WITH_PTHREADS }} \
-DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} \
-D_AXC_WITH_COVERAGE=ON
- name: Build
run: |-
set -x
ninja -v -C build all
cat build/libaxc.pc
- name: Test (KNOWN TO FAIL)
run: |-
set -x
CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test || true # TODO fix tests
# Note: msys2 does not come with a package for gcovr, yet(?)
# ninja -C build coverage
- name: Install
run: |-
set -x -o pipefail
DESTDIR="${PWD}"/ROOT ninja -v -C build install
find ROOT/ -not -type d | sort | xargs ls -l
- name: Store Windows binaries
uses: actions/[email protected]
with:
name: axc_win32bin_shared_${{ matrix.BUILD_SHARED_LIBS }}_pthreads_${{ matrix.AXC_WITH_PTHREADS }}
path: |
build/*.a
build/*.dll
build/*.exe
if-no-files-found: error
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
- Fix the build for users without libsignal-protocol-c installed system-wide ([#31](https://github.com/gkdr/axc/pull/31)) (thanks, [@hartwork](https://github.com/hartwork)!)
- The example code is runnable again, and some memory leaks ([#14](https://github.com/gkdr/axc/pull/14)) (thanks, [@fbrausse](https://github.com/fbrausse)!)
- Compiler warnings for test files.
- Add missing field `Requires.private:` to auto-generated pkg-config file `libaxc.pc` ([#32](https://github.com/gkdr/axc/pull/32)) (thanks, [@hartwork](https://github.com/hartwork)!)

### Changed
- Migrate build system from a Makefile to CMake ([#32](https://github.com/gkdr/axc/pull/32)) (thanks, [@hartwork](https://github.com/hartwork)!)

### Infrastructure
- Cover Linux build by GitHub Actions CI ([#31](https://github.com/gkdr/axc/pull/31)) (thanks, [@hartwork](https://github.com/hartwork)!)
- Cover Windows build by GitHub Actions CI using msys2 ([#32](https://github.com/gkdr/axc/pull/32)) (thanks, [@hartwork](https://github.com/hartwork)!)

## [0.3.6] - 2021-09-06
### Fixed
Expand Down
Loading

0 comments on commit 31f6922

Please sign in to comment.