Skip to content

Commit 1cd2788

Browse files
committed
More work on GitHub Actions.
- Add Workflow for GitHub CodeQL code analysis. - Add Workflow and Actions for automated releases. - Overhaul and clean up various other Actions. - Rename a few Actions. (Actually, duplicate them; we'll remove the original ones as soon as they're no longer needed by other branches.) - Remove Travis CI and AppVeyor config files for this branch.
1 parent 187e8dc commit 1cd2788

File tree

23 files changed

+935
-324
lines changed

23 files changed

+935
-324
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Get Windows Executable Version Information'
2+
description: 'Extract version information from Windows executable'
3+
4+
inputs:
5+
binary:
6+
description: 'Path and name of binary to examine'
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: 'Extract Version Information from Binary'
13+
shell: pwsh
14+
run: ./tools/windows/get-exe-version.ps1 ${{ inputs.binary }} -github_env $env:GITHUB_ENV
15+
- name: 'Version Information Diagnostics'
16+
shell: bash
17+
run: set | grep -e '^BINARY_'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: 'Get Source Version Information'
2+
description: 'Extract version information from source code'
3+
runs:
4+
using: composite
5+
steps:
6+
- name: 'Extract Version Information from Source'
7+
shell: bash
8+
run: ./tools/unix/get-source-version.sh ./source/base/version.h -github_env $GITHUB_ENV
9+
- name: 'Version Information Diagnostics'
10+
shell: bash
11+
run: set | grep -E '^POV_?RAY_'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Bundle Ignored Files'
2+
description: 'Bundle all untracked ignored files as an artifact'
3+
4+
inputs:
5+
name:
6+
description: 'Artifact name'
7+
required: true
8+
default: 'artifact_diag.tar.gz'
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- shell: bash
14+
run: |
15+
artifacts=$( git status --porcelain --ignored -uall | egrep '^[!]' | cut -c 4- || true )
16+
tar -cvzf "${{inputs.name}}" $artifacts || true
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Sanity-Check Working Tree'
2+
description: 'Verify that working tree (and index) of repository is "clean"'
3+
runs:
4+
using: composite
5+
steps:
6+
- shell: bash
7+
run: |
8+
changed=$( git status --porcelain )
9+
if test -z "$changed" ; then
10+
echo "No unexpected changes to the working tree found."
11+
exit 0
12+
fi
13+
untracked=$( echo "$changed" | egrep '^[?]' || true )
14+
changed=$( echo "$changed" | egrep '^[^?]' || true )
15+
if test -n "$untracked" ; then
16+
echo "::error::Build process adds files not covered by .gitignore."
17+
fi
18+
if test -n "$changed" ; then
19+
echo "::error::Build process tampers with tracked files."
20+
fi
21+
echo "::group::Offending files:"
22+
echo "$untracked"
23+
echo "$changed"
24+
echo "::endgroup::"
25+
exit 1
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'Create Release'
2+
description: 'Create GitHub Release from commit under examination'
3+
4+
inputs:
5+
token:
6+
description: 'GitHub access token'
7+
required: true
8+
is-draft:
9+
description: 'Whether to generate a draft only'
10+
required: true
11+
is-prerelease:
12+
description: 'Whether to generate a pre-release only'
13+
required: true
14+
tag-name:
15+
description: 'Name of the associated tag to create'
16+
required: true
17+
title:
18+
description: 'Title of the release'
19+
required: true
20+
notes-file:
21+
description: 'File containing release notes'
22+
required: true
23+
assets:
24+
description: 'Blank-separated list of filenames to attach as assets'
25+
required: false
26+
default: ''
27+
28+
runs:
29+
using: composite
30+
steps:
31+
- shell: bash
32+
run: |
33+
if ${{ inputs.is-draft }} ; then
34+
draft_switch='--draft'
35+
else
36+
draft_switch=''
37+
# git config --global user.name "${{ inputs.token }}"
38+
# git tag -a -m "${{ inputs.message }}" "${{ inputs.tag-name }}"
39+
# git push origin "${{ inputs.tag-name }}"
40+
fi
41+
if ${{ inputs.is-prerelease }} ; then
42+
prerelease_switch='--prerelease'
43+
else
44+
prerelease_switch=''
45+
fi
46+
gh auth login --with-token <<< "${{ inputs.token }}"
47+
gh release create ${{ inputs.tag-name }} \
48+
--target ${{ github.sha }} \
49+
$draft_switch $prerelease_switch \
50+
--title "${{ inputs.title }}" \
51+
--notes-file "${{ inputs.notes-file }}" \
52+
${{ inputs.assets }}

