-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,301 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,,}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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).*' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,3 +145,6 @@ docker-compose.yml | |
# Settings cache (Spotify) | ||
/website/cache | ||
|
||
# Documentation | ||
/docs/build | ||
|
Oops, something went wrong.