Solve issue #208. Style p.topic-title #511
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
name: CI | |
on: | |
release: | |
types: | |
- published | |
push: | |
pull_request: | |
repository_dispatch: | |
jobs: | |
some-context-vars: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get branch or version name from repo (howto) | |
id: get-bv_name | |
run: | | |
if [[ "$GITHUB_REF" == *"refs/tags"* ]]; then | |
# v4.0.6 -> 4.0.6 | |
echo ::set-output name=branch_or_version::$(echo ${GITHUB_REF#refs/tags/} | sed 's/v//g') | |
else | |
# feature/something -> feature-something | |
echo ::set-output name=branch_or_version::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g') | |
fi | |
- name: Some vars | |
run: | | |
echo Echoing: | |
echo 'github.event.action :' ${{ github.event.action }} | |
echo 'github.event_name :' ${{ github.event_name }} | |
echo 'github.repository :' ${{ github.repository }} | |
echo 'github.sha :' ${{ github.sha }} | |
echo 'branch or version from GITHUB_REF:' ${{ steps.get-bv_name.outputs.branch_or_version }} | |
echo 'GITHUB_REF :' ${GITHUB_REF} | |
echo 'GITHUB_REF#refs/heads/:' ${GITHUB_REF#refs/heads/} | |
echo 'GITHUB_REF#refs/tags/ :' ${GITHUB_REF#refs/tags/} | |
on-pull_request-job: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo 'github.event_name is:' ${{ github.event_name }} | |
on-push-job: | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo 'github.event_name is:' ${{ github.event_name }} | |
on-release-job: | |
if: github.event_name == 'release' && github.event.action == 'published' | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo 'github.event_name is:' ${{ github.event_name }} | |
echo 'github.event.action is:' ${{ github.event.action }} | |
on-repository_dispatch-job: | |
if: github.event_name == 'repository_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo 'github.event_name is:' ${{ github.event_name }} | |
echo 'github.event.action is:' ${{ github.event.action }} | |
yarn-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Node.js 12.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "12.x" | |
- run: yarn install | |
- run: yarn frontend | |
- run: git status | |
- name: Assert clean working tree | |
run: git status | grep -q "nothing to commit, working tree clean" | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: python --version | |
- run: pip install --upgrade pip | |
- run: pip install --upgrade flake8 | |
- run: make lint-minimal | |
build: | |
runs-on: ubuntu-latest | |
needs: [yarn-frontend, lint] | |
steps: | |
- name: Checkout non-shallow | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.x" | |
- run: python --version | |
- run: pip install --upgrade pip | |
- run: pip install --upgrade setuptools_scm wheel pytest | |
- run: echo TODO pytest | |
- run: python -m setuptools_scm | |
- name: Maybe set tag 99.88.77 | |
run: | | |
scm_version=$(python -c "import setuptools_scm as st;print('.'.join(st.get_version().split('.')[:3]))") | |
validstr=$(echo "$scm_version" | sed -e 's/\(0\|\([1-9][0-9]*\)\)\.\(0\|\([1-9][0-9]*\)\)\.\(0\|\([1-9][0-9]*\)\)/valid/') | |
echo Found scm_version:${scm_version}: && echo validates to validstr:${validstr}: | |
if [ ! "$validstr" = "valid" ]; then | |
newtag=v99.88.77 | |
echo Create tag "$newtag" | |
git tag | xargs git tag -d | |
git tag "$newtag" | |
git tag | |
else | |
echo Given version is "$scm_version" and looks ok. | |
fi | |
- run: python -m setuptools_scm | |
- run: python setup.py sdist bdist_wheel | |
- name: Remove sdist package | |
run: find dist -name "*.tar.gz" -delete | |
- name: Archive wheel | |
uses: actions/upload-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: dist | |
make-docs: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download wheel | |
uses: actions/download-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: packages | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.x | |
- run: python --version | |
- run: pip install --upgrade pip | |
- run: pip install --upgrade sphinx==4.5.0 | |
- name: Install from wheel | |
run: pip install $(find packages -name "*.whl") | |
- name: Assert importable, show version | |
run: | | |
our_version=$(python -c "import sphinx_typo3_theme; print(sphinx_typo3_theme.__version__)") | |
echo our version: ${our_version} | |
- name: Render repo docs | |
run: | | |
non_interactive=1 make docs | |
touch docs/_build/html/.nojekyll | |
- name: Upload rendered docs | |
uses: actions/upload-artifact@v1 | |
with: | |
name: docs-rendered-for-gh-pages | |
path: docs/_build/html | |
sphinx-quickstart: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
mode: [ | |
['online', '-A docstypo3org=yes -A version=faked/online '], | |
['offline', '-A version=faked/offline']] | |
python-version: [3.x] | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: packages | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: python --version | |
- run: pip install --upgrade pip | |
- run: pip install --upgrade sphinx==4.5.0 | |
- name: Install from wheel | |
run: pip install $(find packages -name "*.whl") | |
- name: Assert importable, show version | |
run: | | |
our_version=$(python -c "import sphinx_typo3_theme; print(sphinx_typo3_theme.__version__)") | |
echo our version: ${our_version} | |
- run: pip list | |
- name: Sphinx quickstart | |
run: | | |
html_theme=sphinx_typo3_theme | |
sphinx-quickstart --project PROJECT --author AUTHOR --sep \ | |
--extensions ${html_theme} --no-use-make-mode --quiet | |
echo >> source/conf.py | |
echo 'extensions.append("'${html_theme}'")' >> source/conf.py | |
echo 'html_theme = "'${html_theme}'"' >> source/conf.py | |
echo 'source/conf.py' | |
cat source/conf.py | |
- name: Sphinx build | |
run: | | |
sphinx-build -b html ${{ matrix.mode[1] }} source build | |
- name: Upload | |
uses: actions/upload-artifact@v1 | |
with: | |
name: sphinx-quickstart-${{ matrix.python-version }}-mode-${{ matrix.mode[0] }} | |
path: build | |
make-test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download wheel | |
uses: actions/download-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: packages | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: python --version | |
- run: pip install --upgrade pip | |
- run: pip install --upgrade pytest twine | |
- name: Install from wheel | |
run: pip install $(find packages -name "*.whl") | |
- name: Assert is importable, show version | |
run: python -c "import sphinx_typo3_theme; print(sphinx_typo3_theme.__version__)" | |
- name: Assert is importable and show version_info | |
run: python -c "import sphinx_typo3_theme; print(sphinx_typo3_theme.version_info)" | |
- run: python tests/test_python_sphinx_typo3_theme.py | |
- name: make test TODO Make this work | |
if: 0 | |
run: make test | |
- run: twine check packages/* | |
passed-all-tests: | |
needs: [make-docs, make-test, sphinx-quickstart] | |
runs-on: ubuntu-latest | |
steps: | |
- run: true | |
publish-gh-pages: | |
needs: [passed-all-tests] | |
if: (github.event_name == 'push' && github.event.ref == 'refs/heads/master') | |
|| (github.event_name == 'push' && github.repository == 'marble/dummyrepo') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Download rendered docs | |
uses: actions/download-artifact@v1 | |
with: | |
name: docs-rendered-for-gh-pages | |
path: site | |
- name: Publish | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_GITHUB }} | |
BRANCH: gh-pages | |
FOLDER: site | |
assert-good-release-version: | |
needs: [passed-all-tests] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: packages | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.x" | |
- run: ls -la packages | |
- run: python --version | |
- run: pip install --upgrade pip | |
- name: Install from wheel | |
run: pip install $(find packages -name "*.whl") | |
- name: Assert release number is exactly like 1.2.3 or 1.2.dev3 | |
run: | | |
our_version=$(python -c "import sphinx_typo3_theme; print(sphinx_typo3_theme.__version__)") | |
validstr=$(echo "$our_version" | sed -e 's/\(0\|\([1-9][0-9]*\)\)\.\(0\|\([1-9][0-9]*\)\)\.\(0\|\([1-9][0-9]*\)\)/valid/') | |
echo our version:${our_version}: && echo validates to validstr:${validstr}: | |
if [ "$validstr" != "valid" ]; then | |
echo Invalid version number. Expecting a legal version like | |
echo '<major>.<minor>.<patch> or <major>.<minor>.dev<patch> with major >= 1 and no leading zeros' | |
exit 1 | |
fi | |
- name: Assert real release number | |
run: | | |
if [ "$our_version" = "99.88.77" ]; then | |
exit 1 | |
fi | |
upload-to-pypi: | |
needs: [assert-good-release-version] | |
if: github.event_name == 'release' && github.event.action == 'published' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.x" | |
- run: python --version | |
- run: pip install --upgrade pip twine | |
- name: Download wheel | |
uses: actions/download-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: packages | |
- run: find packages | |
- run: twine check packages/* | |
- name: Publish on PyPi | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: twine upload packages/* | |
upload-to-cdn: | |
needs: [upload-to-pypi] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: packages | |
- name: Unpack and find version | |
id: get-version | |
run: | | |
the_wheel=$(find packages -name "*.whl") | |
echo "the wheel package is: '"${the_wheel}"'" | |
unzip ${the_wheel} | |
find . | |
echo ::set-output name=version1::$(echo ${the_wheel} | sed -e 's/^.*sphinx_typo3_theme-\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*/\1/') | |
echo ::set-output name=version2::$(echo ${the_wheel} | sed -e 's/^.*sphinx_typo3_theme-\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*/\1.\2/') | |
echo ::set-output name=version3::$(echo ${the_wheel} | sed -e 's/^.*sphinx_typo3_theme-\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*/\1.\2.\3/') | |
- name: Show version1, version2, version3 | |
run: | | |
echo "version1: ${{ steps.get-version.outputs.version1 }}" | |
echo "version2: ${{ steps.get-version.outputs.version2 }}" | |
echo "version3: ${{ steps.get-version.outputs.version3 }}" | |
- name: Remove some files | |
run: | | |
find sphinx_typo3_theme/static -name __init__.py -delete | |
find sphinx_typo3_theme/static -name *_t -delete | |
- name: Prepare upload folder | |
run: mkdir -p cdn/theme/sphinx_typo3_theme/ | |
# example: https://typo3.azureedge.net/typo3documentation/theme/sphinx_typo3_theme/4.3.2/css/theme.css | |
- name: Provide as x.x.x | |
run: cp -r sphinx_typo3_theme/static cdn/theme/sphinx_typo3_theme/${{ steps.get-version.outputs.version3 }} | |
# example: https://typo3.azureedge.net/typo3documentation/theme/sphinx_typo3_theme/master/css/theme.css | |
- name: Provide as <branch> | |
run: cp -r sphinx_typo3_theme/static cdn/theme/sphinx_typo3_theme/master | |
- run: find . | |
- name: Upload to Azure | |
env: | |
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_ACCOUNT }} | |
AZURE_STORAGE_KEY: ${{ secrets.AZURE_KEY }} | |
run: | | |
az storage blob upload-batch --source cdn --destination ${{ secrets.AZURE_CONTAINER }} | |
use-docker-container: | |
needs: [passed-all-tests] | |
runs-on: ubuntu-latest | |
if: 1 | |
strategy: | |
matrix: | |
# online, offline | |
mode: ['online'] | |
manual: [ | |
# ['Writing Documentation', 'TYPO3-Documentation/TYPO3CMS-Guide-HowToDocument'], | |
['Stress Test Demo', 'typo3-documentation/sphinx_typo3_theme_rendering_test']] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
repository: ${{ matrix.manual[1] }} | |
- name: Download wheel | |
uses: actions/download-artifact@v1 | |
with: | |
name: bdist-wheel-package | |
path: WHEELS | |
- run: | | |
mkdir -p Documentation-GENERATED-temp | |
if [[ "${{ matrix.mode }}" = "offline" ]]; then | |
echo '{"Overrides_cfg":{"html_theme_options":{"docstypo3org":""}}}' > Documentation-GENERATED-temp/jobfile.json | |
fi | |
if [[ "${{ matrix.mode }}" = "online" ]]; then | |
echo '{"Overrides_cfg":{"html_theme_options":{"docstypo3org":"nonempty"}}}' > Documentation-GENERATED-temp/jobfile.json | |
fi | |
- name: list WHEELS | |
run: | | |
echo github.workspace is ${{ github.workspace }} | |
echo GITHUB_WORKSPACE in env is ${GITHUB_WORKSPACE} | |
echo files in ${{ github.workspace }}/WHEELS | |
ls -la ${{ github.workspace }}/WHEELS | |
- name: docker run | |
run: | | |
docker run --rm --user=$(id -u):$(id -g) \ | |
-v $(pwd):/PROJECT:ro \ | |
-v $(pwd)/Documentation-GENERATED-temp:/RESULT \ | |
-v ${{ github.workspace }}/WHEELS:/WHEELS \ | |
ghcr.io/t3docs/render-documentation:latest makehtml \ | |
-c make_singlehtml 1 \ | |
-c jobfile /RESULT/jobfile.json | |
- name: Verify rendering result | |
run: stat Documentation-GENERATED-temp/Result/project/0.0.0/index.html || stat Documentation-GENERATED-temp/Result/project/0.0.0/Index.html | |
- name: Upload | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.manual[0] }} (TYPO3 rendering example, mode ${{ matrix.mode }}) | |
path: ./Documentation-GENERATED-temp/Result/project/0.0.0 |