Skip to content

Commit

Permalink
Feature/docs (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
KiOui authored Jul 20, 2020
1 parent 54c7361 commit b3bc0a9
Show file tree
Hide file tree
Showing 31 changed files with 1,301 additions and 174 deletions.
48 changes: 25 additions & 23 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
---

name: Build Production Docker Image
name: "Build Production Docker Image"
on:
push:
branches: [ master ]
branches:
- master

jobs:
build-docker:
name: "Build Production Docker Image"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v2"

- name: "Create environment for repository names"
run: |
echo "::set-env name=DOCKER_LATEST::docker.pkg.github.com/${GITHUB_REPOSITORY}/${GITHUB_REPOSITORY##*/}:latest"
echo "::set-env name=DOCKER_TAG_PRODUCTION::docker.pkg.github.com/${GITHUB_REPOSITORY}/${GITHUB_REPOSITORY##*/}:${GITHUB_SHA}"
build-docker:
name: "Build Production Docker Image"
runs-on: ubuntu-latest
steps:

- name: "Build Docker image"
run: docker build --tag ${DOCKER_LATEST,,} .
- name: "Checkout repository"
uses: actions/checkout@v2

- name: "Login to GitHub"
run: echo "${{ secrets.GH_TOKEN }}" | docker login docker.pkg.github.com -u "${{ github.repository_owner }}" --password-stdin

- name: "Tag and publish"
run: |
docker tag "${DOCKER_LATEST,,}" "${DOCKER_TAG_PRODUCTION,,}"
docker push "${DOCKER_TAG_PRODUCTION,,}"
docker push "${DOCKER_LATEST,,}"
- name: "Create environment for repository names"
run: |
echo "::set-env name=DOCKER_LATEST::docker.pkg.github.com/${GITHUB_REPOSITORY}/${GITHUB_REPOSITORY##*/}:latest"
echo "::set-env name=DOCKER_TAG_PRODUCTION::docker.pkg.github.com/${GITHUB_REPOSITORY}/${GITHUB_REPOSITORY##*/}:${GITHUB_SHA}"
- name: "Build Docker image"
run: docker build --tag ${DOCKER_LATEST,,} .

- name: "Login to GitHub"
run: echo "${{ secrets.GH_TOKEN }}" | docker login docker.pkg.github.com -u "${{ github.repository_owner }}" --password-stdin

- name: "Tag and publish"
run: |
docker tag "${DOCKER_LATEST,,}" "${DOCKER_TAG_PRODUCTION,,}"
docker push "${DOCKER_TAG_PRODUCTION,,}"
docker push "${DOCKER_LATEST,,}"
60 changes: 60 additions & 0 deletions .github/workflows/docs-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---

name: "Update documentation on GitHub Pages"
on:
push:
branches:
- master

jobs:
docs:
name: "Update documentation on GitHub Pages"
runs-on: ubuntu-latest
steps:

- name: "Checkout the repository"
uses: actions/checkout@v2

- name: "Setup Python"
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: "Install Poetry"
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: "Restore any cached Poetry dependencies"
uses: actions/cache@v1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: "Install any new dependencies"
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: "Build documentation"
run: |
cd docs
poetry run make html
- name: "Commit documentation changes"
run: |
git clone https://github.com/KiOui/TOSTI.git --branch gh-pages --single-branch gh-pages
cp -r docs/build/html/* gh-pages/
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
- name: "Push changes"
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---

name: "Documentation"
on:
- push

jobs:
docs:
name: "Check Sphinx documentation"
runs-on: ubuntu-latest
steps:

- name: "Checkout the repository"
uses: actions/checkout@v2

- name: "Setup Python"
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: "Install Poetry"
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: "Restore any cached Poetry dependencies"
uses: actions/cache@v1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: "Install any new dependencies"
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: "Build documentation"
run: |
cd docs
poetry run make html
50 changes: 50 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---

name: "Linting"
on:
- push

jobs:
lint:
name: "Linting"
runs-on: ubuntu-latest
steps:

- name: "Checkout the repository"
uses: actions/checkout@v2

- name: "Setup Python"
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: "Install Poetry"
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: "Restore any cached Poetry dependencies"
uses: actions/cache@v1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: "Install any new dependencies"
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: "Run Black"
run: poetry run black --quiet --check website

- name: "Run flake8"
run: >-
poetry run
flake8
--exclude="migrations,website/tosti/settings/*.py"
--max-line-length=119
website
- name: "Run PyDocStyle"
run: poetry run pydocstyle --explain --add-ignore=D100,D104 --match-dir='(?!migrations).*'
49 changes: 0 additions & 49 deletions .github/workflows/linting.yml

This file was deleted.

83 changes: 42 additions & 41 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
---

name: "Testing"
on:
pull_request:
branches: [ master ]
- push

jobs:
build:
name: "Testing"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: "Install Poetry"
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: "Restore any cached Poetry dependencies"
uses: actions/cache@v1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: "Install any new dependencies"
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: "Test migrations"
run: |
poetry run python website/manage.py makemigrations --no-input --check --dry-run
- name: Check server
run: |
poetry run python3 website/manage.py check
- name: "Run Django tests using Coverage"
run: "poetry run coverage run website/manage.py test website/"

- name: "Check Coverage report"
run: "poetry run coverage report"

- name: "Checkout the repository"
uses: actions/checkout@v2

- name: "Setup Python"
uses: actions/setup-python@v1
with:
python-version: '3.7'

- name: "Install Poetry"
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: "Restore any cached Poetry dependencies"
uses: actions/cache@v1
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: "Install any new dependencies"
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: "Test migrations"
run: |
poetry run python website/manage.py makemigrations --no-input --check --dry-run
- name: "Perform Django self-check"
run: |
poetry run python3 website/manage.py check
- name: "Run Django tests using Coverage"
run: poetry run coverage run website/manage.py test website/

- name: "Check Coverage report"
run: poetry run coverage report
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,6 @@ docker-compose.yml
# Settings cache (Spotify)
/website/cache

# Documentation
/docs/build

Loading

0 comments on commit b3bc0a9

Please sign in to comment.