Skip to content

Commit

Permalink
Add GitHub actions (#120)
Browse files Browse the repository at this point in the history
* add github actions support

* add release workflow

* remove deploy phase from .travis.yml

* configure Python version for setup-python action

* handle pull request events in Github actions

* run github actions in ubuntu-18.04
  • Loading branch information
maksym-nazarenko committed Mar 6, 2021
1 parent 0ee4a94 commit bf9cf20
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 10 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: testcontainers-python
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles(format('requirements/{0}.txt', matrix.python-version)) }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install system requirements
run: |
sudo apt-get install -y --no-install-recommends unixodbc-dev # required for pyodbc
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get -qq update
sudo ACCEPT_EULA=Y apt-get -y install msodbcsql17
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements/${{ matrix.python-version }}.txt
- name: Run checks
run: |
flake8
sphinx-build -nW docs docs/_build/html
py.test -sv --cov-config .coveragerc --cov-report html:skip-covered --cov-report term:skip-covered --cov=testcontainers --tb=short tests/
codecov
41 changes: 41 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Upload Python packages to PyPi
on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-18.04
env:
python-version: 3.8
steps:
- uses: actions/checkout@v2

- name: Setup python ${{ env.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.python-version }}

- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles(format('requirements/{0}.txt', env.python-version)) }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -r requirements/${{ env.python-version }}.txt
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py bdist_wheel
twine upload dist/*
10 changes: 0 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,3 @@ notifications:
email:
recipients:
- sergio_89@ukr.net

deploy:
provider: pypi
user: tillahoffmann
password:
secure: "MoX7m8vD5z9PMzxyf/AW0/GJrjw75K0O5fWyzYDVK0e9fE4en4DVZQXsQ+bI5aVoOfEpAJ/wGgR4t/tsdAXolZxVyK4qM3JKfv75fHcsT1Le++S6daxruTkJY/DbkY6gj9aSMqGX9M5qumeAF4nA7VXxgQ28B0Fc65UASr4tsQ6ekqumCRpqeFMFi7IHdEm2le8J9LSxlNXOGl1QgNkC/ABPAoZiOGn/hdcugaX4BGaorwDk4if8bfonr42pizNfIkMJgCQdU0n+1KqQdm30zD1JHmVOZXryi+QZUiTLHfvpjhIlHUGr7skU0sohUwen0VEbmgezvsF303bMkfQS3zS/GlwVODv6xGFGr7Vp6sYPc3452eB9wWi08lk1evPiyiFzTb4GJR37u9bwoj22/rtePfhXvP4hZs3KXHLDn6zE2LJT+OXSRWb+UD8TqS9kHIGiR7cqRXeTnca9UyGDgAnO/Q6bYvrKcoqb94ElW4VtMvLfwqGAVWYpdD4YdLZp5FoqA+U/1MuYVV81+z8ocem5f3jnuoYfbkKFbTE0wbYozjDIeirc1Bh6ekuODakF4oKcuWdOgnO5ZEobFO45BIM5DUKkOqsfCielWdLx+A8H7v6Y04bIVwCS3NRYEsuXZoBtda3lQVYVSNGeMJUtd0TCPmzolUTTVX3K2YAe6pw="
# Required if building on more than one python version because each build will try to deploy
skip_existing: true
on:
tags: true

0 comments on commit bf9cf20

Please sign in to comment.