Skip to content

Commit 7c91827

Browse files
authored
Move Tests from Travis to Github Actions (#109)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
1 parent 7a37948 commit 7c91827

7 files changed

Lines changed: 88 additions & 52 deletions

File tree

.github/workflows/code_style.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Code Style
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Setup python
11+
uses: actions/setup-python@v2
12+
with:
13+
python-version: 3.7
14+
architecture: x64
15+
- name: Install dependencies
16+
run: |
17+
python -m pip install --upgrade pip
18+
pip install -r requirements/test.txt
19+
pip install tox tox-gh-actions
20+
- name: Test with tox
21+
run: tox -e flake8

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: '3.x'
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install setuptools wheel twine
20+
- name: Build and publish
21+
env:
22+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
twine upload dist/*

.github/workflows/unit_test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Unit Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [ 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 ]
11+
name: Python ${{ matrix.python-version }}
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
architecture: x64
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements/test.txt
23+
pip install tox tox-gh-actions
24+
- name: Test with tox
25+
run: tox
26+
env:
27+
PLATFORM: ${{ matrix.platform }}

.travis.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ Hetzner Cloud Python
22
====================
33

44

5-
.. image:: https://travis-ci.com/hetznercloud/hcloud-python.svg?branch=master
6-
:target: https://travis-ci.com/hetznercloud/hcloud-python
5+
.. image:: https://github.com/hetznercloud/hcloud-python/workflows/Unit%20Tests/badge.svg
6+
:target: https://github.com/hetznercloud/hcloud-cloud-controller-manager/actions
7+
.. image:: https://github.com/hetznercloud/hcloud-python/workflows/Code%20Style/badge.svg
8+
:target: https://github.com/hetznercloud/hcloud-cloud-controller-manager/actions
79
.. image:: https://readthedocs.org/projects/hcloud-python/badge/?version=latest
810
:target: https://hcloud-python.readthedocs.io
911
.. image:: https://img.shields.io/pypi/pyversions/hcloud.svg

requirements/test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ flake8==3.6.0
44
isort==4.3.4
55
mock==2.0.0
66
pytest==3.10.0
7-
tox==3.5.3
7+
tox==3.20.1

tox.ini

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27, py34, py35, py36, py37, flake8
2+
envlist = py27, py35, py36, py37, py38, py39, flake8
33

44
[testenv:flake8]
55
basepython = python
@@ -13,4 +13,11 @@ deps =
1313
commands =
1414
pytest tests/unit {posargs}
1515

16-
16+
[gh-actions]
17+
python =
18+
2.7: py27
19+
3.5: py35
20+
3.6: py36
21+
3.7: py37
22+
3.8: py38
23+
3.9: py39

0 commit comments

Comments
 (0)