# Citre (https://github.com/universal-ctags/citre) is a readtags frontend for
# Emacs. This workflow runs unit tests of Citre to make sure changes in
# readtags doesn't break the behavior that Citre expects.

# Ref: https://github.com/universal-ctags/citre/issues/58#issuecomment-846229409

name: run Citre tests on GNU/Linux

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

jobs:
  testing:
    runs-on: ubuntu-latest

    env:
      CC: gcc
      READTAGS: '${{ github.workspace }}/readtags'

    steps:
      - uses: actions/checkout@v2
      - name: update package information
        run: sudo apt-get -y -o APT::Immediate-Configure=false update
      - name: install tools and libraries
        run: sudo apt-get -y -o APT::Immediate-Configure=false install pkg-config automake libjansson-dev libyaml-dev libseccomp-dev libxml2-dev
      - name: autogen.sh
        run: ./autogen.sh
      - name: report the version of cc
        run: $CC --version
      - name: report the version of make
        run: make --version
      - name: configure
        run: ./configure
      - name: make
        run: make
      - name: report features
        run: ./ctags --list-features
      - name: install Emacs
        run: sudo apt-get -y -o APT::Immediate-Configure=false install emacs
      - name: checkout Citre repo
        uses: actions/checkout@v2
        with:
          repository: 'universal-ctags/citre'
          path: 'citre'
      - name: run Citre unit tests for ctags backend
        working-directory: 'citre'
        run: make test-ctags
