Skip to content

Commit

Permalink
Github Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Dec 17, 2020
1 parent 05061c2 commit b512939
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 72 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
@@ -0,0 +1,2 @@
[run]
relative_files = True
128 changes: 102 additions & 26 deletions .github/workflows/python-package.yml
@@ -1,39 +1,115 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.5', '3.6', '3.7', '3.8']
test-python:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls
- name: Test
run: |
coverage run --source=asn1tools setup.py test
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop

test-python-sdist:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
pip install -r requirements.txt
- name: Test
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
make test-sdist
test-c:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
pytest
sudo apt-get install -qq valgrind -y
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test
run: |
make test-c
make -C examples/benchmarks/c_source
(cd tests && bash <(curl -s https://codecov.io/bash) -X coveragepy)
examples:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test
run: |
(cd examples/benchmarks/packages && wget https://github.com/ANSSI-FR/pycrate/archive/master.zip && unzip -qq master.zip)
env PYTHONPATH=.:examples/benchmarks/packages/pycrate-master python examples/benchmarks/packages/ber.py
env PYTHONPATH=.:examples/benchmarks/packages/pycrate-master python examples/benchmarks/packages/uper.py
env PYTHONPATH=. python examples/benchmarks/codecs.py
env PYTHONPATH=. python examples/benchmarks/question/question.py
env PYTHONPATH=. python examples/hello_world.py
env PYTHONPATH=. python examples/x509_pem.py
env PYTHONPATH=. python examples/compact_extensions_uper/main.py
env PYTHONPATH=. python examples/programming_types/main.py
release:
needs: [test-python, test-python-sdist, test-c, examples]
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
git clean -dfx
python -m build --sdist --outdir dist/ .
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
password: ${{ secrets.pypi_password }}
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions README.rst
@@ -1,4 +1,3 @@
|buildstatus|_
|coverage|_
|codecov|_
|nala|_
Expand Down Expand Up @@ -399,9 +398,6 @@ Encodings
- `Overview of the JSON Encoding Rules (JER)
<http://www.oss.com/asn1/resources/asn1-papers/Overview_of_JER.pdf>`_

.. |buildstatus| image:: https://travis-ci.org/eerimoq/asn1tools.svg?branch=master
.. _buildstatus: https://travis-ci.org/eerimoq/asn1tools

.. |coverage| image:: https://coveralls.io/repos/github/eerimoq/asn1tools/badge.svg?branch=master
.. _coverage: https://coveralls.io/github/eerimoq/asn1tools

Expand Down

0 comments on commit b512939

Please sign in to comment.