Skip to content

Commit d6d27dd

Browse files
localheinzcmb69
authored andcommitted
Enhancement: Build documentation on GitHub Actions
Closes GH-9.
1 parent 0dc05ab commit d6d27dd

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

.github/workflows/integrate.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# https://docs.github.com/en/actions
2+
3+
name: "Integrate"
4+
5+
on:
6+
pull_request: null
7+
push:
8+
branches:
9+
- "master"
10+
11+
jobs:
12+
build:
13+
name: "Build"
14+
15+
runs-on: "ubuntu-latest"
16+
17+
continue-on-error: true
18+
19+
strategy:
20+
matrix:
21+
language:
22+
- "de"
23+
- "en"
24+
- "es"
25+
- "fr"
26+
- "it"
27+
- "ja"
28+
- "pl"
29+
- "pt_br"
30+
- "ro"
31+
- "ru"
32+
- "tr"
33+
- "uk"
34+
- "zh"
35+
36+
steps:
37+
- name: "Checkout"
38+
uses: "actions/checkout@v2"
39+
with:
40+
path: "doc-base"
41+
42+
- name: "Checkout php/doc-${{ matrix.language }}"
43+
uses: "actions/checkout@v2"
44+
with:
45+
path: "${{ matrix.language }}"
46+
repository: "php/doc-${{ matrix.language }}"
47+
48+
- name: "Checkout php/doc-en as fallback"
49+
if: "matrix.language != 'en'"
50+
uses: "actions/checkout@v2"
51+
with:
52+
path: "en"
53+
repository: "php/doc-en"
54+
55+
- name: "Build documentation for ${{ matrix.language }}"
56+
run: "php8.0 doc-base/configure.php --disable-libxml-check --enable-xml-details --redirect-stderr-to-stdout --with-lang=${{ matrix.language }}"

configure.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,15 @@ function print_xml_errors($details = true) {
234234
$workdir = $srcdir;
235235
$basedir = $srcdir;
236236
$rootdir = dirname($basedir);
237-
if (basename($rootdir) == 'doc-base') {
237+
238+
/**
239+
* When checking out this repository on GitHub Actions, the workspace directory is "/home/runner/work/doc-base/doc-base".
240+
*
241+
* To avoid applying dirname() here, we check if we are running on GitHub Actions.
242+
*
243+
* @see https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables
244+
*/
245+
if (getenv('GITHUB_ACTIONS') !== 'true' && basename($rootdir) === 'doc-base') {
238246
$rootdir = dirname($rootdir);
239247
}
240248

0 commit comments

Comments
 (0)