Skip to content

Commit

Permalink
Merge pull request #57 from IGNF/develop
Browse files Browse the repository at this point in the history
Merge 2.2.1 into master
  • Loading branch information
lgrd authored May 3, 2023
2 parents d403450 + bb59a4d commit 610c430
Show file tree
Hide file tree
Showing 60 changed files with 3,201 additions and 668 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Docker GitHub Container Registry

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ "master" ]
# Publish semver tags as releases.
tags: [ '*.*.*' ]
pull_request:
branches: [ "master", "develop" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/debian/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
67 changes: 67 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
pull_request:
branches: [ "master", "develop" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

env:
PYTHON_VERSION: "3.10"

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/*.txt"

- name: Install documentation requirements
run: python -m pip install -U -r requirements/documentation.txt

- name: Build doc using Sphinx
run: sphinx-build -b html -j auto -d docs/_build/cache -q docs docs/_build/html

- name: Setup Pages
uses: actions/configure-pages@v2

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs/_build/html'

deploy:
if: github.event_name != 'pull_request'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
42 changes: 42 additions & 0 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Python 🐍 distribution 📦 to PyPI

on:
release:
types: [released]
pull_request:
branches: [ "master" ]

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/test_pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish Python 🐍 distributions 📦 to TestPyPI

on:
# Runs on pushes targeting the default branch
push:
branches: ["develop"]
pull_request:
branches: [ "develop" ]

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
skip_existing: true
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
57 changes: 57 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

name: Unit tests

on:
pull_request:
paths:
- ".github/workflows/unit-test.yml"
- "**/*.py"

permissions:
contents: read
pull-requests: write

env:
POSTGRES_VERSION: "15"
POSTGIS_VERSION: "3.0"
POSTGRES_DB: ign
POSTGRES_USER: ign
POSTGRES_PASSWORD: ign
POSTGRES_HOST: "172.17.0.1"

jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest

container: 'ghcr.io/ignf/route-graph-generator:latest'

services:
postgis:
image: postgis/postgis # unable to handle var in image name. Was: "postgis/postgis:${POSTGRES_VERSION}-${POSTGIS_VERSION}-alpine"
env:
POSTGRES_DB: ign # mandatory duplicate
POSTGRES_USER: ign # mandatory duplicate
POSTGRES_PASSWORD: ign # mandatory duplicate
ports:
# Maps tcp port 5555 on service container to the host
- 5555:5432

steps:

- uses: actions/checkout@v3

- name: Install test dependencies
run: |
pip install -r requirements/testing.txt
- name: Run test
run: |
python -m pytest
- name: Get Coverage
uses: orgoro/coverage@v3
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.coverage
coverage.xml
junit
Loading

0 comments on commit 610c430

Please sign in to comment.