Skip to content

Fix : allow use of subfolders in the url with reverse proxies #1026

Fix : allow use of subfolders in the url with reverse proxies

Fix : allow use of subfolders in the url with reverse proxies #1026

Workflow file for this run

# SPDX-FileCopyrightText: 2024 2024 Nicco Kunzmann and Open Web Calendar Contributors <https://open-web-calendar.quelltext.eu/>
#
# SPDX-License-Identifier: GPL-2.0-only
# Run pytest for each commit.
# See also
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#running-tests-with-tox
name: "Build, Test & Publish"
on: [push, pull_request]
# cancel builds in progress if a new push has been made to the same ref
# see https://stackoverflow.com/a/70972844/1320237
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'master' }}
jobs:
run-tests:
name: "Build & Run Tests"
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
tox_env: ["py"]
# see https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
include:
# run Firefox
- python: "3.11"
tox_env: web
# run Chrome
# - python: "3.11"
# tox_env: "web -- -D browser=chrome"
# run Firefox in iPhone 11 responsive layout
- python: "3.11"
tox_env: "web -- -D window=375x812"
# Licensing REUSE
- python: "3.12"
tox_env: "reuse"
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox
- name: Run tests
# Run tox using the version of Python in `PATH`
run: tox -e ${{ matrix.tox_env }}
gh-pages:
name: "Publish Documentation to GitHub Pages"
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'master' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for mkdocs git date, see https://github.com/timvink/mkdocs-git-revision-date-localized-plugin?tab=readme-ov-file#note-when-using-build-environments
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install tox
run: pip install tox
- name: mkdocs
# Run tox using the version of Python in `PATH`
run: tox -e docs -- gh-deploy
link-check:
name: "Check Links in Documentation"
runs-on: ubuntu-latest
if: ${{ ! startsWith(github.ref, 'refs/tags/v')}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for mkdocs git date, see https://github.com/timvink/mkdocs-git-revision-date-localized-plugin?tab=readme-ov-file#note-when-using-build-environments
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install tox
run: pip install tox linkchecker
- name: Check Links
run: scripts/check-links-in-documentation.sh
- uses: actions/upload-artifact@v4
with:
name: checked-links.html
path: linkchecker-out.html
dockerhub:
name: Publish Docker Image on Docker Hub
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/v') }}
# This environment stores the DOCKERHUB_USERNAME and DOCKERHUB_TOKEN
# see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
environment:
name: dockerhub
url: https://hub.docker.com/r/niccokunzmann/open-web-calendar
needs:
- run-tests
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Create Version Information
run: |
python -m pip install --upgrade pip
pip install --upgrade build
if [ "$GITHUB_REF_NAME" == "master" ]; then
echo "Adding commit hash to build information"
sed -i 's/^local_scheme/#local_scheme/g' pyproject.toml
else
echo "Using version information from tag"
fi
python -m build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: niccokunzmann/open-web-calendar
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6
labels: ${{ steps.meta.outputs.labels }}
deploy-tag-to-pypi:
name: Publish Package on PyPI
# only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs:
- run-tests
runs-on: ubuntu-latest
# This environment stores the TWINE_USERNAME and TWINE_PASSWORD
# see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
environment:
name: PyPI
url: https://pypi.org/project/open-web-calendar/
# after using the environment, we need to make the secrets available
# see https://docs.github.com/en/actions/security-guides/encrypted-secrets#example-using-bash
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade wheel twine build
# - name: Check the tag
# run: |
# PACKAGE_VERSION=`python setup.py --version`
# TAG_NAME=v$PACKAGE_VERSION
# echo "Package version $PACKAGE_VERSION with possible tag name $TAG_NAME on $GITHUB_REF_NAME"
# # test that the tag represents the version
# # see https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
# # see https://docs.github.com/en/actions/learn-github-actions/environment-variables
# if [ "$TAG_NAME" != "$GITHUB_REF_NAME" ]; then
# echo "ERROR: This tag is for the wrong version. Got \"$GITHUB_REF_NAME\" expected \"$TAG_NAME\"."
# exit 1
# fi
- name: remove old files
run: rm -rf dist/*
- name: build distribution files
run: python -m build
- name: deploy to pypi
run: |
# You will have to set the variables TWINE_USERNAME and TWINE_PASSWORD
# You can use a token specific to your project by setting the user name to
# __token__ and the password to the token given to you by the PyPI project.
# sources:
# - https://shambu2k.hashnode.dev/gitlab-to-pypi
# - http://blog.octomy.org/2020/11/deploying-python-pacakges-to-pypi-using.html?m=1
# Also, set the tags as protected to allow the secrets to be used.
# see https://docs.gitlab.com/ee/user/project/protected_tags.html
if [ -z "$TWINE_USERNAME" ]; then
echo "WARNING: TWINE_USERNAME not set!"
fi
if [ -z "$TWINE_PASSWORD" ]; then
echo "WARNING: TWINE_PASSWORD not set!"
fi
twine check dist/*
twine upload dist/*
github-release:
name: "Publish GitHub Release"
# only deploy on tags, see https://stackoverflow.com/a/58478262/1320237
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs:
- run-tests
- dockerhub
- deploy-tag-to-pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: create release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
body: "For a list of changes, please refer to the [Changelog](https://open-web-calendar.quelltext.eu/changelog/)."
generateReleaseNotes: false