name: Code Style

on: [push, pull_request, workflow_dispatch]

jobs:
  code_style:
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
            fetch-depth: 0

      - name: Install Requirements
        run: |
          sudo apt update
          sudo apt install -y gcc g++ flip

      - name: Run check
        run: |
            ./tools/travis-ci/install.sh
            ./tools/travis-ci/run.sh
        env:
            OPJ_CI_CHECK_STYLE: 1
            OPJ_CI_SKIP_TESTS: 1
