github-actions: replace autotools by cmake

pull/527/head
Marc Kleine-Budde 2024-05-28 08:27:53 +02:00
parent db2fe6a605
commit bc88e89caf
3 changed files with 66 additions and 19 deletions

View File

@ -1,19 +0,0 @@
name: C with autotools
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: autogen
run: ./autogen.sh
- name: configure
run: ./configure
- name: make
run: make
- name: make distcheck
run: make distcheck

59
.github/workflows/compile.yml vendored 100644
View File

@ -0,0 +1,59 @@
name: native and cross
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
release:
- "ubuntu:20.04"
- "ubuntu:22.04"
- "ubuntu:24.04"
- "ubuntu:rolling"
- "debian:oldstable-slim"
- "debian:stable-slim"
- "debian:testing-slim"
- "debian:unstable-slim"
steps:
- uses: actions/checkout@v4
- name: Prepare ${{ matrix.release }} container
run: |
podman version
podman run --name stable -di --userns=keep-id:uid=1000,gid=1000 -v "$PWD":/home -w /home ${{ matrix.release }} bash
podman exec -i stable uname -a
podman exec -i stable id
podman exec -i -u root stable apt update
podman exec -e DEBIAN_FRONTEND='noninteractive' -i -u root stable apt install -o APT::Install-Suggests=false -qy \
clang \
cmake \
gcc \
make
- name: Configure & Build with gcc
env:
cc: gcc
run: |
podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${cc} -DENABLE_WERROR=ON -B build-${cc}
podman exec -i stable cmake --build build-${cc}
- name: Configure & Build with clang
env:
cc: clang
run: |
podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${cc} -DENABLE_WERROR=ON -B build-${cc}
podman exec -i stable cmake --build build-${cc}
- name: Show logs
if: ${{ failure() }}
run: |
for log in build-*/CMakeFiles/{CMakeOutput.log,CMakeConfigureLog.yaml}; do \
if [ -e ${log} ]; then \
echo "---------------- ${log} ----------------"; \
cat ${log}; \
fi; \
done

View File

@ -12,6 +12,13 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif()
# Add an option to enable treating warnings as errors
option(ENABLE_WERROR "Treat all compiler warnings as errors" OFF)
if(ENABLE_WERROR)
add_compile_options(-Werror)
endif()
add_definitions(-D_GNU_SOURCE) add_definitions(-D_GNU_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses")