name: C/C++ CI on: push: branches: [ master ] pull_request: branches: [ master ] permissions: contents: read jobs: build: strategy: fail-fast: false matrix: include: - os: ubuntu-latest configuration: Release compiler: gcc - os: ubuntu-latest configuration: Debug compiler: gcc - os: ubuntu-latest configuration: Release compiler: clang - os: ubuntu-latest configuration: Debug compiler: clang - os: macos-latest configuration: Release compiler: clang - os: macos-latest configuration: Debug compiler: clang runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v6 - name: Install dependencies on Ubuntu if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y autoconf automake autopoint gettext git libtool make texinfo if [ "${{ matrix.compiler }}" == "gcc" ]; then sudo apt-get install -y g++; fi if [ "${{ matrix.compiler }}" == "clang" ]; then sudo apt-get install -y clang; fi - name: Install dependencies on macOS if: matrix.os == 'macos-latest' run: | brew install autoconf automake gettext libtool texinfo for package in gettext libtool texinfo; do echo "$(brew --prefix "${package}")/bin" >> "${GITHUB_PATH}" done echo "ACLOCAL_PATH=$(brew --prefix gettext)/share/aclocal" >> "${GITHUB_ENV}" echo "LIBTOOLIZE=glibtoolize" >> "${GITHUB_ENV}" echo "CPPFLAGS=-I$(brew --prefix gettext)/include" >> "${GITHUB_ENV}" echo "LDFLAGS=-L$(brew --prefix gettext)/lib" >> "${GITHUB_ENV}" - name: Run autogen run: ./autogen.sh - name: Configure run: | if [ "${{ matrix.compiler }}" == "gcc" ]; then export CC=gcc CXX=g++; fi if [ "${{ matrix.compiler }}" == "clang" ]; then export CC=clang CXX=clang++; fi if [ "${{ matrix.configuration }}" == "Release" ]; then export CFLAGS="-O2" CXXFLAGS="-O2"; else export CFLAGS="-g -O0" CXXFLAGS="-g -O0"; fi ./configure - name: Build run: make - name: Run checks run: make check autotools: needs: build if: always() runs-on: ubuntu-latest permissions: contents: read statuses: write steps: - name: Report autotools result uses: actions/github-script@v9 with: script: | const buildResult = '${{ needs.build.result }}'; const state = buildResult === 'success' ? 'success' : 'failure'; const description = state === 'success' ? 'Autotools matrix successful' : `Autotools matrix ${buildResult}`; if (context.eventName === 'push' && context.ref === 'refs/heads/master') { await github.rest.repos.createCommitStatus({ owner: context.repo.owner, repo: context.repo.repo, sha: context.sha, state, context: 'autotools', description, target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' }); } if (state !== 'success') { core.setFailed(description); }