Skip to content

Commit c75e07f

Browse files
authored
Use Khronos asciidoctor-spec Docker image in CI (#1196)
* Use Khronos asciidoctor-spec Docker image in CI Per discussion with $bashbaug N.b. at present the CI script has less parallelism than it could, at least as I understand Actions. Some of the 'steps' could be split off into 'jobs'. Might try that next once the basic build is working. Net performance is still somewhat faster than current CI since it's generally faster to load the container than to add needed packages at each invocation, and the spec build is pretty fast, so there's not much to be gained. There was odd error behavior from shifting to the container which I have never seen in Vulkan CI, having to do with mixed ownership of files in the checked-out repository. I inserted a brute-force workaround right after the checkout action. * Update image (SHA changed, though not contents) * Update to 20240702 Docker image which sets HOME=/tmp to avoid asciidoctor-pdf permission problems with tmpfiles in home directory / * Fix SHA and remove fixed parallel job limit on manhtmlpages build * Switch to '#!/usr/bin/env python3' shebang lines Since the Docker build image runs a python virtual environment now. Also added 'scripts/runDocker' script which will invoke docker locally with the same image used in Github CI, for testing. Note this script will pull over a GB of Docker stuff onto the machine it's invoked on, if the image is not already cached. * Empty commit to try and re-trigger the 'fatal' message... ... which appears sporadic, not easily replicable. * Try to bulletproof the git invocations in Makefile * Remove diagnostic job stage after bulletproofing (hopefully) the Makefile For future reference, some of the git operations in CI and the Makefile appear to *sporadically* fail in CI because of different checked-out repo configurations. I modified the 'git symbolic-ref' and 'git log' operations invoked from the Makefile to detect errors and substitute a placeholder message, based on similar changes to the Vulkan Makefile a while back. This (appears) to eliminate the sporadic 'fatal' messages. We may need to do that to the 'git describe' as well. None of this reads on the generated artifacts, except that they may or may not contain accurate tag / commit comments.
1 parent f50c458 commit c75e07f

21 files changed

Lines changed: 83 additions & 44 deletions

.github/workflows/presubmit.yml

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,54 @@ name: Presubmit
33
permissions:
44
contents: read
55

6-
on: [push, pull_request]
6+
# Controls when the action will run.
7+
on:
8+
push:
9+
workflow_dispatch:
10+
pull_request:
711

12+
# These jobs are potentially parallelizeable
813
jobs:
914
build:
10-
name: Build all specs
15+
name: Build spec artifacts
1116
runs-on: ubuntu-latest
17+
# Refer to the build container by its SHA instead of the name, to
18+
# prevent caching problems when updating the image.
19+
# container: khronosgroup/docker-images:asciidoctor-spec.20240702
20+
container: khronosgroup/docker-images@sha256:4aab96a03ef292439c9bd0f972adfa29cdf838d0909b1cb4ec2a6d7b2d14a37f
1221

1322
steps:
1423
- uses: actions/checkout@v4
1524
with:
16-
fetch-depth: 0
1725
submodules: recursive
26+
# If fetch-depth: 0 is not specified, then
27+
# git describe --tags --dirty
28+
# below fails.
29+
# This could also affect SPECREVISION in the Makefile.
30+
fetch-depth: 0
1831

19-
- name: Install required packages
32+
# Ownerships in the working directory are odd.
33+
# . is owned by UID 1001, while repo files are owned by root.
34+
# This leads to many odd messages like
35+
# fatal: detected dubious ownership in repository at '/__w/OpenCL-Docs/OpenCL-Docs'
36+
# The 'git config' is a brute-force workaround.
37+
- name: Git safe directory workaround
2038
run: |
21-
sudo apt-get install -y libpango1.0-dev libwebp-dev ghostscript fonts-lyx jing libavalon-framework-java libbatik-java python3-pyparsing
22-
sudo gem install asciidoctor -v 2.0.16
23-
sudo gem install coderay -v 1.1.1
24-
sudo gem install rouge -v 3.19.0
25-
sudo gem install ttfunk -v 1.7.0
26-
sudo gem install hexapdf -v 0.27.0
27-
sudo gem install asciidoctor-pdf -v 2.3.4
28-
sudo gem install asciidoctor-mathematical -v 0.3.5
29-
sudo pip install pyparsing
30-
31-
- name: List git tag
39+
git config --global --add safe.directory '*'
40+
ls -lda . .. .git Makefile
41+
42+
- name: Validate XML
3243
run: |
33-
git describe --tags --dirty
44+
make -C xml validate
3445
3546
- name: Generate core specs (HTML and PDF)
3647
run: |
37-
python3 makeSpec -clean -spec core OUTDIR=out.core -j 5 api c env ext cxx4opencl
38-
48+
python3 makeSpec -clean -spec core OUTDIR=out.core -j 5 -O api c env ext cxx4opencl
49+
3950
- name: Generate core + extension specs (HTML)
4051
run: |
41-
python3 makeSpec -clean -spec khr OUTDIR=out.khr -j 12 html
52+
python3 makeSpec -clean -spec khr OUTDIR=out.khr -j -O html
4253
4354
- name: Generate reference pages
4455
run: |
45-
python3 makeSpec -spec khr OUTDIR=out.refpages -j 12 manhtmlpages
46-
47-
- name: Validate XML
48-
run: |
49-
make -C xml validate
56+
python3 makeSpec -spec khr OUTDIR=out.refpages -j -O manhtmlpages

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ EXTOPTIONS := $(foreach ext,$(EXTS),-extension $(ext))
1414

1515
QUIET ?=
1616
VERYQUIET ?= @
17+
PYTHON ?= python3
1718
ASCIIDOCTOR ?= asciidoctor
1819
RM = rm -f
1920
RMRF = rm -rf
@@ -72,8 +73,8 @@ SPECREVISION = $(shell echo `git describe --tags --dirty`)
7273
# This used to be a dependency in the spec html/pdf targets,
7374
# but that's likely to lead to merge conflicts. Just regenerate
7475
# when pushing a new spec for review to the sandbox.
75-
SPECREMARK = from git branch: $(shell echo `git symbolic-ref --short HEAD`) \
76-
commit: $(shell echo `git log -1 --format="%H"`)
76+
SPECREMARK = from git branch: $(shell echo `git symbolic-ref --short HEAD 2> /dev/null || echo Git branch not available`) \
77+
commit: $(shell echo `git log -1 --format="%H" 2> /dev/null || echo Git commit not available`)
7778
endif
7879
# The C++ for OpenCL document revision scheme is aligned with its release date.
7980
# Revision naming scheme is as follows:
@@ -545,6 +546,7 @@ $(METADEPEND): $(APIXML) $(GENSCRIPT)
545546
attribs: $(ATTRIBFILE)
546547

547548
$(ATTRIBFILE):
549+
$(QUIET)$(MKDIR) $(dir $@)
548550
for attrib in $(EXTS) ; do \
549551
echo ":$${attrib}:" ; \
550552
done > $@

scripts/apiconventions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3 -i
1+
#!/usr/bin/env python3 -i
22
#
33
# Copyright 2021-2024 The Khronos Group Inc.
44
# SPDX-License-Identifier: Apache-2.0

scripts/cgenerator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3 -i
1+
#!/usr/bin/env python3 -i
22
#
33
# Copyright 2013-2024 The Khronos Group Inc.
44
#

scripts/checklinks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3
1+
#!/usr/bin/env python3
22
#
33
# Copyright 2013-2024 The Khronos Group Inc.
44
# SPDX-License-Identifier: Apache-2.0

scripts/clconventions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3 -i
1+
#!/usr/bin/env python3 -i
22
#
33
# Copyright 2013-2024 The Khronos Group Inc.
44
# SPDX-License-Identifier: Apache-2.0

scripts/docgenerator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3 -i
1+
#!/usr/bin/env python3 -i
22
#
33
# Copyright 2013-2024 The Khronos Group Inc.
44
#

scripts/extensionmetadocgenerator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3 -i
1+
#!/usr/bin/env python3 -i
22
#
33
# Copyright 2013-2024 The Khronos Group Inc.
44
#

scripts/genRef.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3
1+
#!/usr/bin/env python3
22
#
33
# Copyright 2016-2024 The Khronos Group Inc.
44
#

scripts/gen_dictionaries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3
1+
#!/usr/bin/env python3
22

33
# Copyright 2019-2024 The Khronos Group Inc.
44
# SPDX-License-Identifier: Apache-2.0

0 commit comments

Comments
 (0)