name: run units target on AlpineLinux

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  testing:
    strategy:
      fail-fast: false
      matrix:
        tag: ['3.18','3.17','3.16','3.19']

    runs-on: ubuntu-latest

    container: alpine:${{ matrix.tag }}

    steps:
      - run: apk add libc-dev gcc make automake autoconf pkgconf python3 file diffutils git pcre2-dev jansson-dev yaml-dev libxml2-dev

      # this is to fix https://github.com/actions/checkout/issues/760
      - run: git config --global --add safe.directory /__w/ctags/ctags

      - uses: actions/checkout@v4

      - run: cc --version

      - run: ./autogen.sh
      - run: ./configure --prefix=/usr
      - run: make
      - run: make install
      - run: file /usr/bin/ctags
      - run: ctags --version
      - run: make check V=1
      - run: make roundtrip
