Skip to content

Commit 18b13a1

Browse files
committed
Changed: pre-build-script to pre-build-command, & parallelised tests.
1 parent 6d78984 commit 18b13a1

3 files changed

Lines changed: 89 additions & 42 deletions

File tree

.github/workflows/test-mkdocs-workflow.yml

Lines changed: 78 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,94 +16,118 @@ on:
1616
- '.github/workflows/test-mkdocs-workflow.yml'
1717

1818
jobs:
19-
test:
19+
test-default-parameters:
2020
runs-on: ubuntu-latest
21-
permissions:
22-
contents: read
23-
pages: write
24-
id-token: write
25-
2621
steps:
2722
- name: Checkout Test Repository
2823
uses: actions/checkout@v4
2924
with:
3025
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
3126
submodules: 'recursive'
32-
3327
- name: Test Default Parameters
3428
uses: Reloaded-Project/devops-mkdocs@v1
3529
with:
3630
checkout-current-repo: false
3731
publish-to-pages: false
3832

33+
test-custom-mkdocs-version:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout Test Repository
37+
uses: actions/checkout@v4
38+
with:
39+
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
40+
submodules: 'recursive'
3941
- name: Test Custom MkDocs Version
4042
uses: Reloaded-Project/devops-mkdocs@v1
4143
with:
4244
mkdocs-version: '9.5.24'
4345
checkout-current-repo: false
4446
publish-to-pages: false
4547

48+
test-disable-checkout:
49+
runs-on: ubuntu-latest
50+
steps:
4651
- name: Test Disable Checkout
4752
uses: Reloaded-Project/devops-mkdocs@v1
4853
with:
4954
checkout-current-repo: false
5055
publish-to-pages: false
5156

52-
- name: Create Pre-build Script (Bash)
57+
test-custom-pre-build-command-bash:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout Test Repository
61+
uses: actions/checkout@v4
62+
with:
63+
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
64+
submodules: 'recursive'
65+
- name: Create Pre-build Command (Bash)
5366
shell: bash
5467
run: |
5568
echo '#!/bin/bash' > pre-build-bash.sh
56-
echo 'echo "Running pre-build script (Bash)"' >> pre-build-bash.sh
69+
echo 'echo "Running pre-build command (Bash)"' >> pre-build-bash.sh
5770
echo 'ls -l' >> pre-build-bash.sh
5871
echo 'touch pre-build-bash-executed.txt' >> pre-build-bash.sh
59-
60-
- name: Test Custom Pre-build Script (Bash)
72+
- name: Test Custom Pre-build Command (Bash)
6173
uses: Reloaded-Project/devops-mkdocs@v1
6274
with:
63-
pre-build-script: pre-build-bash.sh
64-
pre-build-shell: bash
75+
pre-build-command: pre-build-bash.sh
76+
pre-build-command-shell: bash
6577
checkout-current-repo: false
6678
publish-to-pages: false
67-
68-
- name: Assert Pre-build Script Execution (Bash)
79+
- name: Assert Pre-build Command Execution (Bash)
6980
shell: bash
7081
run: |
7182
if [ ! -f pre-build-bash-executed.txt ]; then
72-
echo "Pre-build script (Bash) did not execute successfully"
83+
echo "Pre-build command (Bash) did not execute successfully"
7384
exit 1
7485
fi
7586
76-
- name: Create Pre-build Script (PowerShell)
87+
test-custom-pre-build-command-pwsh:
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout Test Repository
91+
uses: actions/checkout@v4
92+
with:
93+
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
94+
submodules: 'recursive'
95+
- name: Create Pre-build Command (PowerShell)
7796
shell: pwsh
7897
run: |
7998
echo '#!/usr/bin/env pwsh' > pre-build-pwsh.ps1
80-
echo 'Write-Output "Running pre-build script (PowerShell)"' >> pre-build-pwsh.ps1
99+
echo 'Write-Output "Running pre-build command (PowerShell)"' >> pre-build-pwsh.ps1
81100
echo 'Get-ChildItem' >> pre-build-pwsh.ps1
82101
echo 'New-Item -ItemType File -Path pre-build-pwsh-executed.txt' >> pre-build-pwsh.ps1
83-
84-
- name: Test Custom Pre-build Script (PowerShell)
102+
- name: Test Custom Pre-build Command (PowerShell)
85103
uses: Reloaded-Project/devops-mkdocs@v1
86104
with:
87-
pre-build-script: pre-build-pwsh.ps1
88-
pre-build-shell: pwsh
105+
pre-build-command: pre-build-pwsh.ps1
106+
pre-build-command-shell: pwsh
89107
checkout-current-repo: false
90108
publish-to-pages: false
91-
92-
- name: Assert Pre-build Script Execution (PowerShell)
109+
- name: Assert Pre-build Command Execution (PowerShell)
93110
shell: pwsh
94111
run: |
95112
if (-not (Test-Path -Path pre-build-pwsh-executed.txt)) {
96-
Write-Error "Pre-build script (PowerShell) did not execute successfully"
113+
Write-Error "Pre-build command (PowerShell) did not execute successfully"
97114
exit 1
98115
}
99116
117+
test-custom-output-directory:
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: Checkout Test Repository
121+
uses: actions/checkout@v4
122+
with:
123+
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
124+
submodules: 'recursive'
100125
- name: Test Custom Output Directory
101126
uses: Reloaded-Project/devops-mkdocs@v1
102127
with:
103128
output-directory: docs/_site
104129
checkout-current-repo: false
105130
publish-to-pages: false
106-
107131
- name: Assert Custom Output Directory
108132
shell: bash
109133
run: |
@@ -112,28 +136,54 @@ jobs:
112136
exit 1
113137
fi
114138
139+
test-custom-requirements-path:
140+
runs-on: ubuntu-latest
141+
steps:
142+
- name: Checkout Test Repository
143+
uses: actions/checkout@v4
144+
with:
145+
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
146+
submodules: 'recursive'
115147
- name: Copy Custom Requirements File
116148
shell: bash
117149
run: cp docs/requirements.txt docs/custom-requirements.txt
118-
119150
- name: Test Custom Requirements Path
120151
uses: Reloaded-Project/devops-mkdocs@v1
121152
with:
122153
requirements: docs/custom-requirements.txt
123154
checkout-current-repo: false
124155
publish-to-pages: false
125156

