Building
While the components of this repository are split into separate packages, it can be build as a standalone application. Two ways are provided to use this project on your own environment.
Using Docker
A Docker image is available on GitHub packages. If you want to build your own image you can use the following command, in the root of this repository.
make docker-build
Once the build is finished you can execute your own image using:
docker run --rm -v $(pwd):/project typo3-docs:local --progress
For macOS you may need to specify the argument user
:
docker run --rm -v $(pwd):/project --user=$(id -u):$(id -g) typo3-docs:local --progress
Note
Note that the parameter -v $
always uses project
as
the directory name. You do not need to replace that directory name with
anything else, because the container rendering depends on this.
Using PHP
A phar binary is shipped with this repository. In short, a phar file is an executable PHP file. You can run it like any other executable.
To build the phar file we use Box_, with some wrapper script. To build the phar file yourself, you can run the following command.
make build-phar
This will create a file called guides.
in the build directory. You
can execute the phar file like a PHP file using:
php build/guides.phar
Warning
Currently, Box is not able to build a phar file for projects containing
Composer plugins as it will only install production dependencies. This
means that the composer.
is modified during the build process.
You shall not commit this change to the repository.
GitHub workflow
Developers contributing to the repository of this project on github_renderguides_ will trigger several GitHub Workflow when commiting/pushing code.
On terminology: A Git
is something that is triggered within
the repository (i.e. on a commit/tag). A Git
is something that can
be executed from the repository, where the repository allows other repositories
to i.e. render the documentation. This repository provides both Workflows
and
Actions
.
GitHub workflow: Commit/PR stragegy
The GIT main
branch is protected, so only feature/bugfix/task-branches and forked
repositories can be merged into it. When a Pull Request (PR) is created, at least
one team member needs to approve it, so that it can be merged.
When a PR is created (and for every follow-up commit) the following GitHub Action are executed:
.github/
runs code quality and integration checksworkflows/ main. yaml .github/
creates a test docker container image (not uploaded anywhere), only if the PR modifies the mainworkflows/ docker- self. yaml Dockerfile
.
Once a PR is merged, nothing else happens.
GitHub workflow: Release strategy
Whenever assets of our theme (packages/
) need to be uploaded,
or the official Docker container needs to be updated, a GIT tag must be pushed to
this repository.
The tag must be formatted as a semver-version string without a leading character,
i.e. 0.
or 5.
. We only support a progressive mainline of versions, so
if a 5.
version will come out at some point, backporting bugfixes to previous
major versions is not planned.
If that ever needs to happen, also tags for older versions can be added to GIT
to trigger building the relevant Docker container images. It is then very important
that the most recent version is tagged LAST in this process, because only the
last GIT tag is used for the latest
Docker container:
# DO this:
git checkout 3.1.2
# .. cherry-pick bugfixes ..
# .. commit to a branch like release/3.1.3 ..
git tag 3.1.3 && git push --tags
git checkout main
# .. release the main version
git tag 4.0.0 && git push --tags
# do NOT do this:
git tag 4.0.0 && git push --tags
git checkout 3.1.2
# ...
When a GIT version tag matching *.*.*
is pushed, these workflows are executed:
.github/
build the PHAR image for the releaseworkflows/ phar. yaml .github/
build the Docker container image for the release, using the version tag.workflows/ docker. yaml .github/
uploads the latest assets (everything inworkflows/ deploy- azure- assets. yaml packages/
) to the Azure cloud CDN, using the version tag.typo3- docs- theme/ resources/ public
GitHub workflow: GitHub Actions - Main entry
/action.
is the main entry point for a composite action. It can
be used by other repositories in workflows.
The GitHub repository github_gh_render_action_ provides an easy interface to
that action. That repository provides a wrapper to check if a documentation repository
needs to be rendered using Sphinx (the old rendering, using a Settings.
file) or via phpDocumentor (the new rendering, using a : file:guides.
file).
The central piece of that action is:
- uses: TYPO3-Documentation/render-guides@main
id: render-guides
if: steps.enable_guides.outputs.GUIDES == 'true'
with:
working-directory: t3docsproject
config: ./t3docsproject/Documentation/
output: ./RenderedDocumentation/Result/project/0.0.0
configure-branch: ${{ env.source_branch }}
configure-project-release: ${{ env.target_branch_directory }}
configure-project-version: ${{ env.target_branch_directory }}
This "remotely executes" the /action.
of this repository with specific
input parameters gathered earlier in the gh-
action.
All of this allows an extension author to provide a GitHub Workflow in their own repository like this:
jobs:
render-documentation:
runs-on: ubuntu-latest
name: "Render Documentation for this repository and upload"
steps:
- name: Render Repository
uses: TYPO3-Documentation/gh-render-action@main
id: rendering
with:
repository_url: https://github.com/$GITHUB_REPOSITORY
source_branch: main
target_branch_directory: main
Then it does not even matter, if the repository uses the old or new rendering,
everything is done through the intermediate layer of gh-
.
This will also in the future allow us to switch to different renderings or take care of breaking configurations, so that extension authors (and the TYPO3 core documentation) always can rely on one action that does not change, and does not need different version numbers/tags.
The /action.
composite action takes in the input of the code snippet
above, and then executes two composite steps:
.github/
that provides extension-repository specific attributes that influence the local rendering. The input variables are dynamically injected into a temporaryactions/ configure- guides- step/ action. yaml guides.
file, that is used for the actual rendering. This is done by executing our ownxml latest
Docker container image..github/
is the actual rendering step, also using the sameactions/ render- guides- step/ action. yaml latest
Docker container image.
Note that we only have one central Docker container image entrypoint that can
take arguments like migrate
or render
to trigger different actions.
GitHub workflow: deploy-azure-assets
.github/
is triggered when a GIT tag
matching *.*.*
is committed to the repository.
It checks out this repository, retrieves the current GIT tag, gathers all files in
packages/
and moves them to a directory
structure like cdn/
(using the version
number that has been used in the GIT tag).
That directory structure is then uploaded to azure, by using the secret GIT environment variables configured in our repository.
GitHub workflow: docker
.github/
is triggered when a GIT tag
matching *.*.*
is committed to the repository.
It does these steps:
build
: Sets up a matrix of docker platforms (arm, amd) to be built. This results in three build steps in total, once per platform: - Check out the repository with the current GIT tag - Retrieve Docker metadata (tags, versions) - Initiates the Docker build chain - Store the currently used GIT tag (version number) in an environment variableTYPO3AZUREEDGEURIVERSION
. See description below. - Create the docker image, using the environment variable.merge
: Then the three builds are merged and uploaded to thegchr
docker registry.
The variable TYPO3AZUREEDGEURIVERSION
is very important to be baked into
the Docker image. This will ensure, that the rendering for remote repositories
is always performed with the matching version number of both the theme and the
Docker image. All assets can then be referenced as
https://
.
Note that the version is used here, not a string like main
or stable
as the
version, because CDNs would always cache these files and probably not deliver a
new version, because the URI would be the same.
This means, the latest
Docker image container will always reference to the CDN
with the most recent version number. If at some point incompatibilities in the
rendering are introduced, we can separate the gh-
repository in
a way, that could reference exact Docker images other than latest
, like by
referring to a :5.
image (using 5.0.1 / 5.0.2 / ... CDN URIs), or even using
:5
to reference to the most recent 5.x version.
GitHub workflow: docker-test
.github/
is triggered whenever a commit changes
the Dockerfile
.
The workflow step then uses that modified Dockerfile
and tries to build
it, and just execute the resulting container.
Note that no Docker container is actually uploaded. All the GitHub actions are just executed with the locally built docker container in this case, because this workflow step replaces the Docker container image name to the local Dockerfile instead of a registry URI.
A limitation currently is that the local Docker image will always use the action
steps to configure and render the documentation from the main
repository, not
the fles that may be modified within the commit. See the note in
.github/
at the end for details.
GitHub workflow: main
.github/
is triggered on each commit and for each
Pull Request (PR).
It performs basic code quality analysis and execution of unit/integration tests:
-
Tests:
Run unit tests
Run integration tests
-
Quality:
CGL
PHPSTAN
Lint guides.
xml configurations
- Validate monorepo structure
GitHub workflow: phar
(work in progress)
.github/
is triggered on each commit (not on
Pull Requests). It builds the a phar archive that will be available for
created releases.