Skip to content

Commit

Permalink
Configure gh-pages for sphinx (#11)
Browse files Browse the repository at this point in the history
- configure gh-pages via workflow to create sphinx autodocs
- clean-up workflow files and add badges to readme
- see docs at https://robert-koch-institut.github.io/mex-common
  • Loading branch information
cutoffthetop authored Jul 25, 2023
1 parent 2c60ed2 commit 6c55306
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 38 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/cve-scan.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# adapted from: https://raw.githubusercontent.com/intel/cve-bin-tool/main/doc/how_to_guides/cve_scanner_gh_action.yml
name: CVE scanner
name: CVE Scan

on:
push:
pull_request:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:

jobs:
scan:
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Documentation

on:
push:
branches: ["main"]
workflow_dispatch:

env:
PIP_NO_OPTION: on
PIP_NO_CLEAN: on
PIP_PREFER_BINARY: on

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Cache requirements
uses: actions/cache@v3
env:
cache-name: cache-requirements
with:
path: ~/.cache/pip
key: ${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ env.cache-name }}-
- name: Cache poetry
uses: actions/cache@v3
env:
cache-name: cache-poetry
with:
path: ~/.cache/pip
key: ${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ env.cache-name }}-
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Setup pages
uses: actions/configure-pages@v3

- name: Install requirements
run: make install

- name: Run sphinx
run: make docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./docs/dist

deploy:
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@v2
41 changes: 41 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Linting

on:
push:
workflow_dispatch:

env:
PIP_NO_OPTION: on
PIP_NO_CLEAN: on
PIP_PREFER_BINARY: on

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Cache requirements
uses: actions/cache@v3
env:
cache-name: cache-requirements
with:
path: ~/.cache/pip
key: ${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ env.cache-name }}-
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install requirements
run: make setup

- name: Run linters
run: make linter
38 changes: 6 additions & 32 deletions .github/workflows/default.yml → .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,15 @@
name: default
on: [push]
name: Testing

on:
push:
workflow_dispatch:

env:
PIP_NO_OPTION: on
PIP_NO_CLEAN: on
PIP_PREFER_BINARY: on

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Cache requirements
uses: actions/cache@v3
env:
cache-name: cache-requirements
with:
path: ~/.cache/pip
key: ${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ env.cache-name }}-
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install requirements
run: make setup

- name: Run linters
run: make linter

test:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PHONY: all test setup hooks install pytest linter build docs
.PHONY: all test setup hooks install pytest linter build docs
all: install test
test: linter pytest

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Common library for MEx python projects.

[![testing](https://github.com/robert-koch-institut/mex-common/actions/workflows/testing.yml/badge.svg)](https://github.com/robert-koch-institut/mex-common/actions/workflows/testing.yml)
[![linting](https://github.com/robert-koch-institut/mex-common/actions/workflows/linting.yml/badge.svg)](https://github.com/robert-koch-institut/mex-common/actions/workflows/linting.yml)
[![cve-scan](https://github.com/robert-koch-institut/mex-common/actions/workflows/cve-scan.yml/badge.svg)](https://github.com/robert-koch-institut/mex-common/actions/workflows/cve-scan.yml)
[![documentation](https://github.com/robert-koch-institut/mex-common/actions/workflows/documentation.yml/badge.svg)](https://robert-koch-institut.github.io/mex-common)

## project

With the Metadata Exchange (MEx) project, the [RKI](https://www.rki.de) is developing a
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mex-common"
version = "0.10.1"
version = "0.10.2"
description = "RKI MEx common library."
authors = ["RKI MEx Team <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 6c55306

Please sign in to comment.