| 1 |
name: CMake |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ master, ci ] |
| 6 |
pull_request: |
| 7 |
branches: [ master ] |
| 8 |
|
| 9 |
env: |
| 10 |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 11 |
BUILD_TYPE: Release |
| 12 |
CC: clang |
| 13 |
|
| 14 |
jobs: |
| 15 |
ubuntu: |
| 16 |
# The CMake configure and build commands are platform agnostic and should work equally |
| 17 |
# well on Windows or Mac. You can convert this to a matrix build if you need |
| 18 |
# cross-platform coverage. |
| 19 |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
| 20 |
strategy: |
| 21 |
matrix: |
| 22 |
os: [ ubuntu-latest, ubuntu-22.04 ] |
| 23 |
runs-on: ${{ matrix.os }} |
| 24 |
# env: |
| 25 |
# CFLAGS: -Werror |
| 26 |
|
| 27 |
steps: |
| 28 |
- uses: actions/checkout@v2 |
| 29 |
|
| 30 |
- name: Install libevent |
| 31 |
run: | |
| 32 |
sudo apt update |
| 33 |
sudo apt install libevent-dev libsystemd-dev |
| 34 |
|
| 35 |
- name: Create Build Environment |
| 36 |
# Some projects don't allow in-source building, so create a separate build directory |
| 37 |
# We'll use this as our working directory for all subsequent commands |
| 38 |
run: cmake -E make_directory ${{github.workspace}}/build |
| 39 |
|
| 40 |
- name: Configure CMake |
| 41 |
# Use a bash shell so we can use the same syntax for environment variable |
| 42 |
# access regardless of the host operating system |
| 43 |
shell: bash |
| 44 |
working-directory: ${{github.workspace}}/build |
| 45 |
# Note the current convention is to use the -S and -B options here to specify source |
| 46 |
# and build directories, but this is only available with CMake 3.13 and higher. |
| 47 |
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12 |
| 48 |
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 49 |
|
| 50 |
- name: Build |
| 51 |
working-directory: ${{github.workspace}}/build |
| 52 |
shell: bash |
| 53 |
# Execute the build. You can specify a specific target with "--target <NAME>" |
| 54 |
run: cmake --build . --config $BUILD_TYPE |
| 55 |
|
| 56 |
- name: Test DH |
| 57 |
working-directory: ${{github.workspace}}/build/regress/dh |
| 58 |
shell: bash |
| 59 |
run: ./dhtest |
| 60 |
|
| 61 |
- name: Test Parser |
| 62 |
working-directory: ${{github.workspace}}/build/regress/parser |
| 63 |
shell: bash |
| 64 |
run: ./test_parser |
| 65 |
|
| 66 |
macos: |
| 67 |
strategy: |
| 68 |
matrix: |
| 69 |
os: [ macos-latest ] |
| 70 |
runs-on: ${{ matrix.os }} |
| 71 |
|
| 72 |
steps: |
| 73 |
- uses: actions/checkout@v2 |
| 74 |
|
| 75 |
- name: Create Build Environment |
| 76 |
run: cmake -E make_directory ${{github.workspace}}/build |
| 77 |
|
| 78 |
- name: Install dependencies |
| 79 |
run: | |
| 80 |
brew install bison libevent openssl |
| 81 |
echo "/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH |
| 82 |
|
| 83 |
- name: Configure CMake |
| 84 |
shell: bash |
| 85 |
working-directory: ${{github.workspace}}/build |
| 86 |
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DHOMEBREW=yes |
| 87 |
|
| 88 |
- name: Build |
| 89 |
working-directory: ${{github.workspace}}/build |
| 90 |
shell: bash |
| 91 |
run: cmake --build . --config $BUILD_TYPE |
| 92 |
|
| 93 |
- name: Test DH |
| 94 |
working-directory: ${{github.workspace}}/build/regress/dh |
| 95 |
shell: bash |
| 96 |
run: ./dhtest |
| 97 |
|
| 98 |
- name: Test Parser |
| 99 |
working-directory: ${{github.workspace}}/build/regress/parser |
| 100 |
shell: bash |
| 101 |
run: ./test_parser |
| 102 |
|
| 103 |
openbsd: |
| 104 |
runs-on: ubuntu-latest |
| 105 |
steps: |
| 106 |
- name: Bootstrap OpenBSD-latest |
| 107 |
uses: mario-campos/emulate@v1 |
| 108 |
with: |
| 109 |
operating-system: openbsd-latest |
| 110 |
|
| 111 |
- name: Install Dependencies |
| 112 |
run: pkg_add cmake git |
| 113 |
|
| 114 |
- name: Build |
| 115 |
run: | |
| 116 |
git clone --depth=1 https://github.com/openiked/openiked-portable.git |
| 117 |
cd openiked-portable |
| 118 |
[ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}") |
| 119 |
mkdir build; cd build |
| 120 |
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 121 |
make |
| 122 |
cd regress/dh; ./dhtest |
| 123 |
cd ../parser; ./test_parser |
| 124 |
|
| 125 |
freebsd: |
| 126 |
runs-on: ubuntu-latest |
| 127 |
steps: |
| 128 |
- name: Bootstrap FreeBSD-latest |
| 129 |
uses: mario-campos/emulate@v1 |
| 130 |
with: |
| 131 |
operating-system: freebsd-latest |
| 132 |
|
| 133 |
- name: Install Dependencies |
| 134 |
run: pkg install -y cmake libevent git |
| 135 |
|
| 136 |
- name: Build |
| 137 |
run: | |
| 138 |
git clone --depth=1 https://github.com/openiked/openiked-portable.git |
| 139 |
cd openiked-portable |
| 140 |
[ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}") |
| 141 |
mkdir build; cd build |
| 142 |
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 143 |
make |
| 144 |
cd regress/dh; ./dhtest |
| 145 |
cd ../parser; ./test_parser |
| 146 |
|
| 147 |
netbsd: |
| 148 |
runs-on: ubuntu-latest |
| 149 |
steps: |
| 150 |
- name: Bootstrap NetBSD-latest |
| 151 |
uses: mario-campos/emulate@v1 |
| 152 |
with: |
| 153 |
operating-system: netbsd-latest |
| 154 |
|
| 155 |
- name: Build |
| 156 |
run: | |
| 157 |
git clone --depth=1 https://github.com/openiked/openiked-portable.git |
| 158 |
cd openiked-portable |
| 159 |
[ "${{ github.event.pull_request.number }}" = "" ] || (echo "fetching PR ${{ github.event.pull_request.number }}"; git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }} && git checkout "pr-${{ github.event.pull_request.number }}") |
| 160 |
mkdir build; cd build |
| 161 |
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 162 |
make |
| 163 |
cd regress/dh; ./dhtest |
| 164 |
cd ../parser; ./test_parser |