.github/actions/unix_configure/action.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@ inputs:
1616
default: ''
1717

1818
runs:
19-
using: "composite"
19+
using: composite
2020
steps:
21-
- shell: bash
22-
run: |
23-
# TODO: Figure out a neat way to compile with SDL to check the build,
24-
# but have `make check` pass -D instead of +D to POV-Ray
25-
# TODO: Invoke the chosen compiler, rather than the standard one
26-
if test -n "${{inputs.c-compiler}}" ; then
27-
export CC="${{inputs.c-compiler}}"
28-
fi
29-
if test -n "${{inputs.cxx-compiler}}" ; then
30-
export CXX="${{inputs.cxx-compiler}}"
31-
fi
32-
./configure --without-libsdl --without-x ${{inputs.configure-options}} COMPILED_BY="GitHub"
21+
- shell: bash
22+
run: |
23+
# TODO: Figure out a neat way to compile with SDL to check the build,
24+
# but have `make check` pass -D instead of +D to POV-Ray
25+
if test -n "${{inputs.c-compiler}}" ; then
26+
export CC="${{inputs.c-compiler}}"
27+
fi
28+
if test -n "${{inputs.cxx-compiler}}" ; then
29+
export CXX="${{inputs.cxx-compiler}}"
30+
fi
31+
./configure --without-libsdl --without-x ${{inputs.configure-options}} COMPILED_BY="GitHub"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: 'Install Packages'
2+
description: 'Install required packages'
3+
runs:
4+
using: composite
5+
steps:
6+
- env:
7+
package_matrix: |
8+
_os | Linux | macOS |
9+
_update | sudo apt-get update | brew update | cmd to update pkg mgr database
10+
_install | sudo apt-get install --no-upgrade | brew install | cmd to install pkg
11+
boost/ | libboost-dev | boost | bulk of boost lib
12+
boost/boost/date_time/ | libboost-date-time-dev | | boost date-time lib
13+
boost/libs/system/ | libboost-system-dev | | boost system lib
14+
boost/libs/thread/ | libboost-thread-dev | | boost thread lib
15+
freetype/ | libfreetype-dev | freetype |
16+
jpeg/ | libjpeg-dev | libjpeg |
17+
openexr/ | libopenexr-dev | openexr |
18+
png/ | libpng-dev | libpng |
19+
| libsdl-dev | sdl | simple direct media layer
20+
tiff/ | libtiff-dev | libtiff |
21+
zlib/ | libz-dev | zlib |
22+
| automake | automake |
23+
| pkg-config | pkg-config |
24+
shell: bash
25+
run: |
26+
echo "Preparing to install packages for ${{ runner.os }}"
27+
package_matrix=`echo "${package_matrix}" | sed 's/ *| */|/g'`
28+
col_list=`echo "${package_matrix}" | head -n1 | tr '|' '\n'`
29+
col_os=`echo "${col_list}" | grep -nx "${{ runner.os }}" || true`
30+
if test -z "${col_os}" ; then
31+
echo "::error::Operating system not found in matrix."
32+
exit 1
33+
fi
34+
col_index=`echo "${col_os}" | cut -d':' -f1`
35+
package_matrix=`echo "${package_matrix}" | cut -d'|' -f"1,${col_index}"`
36+
do_update=`echo "${package_matrix}" | grep '_update' | cut -d'|' -f2`
37+
do_install=`echo "${package_matrix}" | grep '_install' | cut -d'|' -f2`
38+
echo "::group::Determine packages to install"
39+
cp /dev/null ~PACKAGE_LIST
40+
echo "${package_matrix}" | while read line ; do
41+
key=`echo ${line} | cut -d'|' -f1`
42+
value=`echo ${line} | cut -d'|' -f2`
43+
if test -z "${value}" ; then
44+
continue
45+
fi
46+
case "${key}" in
47+
_*) continue ;;
48+
'') condition="true" ;;
49+
*/) condition="test -d 'libraries/${key}'" ;;
50+
*) echo "::warning::Ignoring unexpected key '${key}' in package matrix." ; continue ;;
51+
esac
52+
if eval "${condition}" ; then
53+
echo "${value}" | tee -a ~PACKAGE_LIST
54+
else
55+
echo "(${value} not required for this version)"
56+
fi
57+
done
58+
package_list=`cat ~PACKAGE_LIST`
59+
rm ~PACKAGE_LIST
60+
echo "::endgroup::"
61+
if test -n "${do_update}" ; then
62+
echo "::group::Update package manager database"
63+
${do_update}
64+
echo "::endgroup::"
65+
else
66+
echo "::warning::No package manager update command found in matrix."
67+
fi
68+
if test -n "${do_install}" ; then
69+
echo "::group::Install packages"
70+
${do_install} ${package_list}
71+
echo "::endgroup::"
72+
elif test -n "${package_list}" ; then
73+
echo "::error::No package manager install command found in matrix."
74+
else
75+
echo "::warning::No package manager install command found in matrix (nor packages to install)."
76+
fi

