name: indentation

on: [ push, pull_request]

jobs:
  indentation:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Install ocp-indent
        run: sudo apt install ocp-indent

      - name: Run pre-commit hook on changes since last push
        run: git reset --soft ${{ github.event.before }} && ./scripts/hooks/pre-commit

name: indentation

on: [ push, pull_request]

jobs:
  indentation:
    strategy: # remove?
      matrix:
        os:
          - ubuntu-latest
        ocaml-compiler:
          - 4.12.0 # setup-ocaml@v1 does not support 4.12.x for ocaml-version

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      # reuse tests.yml or depend on it to not have to setup OCaml? https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-an-action-in-the-same-repository-as-the-workflow

      # rely on cache for now
      - name: Cache opam switch # https://github.com/marketplace/actions/cache
        uses: actions/cache@v2
        with:
          # A list of files, directories, and wildcard patterns to cache and restore
          path: |
            ~/.opam
            _opam
          # Key for restoring and saving the cache
          key: opam-ocp-indent-${{ runner.os }}-${{ matrix.ocaml-compiler }}

      - name: Set up OCaml ${{ matrix.ocaml-compiler }}
        uses: ocaml/setup-ocaml@v1
        with:
          ocaml-version: ${{ matrix.ocaml-compiler }}

      - name: Install ocp-indent
        run: opam install -y ocp-indent

      - name: Run pre-commit hook on changes since last push
        run: git reset --soft ${{ github.event.before }} && ./scripts/hooks/pre-commit

Revert "apt install ocp-indent instead of via opam"
Revert "apt install ocp-indent instead of via opam"

This reverts commit df2d401a6838b710517c07c6e8ea771ea7129b01.

https://github.com/goblint/analyzer/pull/308#issuecomment-889724301:

In the run https://github.com/goblint/analyzer/runs/3199968802, we have the error message

```
ocp-indent file: src/analyses/arinc.ml, lines: 122
ocp-indent: internal error, uncaught exception:
            Failure("Config file not found - neither /etc/ocamlfind.conf nor the directory /etc/ocamlfind.conf.d")
```
