Skip to content

Commit bf9cf20

Browse files
Add GitHub actions (#120)
* 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
1 parent 0ee4a94 commit bf9cf20

File tree

3 files changed

+86
-10
lines changed

3 files changed

+86
-10
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: testcontainers-python
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master ]
7+
8+
jobs:
9+
build:
10+
strategy:
11+
matrix:
12+
python-version: [3.5, 3.6, 3.7, 3.8]
13+
runs-on: ubuntu-18.04
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Cache Python dependencies
21+
uses: actions/cache@v2
22+
with:
23+
path: ~/.cache/pip
24+
key: ${{ runner.os }}-pip-${{ hashFiles(format('requirements/{0}.txt', matrix.python-version)) }}
25+
restore-keys: |
26+
${{ runner.os }}-pip-
27+
${{ runner.os }}-
28+
- name: Install system requirements
29+
run: |
30+
sudo apt-get install -y --no-install-recommends unixodbc-dev # required for pyodbc
31+
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
32+
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
33+
sudo apt-get -qq update
34+
sudo ACCEPT_EULA=Y apt-get -y install msodbcsql17
35+
- name: Install Python dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install wheel
39+
pip install -r requirements/${{ matrix.python-version }}.txt
40+
- name: Run checks
41+
run: |
42+
flake8
43+
sphinx-build -nW docs docs/_build/html
44+
py.test -sv --cov-config .coveragerc --cov-report html:skip-covered --cov-report term:skip-covered --cov=testcontainers --tb=short tests/
45+
codecov

.github/workflows/pypi-release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Upload Python packages to PyPi
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-18.04
10+
env:
11+
python-version: 3.8
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Setup python ${{ env.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ env.python-version }}
19+
20+
- name: Cache Python dependencies
21+
uses: actions/cache@v2
22+
with:
23+
path: ~/.cache/pip
24+
key: ${{ runner.os }}-pip-${{ hashFiles(format('requirements/{0}.txt', env.python-version)) }}
25+
restore-keys: |
26+
${{ runner.os }}-pip-
27+
${{ runner.os }}-
28+
29+
- name: Install Python dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install setuptools wheel twine
33+
pip install -r requirements/${{ env.python-version }}.txt
34+
35+
- name: Build and publish
36+
env:
37+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
38+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
39+
run: |
40+
python setup.py bdist_wheel
41+
twine upload dist/*

.travis.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,3 @@ notifications:
3737
email:
3838
recipients:
3939
40-
41-
deploy:
42-
provider: pypi
43-
user: tillahoffmann
44-
password:
45-
secure: "MoX7m8vD5z9PMzxyf/AW0/GJrjw75K0O5fWyzYDVK0e9fE4en4DVZQXsQ+bI5aVoOfEpAJ/wGgR4t/tsdAXolZxVyK4qM3JKfv75fHcsT1Le++S6daxruTkJY/DbkY6gj9aSMqGX9M5qumeAF4nA7VXxgQ28B0Fc65UASr4tsQ6ekqumCRpqeFMFi7IHdEm2le8J9LSxlNXOGl1QgNkC/ABPAoZiOGn/hdcugaX4BGaorwDk4if8bfonr42pizNfIkMJgCQdU0n+1KqQdm30zD1JHmVOZXryi+QZUiTLHfvpjhIlHUGr7skU0sohUwen0VEbmgezvsF303bMkfQS3zS/GlwVODv6xGFGr7Vp6sYPc3452eB9wWi08lk1evPiyiFzTb4GJR37u9bwoj22/rtePfhXvP4hZs3KXHLDn6zE2LJT+OXSRWb+UD8TqS9kHIGiR7cqRXeTnca9UyGDgAnO/Q6bYvrKcoqb94ElW4VtMvLfwqGAVWYpdD4YdLZp5FoqA+U/1MuYVV81+z8ocem5f3jnuoYfbkKFbTE0wbYozjDIeirc1Bh6ekuODakF4oKcuWdOgnO5ZEobFO45BIM5DUKkOqsfCielWdLx+A8H7v6Y04bIVwCS3NRYEsuXZoBtda3lQVYVSNGeMJUtd0TCPmzolUTTVX3K2YAe6pw="
46-
# Required if building on more than one python version because each build will try to deploy
47-
skip_existing: true
48-
on:
49-
tags: true

0 commit comments

Comments
 (0)