.github/actions/unix_make/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ inputs:
88
default: ''
99

1010
runs:
11-
using: "composite"
11+
using: composite
1212
steps:
13-
- shell: bash
14-
run: |
15-
make ${{ inputs.make-target }}
13+
- shell: bash
14+
run: |
15+
make ${{ inputs.make-target }}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: 'Pre-Build POV-Ray for Unix'
22
description: 'Run `prebuild.sh` build step for POV-Ray for Unix'
33
runs:
4-
using: "composite"
4+
using: composite
55
steps:
6-
- shell: bash
7-
run: |
8-
cd unix && ./prebuild.sh && cd ..
6+
- shell: bash
7+
run: |
8+
cd unix && ./prebuild.sh && cd ..

.github/actions/windows_build/action.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'Build POV-Ray for Windows'
2-
description: 'Build POV-Ray for Windows'
1+
name: 'Build POV-Ray for Windows Binary'
2+
description: 'Build POV-Ray for Windows Binary'
33

44
inputs:
55
pov-ray-is-autobuild:
@@ -34,19 +34,17 @@ inputs:
3434
default: ''
3535

3636
runs:
37-
using: "composite"
37+
using: composite
3838
steps:
39-
40-
- name: 'Prebuild'
41-
shell: pwsh
42-
run: |
43-
$env:PovBuildDefs = 'POV_RAY_IS_AUTOBUILD=${{ inputs.pov-ray-is-autobuild }};'
44-
$env:PovBuildDefs += 'POV_RAY_BUILD_ID="${{ inputs.pov-ray-build-id }}";'
45-
$env:PovBuildDefs += 'BUILT_BY="${{ inputs.built-by }}";'
46-
msbuild `
47-
/t:Rebuild /m `
48-
/p:Configuration=${{ inputs.configuration }} `
49-
/p:Platform=${{ inputs.platform }} `
50-
/p:PlatformToolset=${{ inputs.toolset }} `
51-
${{ inputs.msbuild-options }} `
52-
windows/${{ inputs.solution }}/povray.sln
39+
- shell: pwsh
40+
run: |
41+
$env:PovBuildDefs = 'POV_RAY_IS_AUTOBUILD=${{ inputs.pov-ray-is-autobuild }};'
42+
$env:PovBuildDefs += 'POV_RAY_BUILD_ID="${{ inputs.pov-ray-build-id }}";'
43+
$env:PovBuildDefs += 'BUILT_BY="${{ inputs.built-by }}";'
44+
msbuild `
45+
/t:Rebuild /m `
46+
/p:Configuration=${{ inputs.configuration }} `
47+
/p:Platform=${{ inputs.platform }} `
48+
/p:PlatformToolset=${{ inputs.toolset }} `
49+
${{ inputs.msbuild-options }} `
50+
windows/${{ inputs.solution }}/povray.sln

0 commit comments

Comments
 (0)