name: Tests

on: [pull_request, push]

jobs:
  pylint:
    name: Source code linting
    runs-on: ubuntu-latest
    steps:
    - name: "Clone Repository"
      uses: actions/checkout@v2
    - name: "Run pylint"
      uses: osbuild/koji-osbuild/test@master
      with:
        run: |
          pylint plugins/**/*.py test/**/*.py

  unit:
    name: Unit tests
    runs-on: ubuntu-latest
    steps:
    - name: "Clone Repository"
      uses: actions/checkout@v2
    - name: "Run unit tests"
      uses: osbuild/koji-osbuild/test@master
      with:
        run: |
          pytest --cov-report=xml --cov=osbuild test/unit/
    - name: Send coverage to codecov.io
      run: bash <(curl -s https://codecov.io/bash)

  shellcheck:
    name: "Shellcheck"
    runs-on: ubuntu-latest
    steps:
    - name: "Clone Repository"
      uses: actions/checkout@v2
    - name: "Run ShellCheck"
      uses: ludeeus/action-shellcheck@0.5.0
      with:
        severity: warning

  codespell:
    name: "Spell check"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: codespell-project/actions-codespell@master
        with:
          skip: ./.git,build