157+
test-custom-config-file:
158+
runs-on: ubuntu-latest
159+
steps:
160+
- name: Checkout Test Repository
161+
uses: actions/checkout@v4
162+
with:
163+
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
164+
submodules: 'recursive'
126165
- name: Copy Custom Config File
127166
shell: bash
128167
run: cp mkdocs.yml docs/custom-mkdocs.yml
129-
130168
- name: Test Custom Config File
131169
uses: Reloaded-Project/devops-mkdocs@v1
132170
with:
133171
config-file: docs/custom-mkdocs.yml
134172
checkout-current-repo: false
135173
publish-to-pages: false
136174

175+
test-publish-to-pages:
176+
runs-on: ubuntu-latest
177+
permissions:
178+
contents: read
179+
pages: write
180+
id-token: write
181+
steps:
182+
- name: Checkout Test Repository
183+
uses: actions/checkout@v4
184+
with:
185+
repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2
186+
submodules: 'recursive'
137187
- name: Test Publish to Pages
138188
uses: Reloaded-Project/devops-mkdocs@v1
139189
with:

README.MD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
uses: Reloaded-Project/devops-mkdocs@v1
4545
with:
4646
requirements: ./docs/requirements.txt
47-
publish-to-pages: true
47+
publish-to-pages: true # Default
4848
checkout-current-repo: true # Checks out by default.
4949
```
5050
@@ -71,8 +71,8 @@ The action supports the following input parameters:
7171
- `publish-to-pages`: (Optional) Whether to publish the generated site to GitHub Pages. Defaults to `true`.
7272
- `checkout-current-repo`: (Optional) Whether to perform a repository checkout before building the site. Defaults to `true`.
7373
- `output-directory`: (Optional) Location of the built MkDocs site. Defaults to `./site`.
74-
- `pre-build-script`: (Optional) The path to a pre-build script to run before building the site.
75-
- `pre-build-shell`: (Optional) The shell to use for running the pre-build script. Defaults to `bash`.
74+
- `pre-build-command`: (Optional) The path to a pre-build command to run before building the site.
75+
- `pre-build-command-shell`: (Optional) The shell to use for running the pre-build command. Defaults to `bash`.
7676

7777
### Workflow Triggers
7878

action.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ inputs:
2222
required: false
2323
default: "true"
2424
description: "Whether to perform repository checkout"
25-
pre-build-script:
25+
pre-build-command:
2626
required: false
27-
description: "Path to the pre-build script"
28-
pre-build-shell:
27+
description: "Path to the pre-build command"
28+
pre-build-command-shell:
2929
required: false
3030
default: "bash"
31-
description: "Shell to use for running the pre-build script"
31+
description: "Shell to use for running the pre-build command"
3232
output-directory:
3333
required: false
3434
default: "./site"
@@ -61,13 +61,10 @@ runs:
6161
pip install -r "${{ inputs.requirements }}"
6262
fi
6363
64-
- name: Run Pre-build Script
65-
if: ${{ inputs.pre-build-script }}
66-
shell: ${{ inputs.pre-build-shell }}
67-
run: |
68-
if [ -f "${{ inputs.pre-build-script }}" ]; then
69-
${{ inputs.pre-build-shell }} "${{ inputs.pre-build-script }}"
70-
fi
64+
- name: Run Pre-build Command
65+
if: ${{ inputs.pre-build-command }}
66+
shell: ${{ inputs.pre-build-command-shell }}
67+
run: ${{ inputs.pre-build-command }}
7168

7269
- name: Build MkDocs Site
7370
shell: bash

0 commit comments

Comments
 (0)