name: ci
on: [push]

jobs:
  ################
  # Verible Lint #
  ################
  verilog:
    name: Verilog Sources
    # This job runs on Linux (fixed ubuntu version)
    runs-on: ubuntu-18.04
    env:
      VERIBLE_VERSION: 0.0-807-g10e7c71
    steps:
    - uses: actions/checkout@v2
    - name: Install Verible
      run: |
        set -e
        mkdir -p build/verible
        cd build/verible
        curl -Ls -o verible.tar.gz https://github.com/google/verible/releases/download/v$VERIBLE_VERSION/verible-v$VERIBLE_VERSION-Ubuntu-18.04-bionic-x86_64.tar.gz
        sudo mkdir -p /tools/verible && sudo chmod 777 /tools/verible
        tar -C /tools/verible -xf verible.tar.gz --strip-components=1
        echo "PATH=$PATH:/tools/verible/bin" >> $GITHUB_ENV
    # Run linter in hw/ip subdir
    - name: Run Lint
      run: |
        echo "::add-matcher::.github/verible-lint-matcher.json"
        find src \
            -not \( -path src/deprecated -prune \) -name "*.sv" | \
            xargs verible-verilog-lint --waiver_files lint/common_cells.style.waiver --rules=-interface-name-style --lint_fatal
        echo "::remove-matcher owner=verible-lint-matcher::"
