Skip to content

Commit

Permalink
Documentation build/deployment and unit tests workflows #1
Browse files Browse the repository at this point in the history
  • Loading branch information
mgm8 committed Feb 2, 2023
1 parent baa5768 commit 3059c87
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/sphinx-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# sphinx-build.yml
#
# Copyright The PySPIS Contributors.
#
# This file is part of PySPIS library.
#
# PySPIS library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PySPIS library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PySPIS library. If not, see <http://www.gnu.org/licenses/>.
#
#


name: Documentation build

on:
push:
branches: [dev,main]
pull_request:
branches: [dev,main]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
# Standard drop-in approach that should work for most people.
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
# Create an artifact of the html output.
- uses: actions/upload-artifact@v1
with:
name: documentation_html
path: docs/_build/html/
72 changes: 72 additions & 0 deletions .github/workflows/sphinx-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# sphinx-deploy.yml
#
# Copyright The PySPIS Contributors.
#
# This file is part of PySPIS library.
#
# PySPIS library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PySPIS library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PySPIS library. If not, see <http://www.gnu.org/licenses/>.
#
#


name: Documentation deployment

on:
push:
branches: [main]
pull_request:
branches: [main]

# 'workflow_dispatch' allows manual execution of this workflow under the repository's 'Actions' tab
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
# Standard drop-in approach that should work for most people
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
# Create an artifact of the html output
- uses: actions/upload-artifact@v1
with:
name: documentation_html
path: docs/_build/html/
# Publish built docs to gh-pages branch
- name: Commit documentation changes
run: |
git clone https://github.com/mgm8/pyspis.git --branch gh-pages --single-branch gh-pages
cd gh-pages
rm -rf *
rm -f .nojekyll
rm -f .gitignore
rm -rf .github/
cp -r ../docs/_build/html/* .
touch .nojekyll
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore that
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# test.yml
#
# Copyright The PySPIS Contributors.
#
# This file is part of PySPIS library.
#
# PySPIS library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PySPIS library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PySPIS library. If not, see <http://www.gnu.org/licenses/>.
#
#


name: Unit tests

on:
push:
branches: [dev]
pull_request:
branches: [main, dev]

# 'workflow_dispatch' allows manual execution of this workflow under the repository's 'Actions' tab
workflow_dispatch:

jobs:

unit-tests:
name: Unit tests
runs-on: ubuntu-latest

strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt install -y python3-pytest

- name: Install PyNGHam
run: sudo python setup.py install

- name: Execute the test
run: pytest-3 tests/

0 comments on commit 3059c87

Please sign in to comment.