jirutka/ssh-ldap-pubkey

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI
on:
  - push
  - pull_request

jobs:
  test:
    name: Test on Python ${{ matrix.python }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python:
          - '3.6'
          - '3.7'
          - '3.8'
          - '3.9'
          - '3.10'
    steps:
      - uses: actions/checkout@v3

      - name: Install Python ${{ matrix.python }}
        uses: actions/setup-python@v3
        with:
          python-version: ${{ matrix.python }}

      - name: Install system dependencies
        run: |
          sudo apt update -qq
          sudo apt install -q libldap-dev libsasl2-dev

      - name: Install project requirements
        run: |
          pip install -U -r requirements.txt
          python3 setup.py install

      - name: Run tests
        run: py.test --cov=ssh_ldap_pubkey --cov-report term -vv

      - name: Run linter
        run: pycodestyle

  publish:
    name: Publish to PyPI
    if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push'
    needs: [test]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-python@v3
        with:
          python-version: '3.10'

      - name: Build source tarball
        run: python3 setup.py sdist

      - name: Publish package to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}