From e5fbe046f7381aa5399b45e893888b53be5432fe Mon Sep 17 00:00:00 2001 From: Mohamed El Mouctar Haidara Date: Tue, 3 Nov 2020 22:12:13 +0100 Subject: [PATCH] feat: Replace Travis by Github actions (#54) --- .github/workflows/testing.yaml | 61 ++++++++++++++++++++++++++++++++++ .travis.yml | 31 ----------------- README.md | 2 +- 3 files changed, 62 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/testing.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml new file mode 100644 index 00000000..9d12e23c --- /dev/null +++ b/.github/workflows/testing.yaml @@ -0,0 +1,61 @@ +name: Testing + +on: + - push + +jobs: + pytest: + name: Tests Py${{ matrix.python-version }} - Ansible ${{ matrix.ansible-version }} + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [ 3.7, 3.8 ] + ansible-version: [ 2.8.6, 2.9.0, 2.9.14 ] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + name: Setup Python ${{ matrix.python-version }} + with: + python-version: ${{ matrix.python-version }} + + - name: Install prereqs + run: | + pip install ansible==${{ matrix.ansible-version }} virtualenv setuptools wheel coveralls + pip install -r tests/requirements_tests.txt + sudo apt-get install -y graphviz + + - name: Pytest + env: + PY_COLORS: "1" + run: make test + + - name: Upload generated SVGs as artefacts + uses: actions/upload-artifact@v2 + with: + name: generated-svgs-py${{ matrix.python-version }}-ansible${{ matrix.ansible-version }} + path: tests/generated_svg/ + if-no-files-found: error # the tests should generate SVGs files + + - name: Test installation in virtualenv + run: make test_install + + - name: Upload Coverage + run: cd tests && coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: py${{ matrix.python-version }}-ansible${{ matrix.ansible-version }} + COVERALLS_PARALLEL: true + + coveralls: + runs-on: ubuntu-20.04 + name: Finish coverage + needs: pytest + container: python:3-slim # just need a simple python container to finish the coverage + steps: + - name: Coveralls finish + run: pip install coveralls && coveralls --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7e0c9034..00000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: python -python: - - "3.6" - - "3.7" - -env: - - ANSIBLE_VERSION=2.8.6 - - ANSIBLE_VERSION=2.9.0 - - ANSIBLE_VERSION=2.9.5 - -branches: - only: - - master - -before_install: - - sudo apt-get -qq update - - sudo apt-get install -y graphviz - - pip install -U pip setuptools wheel - -install: - - pip install -qUr tests/requirements_tests.txt - - pip install -q ansible==$ANSIBLE_VERSION - - pip freeze - -script: - - make test - - make test_install ANSIBLE_VERSION=$ANSIBLE_VERSION - -after_success: - - pip install -U coveralls - - coveralls diff --git a/README.md b/README.md index 83b1a40e..e08f28d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ansible Playbook Grapher -[![Build Status](https://travis-ci.org/haidaraM/ansible-playbook-grapher.svg?branch=master)](https://travis-ci.org/haidaraM/ansible-playbook-grapher) +![Testing](https://github.com/haidaraM/ansible-playbook-grapher/workflows/Testing/badge.svg) [![PyPI version](https://badge.fury.io/py/ansible-playbook-grapher.svg)](https://badge.fury.io/py/ansible-playbook-grapher) [![Coverage Status](https://coveralls.io/repos/github/haidaraM/ansible-playbook-grapher/badge.svg?branch=master)](https://coveralls.io/github/haidaraM/ansible-playbook-grapher?branch=master)