name: Alpine CI
on:
  pull_request:
  push:
  schedule:
    - cron: '0 0 * * 0'
jobs:
  build:
    if: "!contains(github.event.head_commit.message, '[skip alpine ci]')"
    container: alpine:edge
    runs-on: ubuntu-latest
    env:
      CXXFLAGS: -std=${{ matrix.standard }} -Wno-error=non-virtual-dtor -Wno-error=variadic-macros
      TEST_BUILD_MODULES: argon2 geo_maxmind ldap mysql pgsql regex_pcre regex_pcre2 regex_posix regex_re2 regex_stdlib regex_tre sqlite3 ssl_gnutls ssl_mbedtls ssl_openssl sslrehashsignal
    steps:
      - uses: actions/checkout@v4

      - name: Install dependencies
        run: |
          echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
          apk update
          apk add \
            argon2-dev \
            clang \
            g++ \
            git \
            gnutls-dev \
            libmaxminddb-dev \
            libpq-dev \
            make \
            mariadb-dev \
            mbedtls-dev \
            openldap-dev \
            openssl-dev \
            pcre-dev \
            pcre2-dev \
            perl \
            pkgconf \
            re2-dev \
            sqlite-dev \
            tre-dev

      - name: Run test-build
        run: |
          ./tools/test-build ${{ matrix.compiler }}
    strategy:
      fail-fast: false
      matrix:
        compiler:
          - clang++
          - g++
        standard:
          - gnu++98
          - c++17
