Improve cmake workflow specification #13
Workflow file for this run
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: CMake | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: | |
- dev | |
- main | |
workflow_dispatch: | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: release | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare apt | |
shell: bash | |
run: | | |
apt update | |
apt install -y software-properties-common lsb-release | |
apt install -y ca-certificates gpg wget | |
- name: Add Kitware ppa | |
shell: bash | |
run: | | |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | |
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null | |
apt-get update | |
test -f /usr/share/doc/kitware-archive-keyring/copyright || rm /usr/share/keyrings/kitware-archive-keyring.gpg | |
apt-get install -y kitware-archive-keyring | |
- name: Install required libraries | |
shell: bash | |
run: | | |
apt-get install -y cmake libpcap-dev git build-essential libncurses-dev | |
- name: Init repository | |
run: git submodule update --init --recursive | |
- name: Configure CMake | |
run: ./gen_cmake.sh -o _build -${{env.BUILD_TYPE}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build _build | |
- name: Test | |
working-directory: ${{github.workspace}}/_build/tests/src | |
run: ./Tests --gtest_filter=-MANUAL* |