Skip to content

Commit

Permalink
Ren GitHub Actions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Nov 30, 2021
1 parent b0d7104 commit a4897b0
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 2 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: CI

on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 6 * * *' # Daily 6AM UTC build


jobs:

lint:
name: Linter
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Cache PyPI
uses: actions/cache@v2
with:
key: pip-lint-${{ hashFiles('requirements/*.txt') }}
path: ~/.cache/pip
restore-keys: |
pip-lint-
- name: Install dependencies
uses: py-actions/py-dependency-install@v2
with:
path: requirements/test.txt
- name: Generate dists
run: |
pip install build
python -m build
- name: Run linters
run: |
make lint
- name: Run twine checker
run: |
pip install twine bdist_wheel
python setup.py sdist bdist_wheel
twine check dist/*
test:
name: test
needs: [lint]
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
os: [ubuntu]
registry: ['1']
pytest-arg: ['']
include:
- python-version: 3.9
os: windows
registry: '0'
pytest-arg: 'tests/test_integration.py'
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)" # - name: Cache
- name: Cache PyPI
uses: actions/cache@v2
with:
key: pip-ci-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
path: ${{ steps.pip-cache.outputs.dir }}
restore-keys: |
pip-ci-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install dependencies
uses: py-actions/py-dependency-install@v2
with:
path: requirements/test.txt
- name: Start Docker services
if: ${{ matrix.registry == '1' }}
run: |
docker run -d --name aiodocker-test-registry -p 5000:5000 registry:2
docker run -d -p 5001:5001 --name aiodocker-test-registry2 -v `pwd`/tests/certs:/certs -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/certs/htpasswd -e REGISTRY_HTTP_ADDR=0.0.0.0:5001 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt -e REGISTRY_HTTP_TLS_KEY=/certs/registry.key registry:2
- name: Run unittests
env:
COLOR: 'yes'
DOCKER_VERSION: ${{ matrix.docker }}
CI: true
- script: |
python -m pytest -vv --durations=10 ${{ matrix.pytest-arg }}
- name: Upload coverage artifact
uses: neuro-inc/prepare-coverage@v21.9.1
with:
key: unit-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.cmd }}-${{ matrix.registry }}-${{ matrix.pytest-arg }}

deploy:
name: Deploy on PyPI
needs: [lint, unit]
runs-on: ubuntu-latest
# Run only on pushing a tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install build wheel
- name: Build wheels
run: |
python -m build
- name: Release
uses: aio-libs/create-release@v1.2.3
with:
changes_file: CHANGES.rst
name: aiodocker
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
head_line: "{version}\\s+\\({date}\\)\n====+\n?"
1 change: 0 additions & 1 deletion CHANGES/190.feat

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool:pytest]
addopts = --cov=aiodocker -v
addopts = --cov-branch --cov-report xml --cov=aiodocker -v
filterwarnings=error
norecursedirs = dist docs build .tox .eggs venv virtualenv .git
minversion = 3.8.2
Expand Down

0 comments on commit a4897b0

Please sign in to comment.