CI #915
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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: '-k test_integration' | |
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 }} | |
run: | | |
python -m pytest -vv --durations=10 ${{ matrix.pytest-arg }} | |
- name: Upload coverage artifact | |
uses: neuro-inc/[email protected] | |
with: | |
key: unit-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.cmd }}-${{ matrix.registry }} | |
check: | |
# All's good, upload coverage (also good for branch protection rule) | |
name: Check | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.sha }} | |
- name: Upload coverage | |
uses: neuro-inc/[email protected] | |
deploy: | |
name: Deploy on PyPI | |
needs: [lint, test] | |
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/[email protected] | |
with: | |
changes_file: CHANGES.rst | |
name: aiodocker | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pypi_token: ${{ secrets.PYPI_TOKEN }} | |
head_line: "{version}\\s+\\({date}\\)\n====+\n?" |