Skip to content

Commit

Permalink
PR for #356 migrate Travis to GitHub Workflows (#360)
Browse files Browse the repository at this point in the history
* #356 first version main GH workflow Travis replacement
* #356 main GH workflow - use wheel to speed up Python installs
* #356 main GH workflow - fix test - replace NASA by PDOK WMTS
* #356 main GH workflow - fix doc warnings - finalize
  • Loading branch information
justb4 committed Apr 29, 2021
1 parent 8e95de6 commit 626be41
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 47 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Docker Build

# Triggers a Docker workflow on push events and PRs but
# pushes to DockerHub only for push on the master branch.
# Runs GHC unit tests before DockerHub push.
#
# Author: Just van den Broecke - 2021
#
name: Docker Build ⚓

on:
push:
branches:
Expand All @@ -27,10 +27,10 @@ jobs:

# v2 https://github.com/docker/build-push-action/blob/master/UPGRADE.md
steps:
- name: Checkout
- name: Checkout
uses: actions/checkout@v2

- name: Prepare
- name: Prepare 📦
id: prep
run: |
DOCKER_IMAGE=geopython/geohealthcheck
Expand All @@ -51,20 +51,20 @@ jobs:
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Show Image Settings
- name: Show Image Settings 📦
run: echo "IMAGE=${{ steps.prep.outputs.image }} VERSION=${{ steps.prep.outputs.version }} TAGS=${{ steps.prep.outputs.tags }}"

- name: Set up Docker Buildx
- name: Set up Docker Buildx 📦
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
- name: Login to DockerHub 📦
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker Build only - retain local Image
- name: Docker Build only - retain local Image 📦
uses: docker/build-push-action@v2
with:
context: .
Expand All @@ -76,9 +76,9 @@ jobs:
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: GHC Unit Tests with Docker Image
- name: GHC Unit Tests with Docker Image ⚙️
run: docker run --entrypoint "/run-tests.sh" ${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.version }}

- name: Push to Docker repo (on GH Push only)
- name: Push to Docker repo (on GH Push only) ☁️
if: ${{ github.event_name == 'push' }}
run: docker push ${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.version }}
55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Main GHC CI workflow. Inspired by
# https://github.com/geopython/pycsw/blob/master/.github/workflows/main.yml
#
# Author: Just van den Broecke - 2021
#
name: Main GHC CI ⚙️

on: [ push, pull_request ]

jobs:
main:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- python-version: 3.7
# - python-version: 3.8
steps:
- name: Checkout ✅
uses: actions/checkout@v2

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

- name: Install Requirements 📦
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Setup GHC App and init DB 🗃️
run: |
paver setup
echo -e "admin\ntest\ntest\nyou@example.com\nyou@example.com" | python GeoHealthCheck/models.py create
- name: Flake8 - Verify Coding Conventions ⚙️
run: flake8

- name: Load Fixtures Test Data ⚙️
run: python GeoHealthCheck/models.py load tests/data/fixtures.json y

- name: Run Probes ⚙️
run: python GeoHealthCheck/healthcheck.py

- name: Run Unit Tests ⚙️
run: python tests/run_tests.py

- name: Build Docs 📖
run: cd docs && make html

- name: Cleanup 💯
run: python GeoHealthCheck/models.py drop
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

14 changes: 7 additions & 7 deletions GeoHealthCheck/plugins/resourceauth/resourceauths.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,14 @@ def verify(self):
def encode_auth_header_val(self):
"""
Get encoded authorization header value from config data.
Authorization scheme-specific.
{
Authorization scheme-specific. ::
{
'type': 'Basic',
'data': {
'username': 'the_user',
'password': 'the_password'
}
}
}
:return: None or http Basic auth header value
"""
Expand Down Expand Up @@ -150,13 +149,14 @@ def verify(self):
def encode_auth_header_val(self):
"""
Get encoded authorization header value from config data.
Authorization scheme-specific.
{
Authorization scheme-specific. ::
{
'type': 'Bearer Token',
'data': {
'token': 'the_token'
}
}
}
:return: None or http auth header value
"""
Expand Down
4 changes: 2 additions & 2 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ which needs to be translated in `msgstr'` as seen below. ::
Compiling Language Files
........................

At runtime compiled versions, `*.mo` files, of the language-files are used.
At runtime compiled versions, `.mo` files, of the language-files are used.
Easiest to compile is via: `paver compile_translations` in the project root dir.
This basically calls ``pybabel compile` with the proper options.
Now you can e.g. test your new translations by starting GHC.
Expand All @@ -170,7 +170,7 @@ Missing translations will have `msgstr ""` like in this excerpt: ::
msgid "Status summary"
msgstr ""
Next all empty `msgstr`s can be filled.
Next all empty `msgstr` can be filled.
Updating is easiest using the command `paver update_translations` within the root dir of the project.
This will basically call `pybabel extract` followed by `pybabel update` with the proper parameters.
Expand Down
4 changes: 2 additions & 2 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Use Docker!

When running GHC in long-term production environment the following is recommended:

* use Docker, see the `GHC Docker Readme <https://github.com/geopython/GeoHealthCheck/tree/master/docker>`_
* use Docker, see the `Docker Readme <https://github.com/geopython/GeoHealthCheck/tree/master/docker>`_

Using Docker, especially with Docker Compose (sample files provided) is our #1 recommendation. It saves
all the hassle from installing the requirements, upgrades etc. Docker (Compose) is also used to run the GHC demo site
Expand Down Expand Up @@ -251,7 +251,7 @@ Use virtualenv
..............

This is a general Python-recommendation. Save yourself from classpath and library hells by using `virtualenv`! Starting with python 3.3
a `venv script <https://docs.python.org/3.3/library/venv.html>` is provided and from python 3.6 the `venv module <https://docs.python.org/3/library/venv.html>`
a `venv script <https://docs.python.org/3.3/library/venv.html>`_ is provided and from python 3.6 the `venv module <https://docs.python.org/3/library/venv.html>`_
is included in the standard library.

Use SSL (HTTPS)
Expand Down
6 changes: 3 additions & 3 deletions tests/data/fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"owner": "admin",
"resource_type": "OGC:WMTS",
"active": true,
"title": "NASA Global Imagery Browse Services for EOSDIS",
"url": "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi",
"title": "Dutch Kadaster PDOK WMTS",
"url": "https://geodata.nationaalgeoregister.nl/tiles/service/wmts",
"tags": [
"ows",
"tiling"
Expand All @@ -80,7 +80,7 @@
"owner": "admin",
"resource_type": "OSGeo:TMS",
"active": true,
"title": "Tile Map Service",
"title": "OpenBasisKaart Tile Map Service",
"url": "https://www.openbasiskaart.nl/mapcache/tms/1.0.0/",
"tags": [
"tiling"
Expand Down
2 changes: 1 addition & 1 deletion tests/data/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"resource_type": "OGC:WMTS",
"active": true,
"title": "NASA Global Imagery Browse Services for EOSDIS",
"url": "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi",
"url": "https://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi",
"tags": [
"ows",
"tiling"
Expand Down

0 comments on commit 626be41

Please sign in to comment.