~naglis/aio_mpv_ipc

6f7abfa6115308e91fd3711e895d8681331f078e — Naglis Jonaitis 11 months ago 33efce4
Use scripts for GitHub actions
M .github/workflows/ci.yml => .github/workflows/ci.yml +5 -27
@@ 9,40 9,18 @@ jobs:
        python: ['3.8']
    steps:
      - uses: actions/checkout@v2

      - name: Set up Python ${{ matrix.python }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python }}

      - name: Install mpv
        run: |
            sudo add-apt-repository ppa:mc3man/mpv-tests -y
            sudo apt-get update -q
            sudo apt-get install mpv

      - name: Install dependencies
        run: |
          curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
          source $HOME/.poetry/env
          poetry install -v

      - name: Install
        run: scripts/ci/install.sh
      - name: Test
        run: |
          source $HOME/.poetry/env
          poetry run pytest -vv --cov aio_mpv_ipc --cov-report term --cov-report xml

        run: scripts/ci/test.sh
      - name: Lint
        run: |
          source $HOME/.poetry/env
          poetry run flake8 aio_mpv_ipc/ tests/
          poetry run black --check aio_mpv_ipc/ tests/
          poetry run bandit -r aio_mpv_ipc/

        run: scripts/ci/lint.sh
      - name: Code coverage
        continue-on-error: true
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
        run: |
          source $HOME/.poetry/env
          poetry run codecov --token ${CODECOV_TOKEN}
        run: scripts/ci/coverage.sh

A scripts/ci/coverage.sh => scripts/ci/coverage.sh +5 -0
@@ 0,0 1,5 @@
#!/usr/bin/env bash
set -euxo pipefail

source $HOME/.poetry/env
poetry run codecov --token ${CODECOV_TOKEN}

A scripts/ci/install.sh => scripts/ci/install.sh +12 -0
@@ 0,0 1,12 @@
#!/usr/bin/env bash
set -euxo pipefail

# Install mpv
sudo add-apt-repository ppa:mc3man/mpv-tests -y
sudo apt-get update -q
sudo apt-get install mpv

# Install poetry
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
source $HOME/.poetry/env
poetry install -v

A scripts/ci/lint.sh => scripts/ci/lint.sh +7 -0
@@ 0,0 1,7 @@
#!/usr/bin/env bash
set -euxo pipefail

source $HOME/.poetry/env
poetry run flake8 aio_mpv_ipc/ tests/
poetry run black --check aio_mpv_ipc/ tests/
poetry run bandit -r aio_mpv_ipc/

A scripts/ci/test.sh => scripts/ci/test.sh +5 -0
@@ 0,0 1,5 @@
#!/usr/bin/env bash
set -euxo pipefail

source $HOME/.poetry/env
poetry run pytest -vv --cov aio_mpv_ipc --cov-report term --cov-report xml