Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pierky committed Jun 25, 2021
2 parents 27102cb + 521994c commit 18917a9
Show file tree
Hide file tree
Showing 17 changed files with 229 additions and 180 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,68 @@
name: Docker image tests
name: Tests and push to PyPi and DockerHub

on: push

jobs:
tests:
name: Run tests

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.6]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install bgpq3 / bgpq4
run: |
./tests/external_resources/install_bgpq3.sh
./tests/external_resources/install_bgpq4.sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 coveralls nose
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Flake8
run: flake8 pierky/ scripts/

- name: Test CLI
run: ./tests/cli

- name: Test external resources
run: nosetests -vs --tests=tests/external_resources/
env:
TRAVIS: 1

- name: Fetch Docker images used by tests
run: |
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
docker pull pierky/bird:1.6.8
docker pull pierky/bird:2.0.8
docker pull pierky/openbgpd:6.8p1
docker pull pierky/openbgpd:7.0p0
docker pull pierky/exabgp:4.2.7
docker pull nlnetlabs/routinator:v0.8.3
env:
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Tests
run: nosetests -vs -x --tests=tests/static/,tests/live_tests/
env:
TRAVIS: 1

docker-image-tests:
name: Docker image tests

runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -217,3 +275,101 @@ jobs:
egrep 'header.local|footer.local' | \
wc -l | \
grep 2
push_to_pypi:
name: Push to PyPi

needs: tests

runs-on: ubuntu-latest

if: startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.6

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build and push the release
run: >-
python setup.py sdist
# All the tags go to PyPI test
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

# Only non-alpha releases go to the official PyPi
- name: Publish distribution to PyPI (official release)
if: contains(github.ref, 'alpha') != true
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}

push_to_registry:
name: Push Docker image to Docker Hub

needs: [tests, docker-image-tests]

runs-on: ubuntu-latest

if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Get the release
run: echo "::set-output name=CURRENT_RELEASE::$(python -c 'from pierky.arouteserver.version import __version__; print(__version__)')"
id: get_the_release

- name: Is it a stable?
run: echo "::set-output name=IS_STABLE_RELEASE::$(python -c 'from pierky.arouteserver.version import __version__; import re; import sys; re.match(r"^\d+\.\d+\.\d+$", __version__); sys.stdout.write(str(bool(re.match(r"^\d+\.\d+\.\d+$", __version__))))')"
id: is_stable_release

- name: Show the arguments
run: echo "Release ${{ steps.get_the_release.outputs.CURRENT_RELEASE }} - stable ${{ steps.is_stable_release.outputs.IS_STABLE_RELEASE }}"

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push to Docker Hub (current release)
uses: docker/build-push-action@v2
with:
push: true
file: ./docker/Dockerfile
tags: pierky/arouteserver:${{ steps.get_the_release.outputs.CURRENT_RELEASE }}

- name: Push to Docker Hub (latest)
if: steps.is_stable_release.outputs.IS_STABLE_RELEASE == 'True'
uses: docker/build-push-action@v2
with:
push: true
file: ./docker/Dockerfile
tags: pierky/arouteserver:latest

- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
# This must be the DockerHub password, since AToW
# Docker Hub doesn't allow to use tokens to update
# the README.
# https://github.com/peter-evans/dockerhub-description/issues/10
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: pierky/arouteserver
short-description: ARouteServer official Docker images
readme-filepath: ./docker/README.md
64 changes: 0 additions & 64 deletions .github/workflows/docker_publish.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/publish_on_pypi.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/test_external_resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '16 9 * * *'
workflow_dispatch:

jobs:
test_ext_res:
Expand Down
59 changes: 0 additions & 59 deletions .github/workflows/tests.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ Change log

.. note:: **Upgrade notes**: after upgrading, run the ``arouteserver setup-templates`` command to sync the local templates with those distributed with the new version. More details on the `Upgrading <https://arouteserver.readthedocs.io/en/latest/INSTALLATION.html#upgrading>`__ section of the documentation.

next release
------------

- Improvement: add the ``logging`` option to ``--use-local-files`` argument, to allow customization of logging settings.

Details on the documentation: `Site-specific custom configuration files <https://arouteserver.readthedocs.io/en/latest/CONFIG.html#site-specific-custom-configuration-files>`__.

See also `GitHub issue 75 <https://github.com/pierky/arouteserver/issues/75>`_.

1.7.0
-----

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ Blog: https://blog.pierky.com Twitter: `@pierky <https://twitter.com/pierky>`_

.. |Documentation| image:: https://readthedocs.org/projects/arouteserver/badge/?version=latest
:target: https://arouteserver.readthedocs.org/en/latest/?badge=latest
.. |Build Status| image:: https://github.com/pierky/arouteserver/actions/workflows/tests.yml/badge.svg?branch=master
:target: https://github.com/pierky/arouteserver/actions/workflows/tests.yml
.. |Build Status| image:: https://github.com/pierky/arouteserver/actions/workflows/cicd.yml/badge.svg?branch=master
:target: https://github.com/pierky/arouteserver/actions/workflows/cicd.yml
.. |Unique test cases| image:: https://img.shields.io/badge/dynamic/json.svg?uri=https://raw.githubusercontent.com/pierky/arouteserver/master/tests/last.json&label=unique%20test%20cases&query=$.unique_test_cases&colorB=47C327
:target: https://github.com/pierky/arouteserver/blob/master/tests/last
.. |PYPI Version| image:: https://img.shields.io/pypi/v/arouteserver.svg
Expand Down
Loading

0 comments on commit 18917a9

Please sign in to comment.