From dbc21e15caad6342e80779e34ab813c4e2bf9ee1 Mon Sep 17 00:00:00 2001 From: Il'ya Date: Sun, 10 Nov 2019 02:24:48 +0300 Subject: [PATCH] Actions (#133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial actions * Использование pipenv и codecov в actions * Добавлены workflows на покрытие кода, тестирование на разных системах и версиях Python, тестирование PRs * Добавлена загрузка на PyPI * Попытка исправить workflow #1 * Попытка исправить workflow #2 * Исправление workflow --- .github/workflows/codecov.yml | 38 +++++++++++++++++++++++++++++++++ .github/workflows/full_test.yml | 30 ++++++++++++++++++++++++++ .github/workflows/pypi.yml | 29 +++++++++++++++++++++++++ .github/workflows/test.yml | 30 ++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 .github/workflows/codecov.yml create mode 100644 .github/workflows/full_test.yml create mode 100644 .github/workflows/pypi.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..b2be0a0 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,38 @@ +name: Codecov + +on: + push: + branches: + - master + +jobs: + pytest: + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ubuntu-latest] + python-version: [3.8] + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pipenv + pipenv install --dev --deploy --system + shell: bash + - name: Test with pytest and generate coverage + run: | + pytest -v --cov=./ + shell: bash + - name: Submit coverage + run: | + if [ "$CODECOV_TOKEN" != "" ]; then + codecov -F github -t $CODECOV_TOKEN --name "${{ matrix.os }}-${{ matrix.python-version }}" + fi + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + shell: bash diff --git a/.github/workflows/full_test.yml b/.github/workflows/full_test.yml new file mode 100644 index 0000000..377e402 --- /dev/null +++ b/.github/workflows/full_test.yml @@ -0,0 +1,30 @@ +name: Full test + +on: + pull_request: + branches: + - master + +jobs: + pytest: + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + python-version: [3.6, 3.7, 3.8] + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pipenv + pipenv install --dev --deploy --system + shell: bash + - name: Test with pytest + run: | + pytest -vv + shell: bash diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..f6e8044 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,29 @@ +name: Upload to PyPI + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: [3.8] + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pipenv + pipenv install --dev --deploy --system + shell: bash + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* + shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..be0aa25 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test + +on: + pull_request: + branches: + - development + +jobs: + pytest: + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ubuntu-latest] + python-version: [3.8] + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pipenv + pipenv install --dev --deploy --system + shell: bash + - name: Test with pytest + run: | + pytest -vv + shell: bash