From 1cd27888681e8dd5d9b3cb29137e478c9ff77927 Mon Sep 17 00:00:00 2001 From: Christoph Lipka Date: Tue, 15 Jun 2021 21:01:37 +0200 Subject: [PATCH] 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. --- .github/actions/get_exe_version/action.yml | 17 + .github/actions/get_source_version/action.yml | 11 + .github/actions/git_bundle_ignored/action.yml | 16 + .github/actions/git_check_repo/action.yml | 25 ++ .../actions/github_create_release/action.yml | 52 +++ .github/actions/unix_configure/action.yml | 25 +- .github/actions/unix_getlibs/action.yml | 76 ++++ .github/actions/unix_make/action.yml | 8 +- .github/actions/unix_prebuild/action.yml | 8 +- .github/actions/windows_build/action.yml | 32 +- .../windows_build_installer/action.yml | 43 ++ .github/workflows/codeql-analysis.yml | 48 ++ .github/workflows/release_build.yml | 409 ++++++++++++++++++ .github/workflows/test_build_quick.yml | 48 +- .github/workflows/test_build_unix.yml | 48 +- .github/workflows/test_build_windows.yml | 33 +- .travis.yml | 55 --- README.md | 8 +- appveyor.yml | 113 ----- tools/unix/get-source-version.sh | 37 +- tools/windows/get-exe-version.ps1 | 76 ++++ tools/windows/get-source-version.bat | 1 + tools/windows/get-source-version.ps1 | 70 +-- 23 files changed, 935 insertions(+), 324 deletions(-) create mode 100644 .github/actions/get_exe_version/action.yml create mode 100644 .github/actions/get_source_version/action.yml create mode 100644 .github/actions/git_bundle_ignored/action.yml create mode 100644 .github/actions/git_check_repo/action.yml create mode 100644 .github/actions/github_create_release/action.yml create mode 100644 .github/actions/unix_getlibs/action.yml create mode 100644 .github/actions/windows_build_installer/action.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/release_build.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml create mode 100755 tools/windows/get-exe-version.ps1 mode change 100644 => 100755 tools/windows/get-source-version.bat mode change 100644 => 100755 tools/windows/get-source-version.ps1 diff --git a/.github/actions/get_exe_version/action.yml b/.github/actions/get_exe_version/action.yml new file mode 100644 index 000000000..282999b03 --- /dev/null +++ b/.github/actions/get_exe_version/action.yml @@ -0,0 +1,17 @@ +name: 'Get Windows Executable Version Information' +description: 'Extract version information from Windows executable' + +inputs: + binary: + description: 'Path and name of binary to examine' + required: true + +runs: + using: composite + steps: + - name: 'Extract Version Information from Binary' + shell: pwsh + run: ./tools/windows/get-exe-version.ps1 ${{ inputs.binary }} -github_env $env:GITHUB_ENV + - name: 'Version Information Diagnostics' + shell: bash + run: set | grep -e '^BINARY_' diff --git a/.github/actions/get_source_version/action.yml b/.github/actions/get_source_version/action.yml new file mode 100644 index 000000000..910a23127 --- /dev/null +++ b/.github/actions/get_source_version/action.yml @@ -0,0 +1,11 @@ +name: 'Get Source Version Information' +description: 'Extract version information from source code' +runs: + using: composite + steps: + - name: 'Extract Version Information from Source' + shell: bash + run: ./tools/unix/get-source-version.sh ./source/base/version.h -github_env $GITHUB_ENV + - name: 'Version Information Diagnostics' + shell: bash + run: set | grep -E '^POV_?RAY_' diff --git a/.github/actions/git_bundle_ignored/action.yml b/.github/actions/git_bundle_ignored/action.yml new file mode 100644 index 000000000..19e65e7f0 --- /dev/null +++ b/.github/actions/git_bundle_ignored/action.yml @@ -0,0 +1,16 @@ +name: 'Bundle Ignored Files' +description: 'Bundle all untracked ignored files as an artifact' + +inputs: + name: + description: 'Artifact name' + required: true + default: 'artifact_diag.tar.gz' + +runs: + using: composite + steps: + - shell: bash + run: | + artifacts=$( git status --porcelain --ignored -uall | egrep '^[!]' | cut -c 4- || true ) + tar -cvzf "${{inputs.name}}" $artifacts || true diff --git a/.github/actions/git_check_repo/action.yml b/.github/actions/git_check_repo/action.yml new file mode 100644 index 000000000..ddd6d30c5 --- /dev/null +++ b/.github/actions/git_check_repo/action.yml @@ -0,0 +1,25 @@ +name: 'Sanity-Check Working Tree' +description: 'Verify that working tree (and index) of repository is "clean"' +runs: + using: composite + steps: + - shell: bash + run: | + changed=$( git status --porcelain ) + if test -z "$changed" ; then + echo "No unexpected changes to the working tree found." + exit 0 + fi + untracked=$( echo "$changed" | egrep '^[?]' || true ) + changed=$( echo "$changed" | egrep '^[^?]' || true ) + if test -n "$untracked" ; then + echo "::error::Build process adds files not covered by .gitignore." + fi + if test -n "$changed" ; then + echo "::error::Build process tampers with tracked files." + fi + echo "::group::Offending files:" + echo "$untracked" + echo "$changed" + echo "::endgroup::" + exit 1 diff --git a/.github/actions/github_create_release/action.yml b/.github/actions/github_create_release/action.yml new file mode 100644 index 000000000..fe5c10006 --- /dev/null +++ b/.github/actions/github_create_release/action.yml @@ -0,0 +1,52 @@ +name: 'Create Release' +description: 'Create GitHub Release from commit under examination' + +inputs: + token: + description: 'GitHub access token' + required: true + is-draft: + description: 'Whether to generate a draft only' + required: true + is-prerelease: + description: 'Whether to generate a pre-release only' + required: true + tag-name: + description: 'Name of the associated tag to create' + required: true + title: + description: 'Title of the release' + required: true + notes-file: + description: 'File containing release notes' + required: true + assets: + description: 'Blank-separated list of filenames to attach as assets' + required: false + default: '' + +runs: + using: composite + steps: + - shell: bash + run: | + if ${{ inputs.is-draft }} ; then + draft_switch='--draft' + else + draft_switch='' + # git config --global user.name "${{ inputs.token }}" + # git tag -a -m "${{ inputs.message }}" "${{ inputs.tag-name }}" + # git push origin "${{ inputs.tag-name }}" + fi + if ${{ inputs.is-prerelease }} ; then + prerelease_switch='--prerelease' + else + prerelease_switch='' + fi + gh auth login --with-token <<< "${{ inputs.token }}" + gh release create ${{ inputs.tag-name }} \ + --target ${{ github.sha }} \ + $draft_switch $prerelease_switch \ + --title "${{ inputs.title }}" \ + --notes-file "${{ inputs.notes-file }}" \ + ${{ inputs.assets }} diff --git a/.github/actions/unix_configure/action.yml b/.github/actions/unix_configure/action.yml index f64aaa2f3..dbe885c01 100644 --- a/.github/actions/unix_configure/action.yml +++ b/.github/actions/unix_configure/action.yml @@ -16,17 +16,16 @@ inputs: default: '' runs: - using: "composite" + using: composite steps: - - shell: bash - run: | - # TODO: Figure out a neat way to compile with SDL to check the build, - # but have `make check` pass -D instead of +D to POV-Ray - # TODO: Invoke the chosen compiler, rather than the standard one - if test -n "${{inputs.c-compiler}}" ; then - export CC="${{inputs.c-compiler}}" - fi - if test -n "${{inputs.cxx-compiler}}" ; then - export CXX="${{inputs.cxx-compiler}}" - fi - ./configure --without-libsdl --without-x ${{inputs.configure-options}} COMPILED_BY="GitHub" + - shell: bash + run: | + # TODO: Figure out a neat way to compile with SDL to check the build, + # but have `make check` pass -D instead of +D to POV-Ray + if test -n "${{inputs.c-compiler}}" ; then + export CC="${{inputs.c-compiler}}" + fi + if test -n "${{inputs.cxx-compiler}}" ; then + export CXX="${{inputs.cxx-compiler}}" + fi + ./configure --without-libsdl --without-x ${{inputs.configure-options}} COMPILED_BY="GitHub" diff --git a/.github/actions/unix_getlibs/action.yml b/.github/actions/unix_getlibs/action.yml new file mode 100644 index 000000000..a463fee7f --- /dev/null +++ b/.github/actions/unix_getlibs/action.yml @@ -0,0 +1,76 @@ +name: 'Install Packages' +description: 'Install required packages' +runs: + using: composite + steps: + - env: + package_matrix: | + _os | Linux | macOS | + _update | sudo apt-get update | brew update | cmd to update pkg mgr database + _install | sudo apt-get install --no-upgrade | brew install | cmd to install pkg + boost/ | libboost-dev | boost | bulk of boost lib + boost/boost/date_time/ | libboost-date-time-dev | | boost date-time lib + boost/libs/system/ | libboost-system-dev | | boost system lib + boost/libs/thread/ | libboost-thread-dev | | boost thread lib + freetype/ | libfreetype-dev | freetype | + jpeg/ | libjpeg-dev | libjpeg | + openexr/ | libopenexr-dev | openexr | + png/ | libpng-dev | libpng | + | libsdl-dev | sdl | simple direct media layer + tiff/ | libtiff-dev | libtiff | + zlib/ | libz-dev | zlib | + | automake | automake | + | pkg-config | pkg-config | + shell: bash + run: | + echo "Preparing to install packages for ${{ runner.os }}" + package_matrix=`echo "${package_matrix}" | sed 's/ *| */|/g'` + col_list=`echo "${package_matrix}" | head -n1 | tr '|' '\n'` + col_os=`echo "${col_list}" | grep -nx "${{ runner.os }}" || true` + if test -z "${col_os}" ; then + echo "::error::Operating system not found in matrix." + exit 1 + fi + col_index=`echo "${col_os}" | cut -d':' -f1` + package_matrix=`echo "${package_matrix}" | cut -d'|' -f"1,${col_index}"` + do_update=`echo "${package_matrix}" | grep '_update' | cut -d'|' -f2` + do_install=`echo "${package_matrix}" | grep '_install' | cut -d'|' -f2` + echo "::group::Determine packages to install" + cp /dev/null ~PACKAGE_LIST + echo "${package_matrix}" | while read line ; do + key=`echo ${line} | cut -d'|' -f1` + value=`echo ${line} | cut -d'|' -f2` + if test -z "${value}" ; then + continue + fi + case "${key}" in + _*) continue ;; + '') condition="true" ;; + */) condition="test -d 'libraries/${key}'" ;; + *) echo "::warning::Ignoring unexpected key '${key}' in package matrix." ; continue ;; + esac + if eval "${condition}" ; then + echo "${value}" | tee -a ~PACKAGE_LIST + else + echo "(${value} not required for this version)" + fi + done + package_list=`cat ~PACKAGE_LIST` + rm ~PACKAGE_LIST + echo "::endgroup::" + if test -n "${do_update}" ; then + echo "::group::Update package manager database" + ${do_update} + echo "::endgroup::" + else + echo "::warning::No package manager update command found in matrix." + fi + if test -n "${do_install}" ; then + echo "::group::Install packages" + ${do_install} ${package_list} + echo "::endgroup::" + elif test -n "${package_list}" ; then + echo "::error::No package manager install command found in matrix." + else + echo "::warning::No package manager install command found in matrix (nor packages to install)." + fi diff --git a/.github/actions/unix_make/action.yml b/.github/actions/unix_make/action.yml index d6b85967c..dd154e7be 100644 --- a/.github/actions/unix_make/action.yml +++ b/.github/actions/unix_make/action.yml @@ -8,8 +8,8 @@ inputs: default: '' runs: - using: "composite" + using: composite steps: - - shell: bash - run: | - make ${{ inputs.make-target }} + - shell: bash + run: | + make ${{ inputs.make-target }} diff --git a/.github/actions/unix_prebuild/action.yml b/.github/actions/unix_prebuild/action.yml index 8339ece65..4049c11a8 100644 --- a/.github/actions/unix_prebuild/action.yml +++ b/.github/actions/unix_prebuild/action.yml @@ -1,8 +1,8 @@ name: 'Pre-Build POV-Ray for Unix' description: 'Run `prebuild.sh` build step for POV-Ray for Unix' runs: - using: "composite" + using: composite steps: - - shell: bash - run: | - cd unix && ./prebuild.sh && cd .. + - shell: bash + run: | + cd unix && ./prebuild.sh && cd .. diff --git a/.github/actions/windows_build/action.yml b/.github/actions/windows_build/action.yml index 8a90db1f2..6161590b4 100644 --- a/.github/actions/windows_build/action.yml +++ b/.github/actions/windows_build/action.yml @@ -1,5 +1,5 @@ -name: 'Build POV-Ray for Windows' -description: 'Build POV-Ray for Windows' +name: 'Build POV-Ray for Windows Binary' +description: 'Build POV-Ray for Windows Binary' inputs: pov-ray-is-autobuild: @@ -34,19 +34,17 @@ inputs: default: '' runs: - using: "composite" + using: composite steps: - - - name: 'Prebuild' - shell: pwsh - run: | - $env:PovBuildDefs = 'POV_RAY_IS_AUTOBUILD=${{ inputs.pov-ray-is-autobuild }};' - $env:PovBuildDefs += 'POV_RAY_BUILD_ID="${{ inputs.pov-ray-build-id }}";' - $env:PovBuildDefs += 'BUILT_BY="${{ inputs.built-by }}";' - msbuild ` - /t:Rebuild /m ` - /p:Configuration=${{ inputs.configuration }} ` - /p:Platform=${{ inputs.platform }} ` - /p:PlatformToolset=${{ inputs.toolset }} ` - ${{ inputs.msbuild-options }} ` - windows/${{ inputs.solution }}/povray.sln + - shell: pwsh + run: | + $env:PovBuildDefs = 'POV_RAY_IS_AUTOBUILD=${{ inputs.pov-ray-is-autobuild }};' + $env:PovBuildDefs += 'POV_RAY_BUILD_ID="${{ inputs.pov-ray-build-id }}";' + $env:PovBuildDefs += 'BUILT_BY="${{ inputs.built-by }}";' + msbuild ` + /t:Rebuild /m ` + /p:Configuration=${{ inputs.configuration }} ` + /p:Platform=${{ inputs.platform }} ` + /p:PlatformToolset=${{ inputs.toolset }} ` + ${{ inputs.msbuild-options }} ` + windows/${{ inputs.solution }}/povray.sln diff --git a/.github/actions/windows_build_installer/action.yml b/.github/actions/windows_build_installer/action.yml new file mode 100644 index 000000000..c58228032 --- /dev/null +++ b/.github/actions/windows_build_installer/action.yml @@ -0,0 +1,43 @@ +name: 'Build POV-Ray for Windows Installer' +description: 'Build POV-Ray for Windows Installer' + +inputs: + installer-path: + description: 'Location of the installer source files' + required: true + version-prototype: + description: 'Location of binary to pull version information from' + required: true + +outputs: + installer-file: + description: 'Name of the compiled installer binary file' + value: ${{ steps.build-installer.outputs.installer-file }} + +runs: + using: composite + steps: + + - name: 'Extract Binary Version Information' + shell: pwsh + run: | + ./tools/windows/get-exe-version.ps1 ${{ inputs.version-prototype }} -bat ~version.bat + + - name: 'Build Installer' + id: build-installer + shell: cmd + run: | + call ~version.bat + set BINVER=%BINARY_PRODUCTMAJORPART%.%BINARY_PRODUCTMINORPART%.%BINARY_PRODUCTBUILDPART%.%BINARY_PRODUCTPRIVATEPART% + set FULLVER=%BINARY_PRODUCTVERSION% + for /f "tokens=1 delims=+" %%I in ("%FULLVER%") do set SOURCEVER=%%I + for /f "tokens=1* delims=-" %%I in ("%SOURCEVER%") do set PRERELEASE=%%J + for /f "tokens=1 delims=." %%I in ("%PRERELEASE%") do set PRERELEASE_TYPE=%%I + for /f "tokens=1,2 delims=." %%I in ("%SOURCEVER%") do set VER=%%I.%%J + set BETA= + if "%PRERELEASE_TYPE%" == "beta" set BETA=-beta + cd installer + makensis.exe setup.nsi + set INSTALLER_FILE=povwin-v%FULLVER%-setup.exe + ren "povwin-%VER%-agpl3-setup.exe" "%INSTALLER_FILE%" + echo ::set-output name=installer-file::installer/%INSTALLER_FILE% diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..209cac51c --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,48 @@ +name: 'Code Analysis' + +on: + push: + branches: [ 'master', 'release/*' ] + # There's no actual source code to examine in the following directories. + paths-ignore: [ 'distribution/**', 'doc/**', 'source-doc/**', 'tools/**' ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ 'master', 'release/*' ] + # There's no actual source code to examine in the following directories. + paths-ignore: [ 'distribution/**', 'doc/**', 'source-doc/**', 'tools/**' ] + +jobs: + analyze: + name: 'Analyze' + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + steps: + + - name: 'Check out Repository' + uses: actions/checkout@v2 + + - name: 'Initialize CodeQL' + uses: github/codeql-action/init@v1 + with: + languages: cpp + # Comment out the following to perform just the bare minimum of checks: + queries: security-extended + # Use the following instead to perform the whole suite of pre-defined checks: + # queries: security-and-quality + + - name: 'Install Prerequisites' + uses: POV-Ray/povray/.github/actions/unix_getlibs@gh-actions-v1 + + - name: 'Prebuild' + uses: POV-Ray/povray/.github/actions/unix_prebuild@gh-actions-v1 + - name: 'Configure' + uses: POV-Ray/povray/.github/actions/unix_configure@gh-actions-v1 + - name: 'Build' + uses: POV-Ray/povray/.github/actions/unix_make@gh-actions-v1 + + - name: 'Perform CodeQL Analysis' + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml new file mode 100644 index 000000000..a550d17c3 --- /dev/null +++ b/.github/workflows/release_build.yml @@ -0,0 +1,409 @@ +name: 'Release Build' + +on: + workflow_dispatch: + push: + # Do not automatically trigger a new build unless the branch is dedicated to that purpose. + branches: [ 'autobuild/*' ] + # Do not automatically trigger a new build unless the version number has been bumped. + paths: [ 'source/base/version.h' ] + +jobs: + + sanity_check: + name: 'Sanity-Check' + runs-on: ubuntu-latest + outputs: + do-build-installer: ${{ steps.check_validity.do-build-installer }} + steps: + + - name: 'Check out Repository' + uses: actions/checkout@v2 + + - name: 'Extract Source Version Information' + uses: POV-Ray/povray/.github/actions/get_source_version@gh-actions-v1 + + - name: 'Check Commit for Validity' + id: check_validity + shell: bash + run: | + tag_name="v${POV_RAY_FULL_VERSION}" + git fetch --tags --quiet + if git rev-parse "${tag_name}" >/dev/null 2>&1 ; then + echo "::error::Tag '${tag_name}' already exists, or conflicts with some other moniker." + exit 1 + fi + if ! echo "${tag_name}" | egrep '[.][1-9][0-9]*$' >/dev/null 2>&1 ; then + echo "::error::Tag '${tag_name}' does not end in a numeric field." + exit 1 + fi + if test -z "${POV_RAY_PRERELEASE}" ; then + echo "::warning::Proper release installers must be built manually from signed binaries." + echo "::set-output name=do-build-installer::false" + exit 0 + fi + if echo "${POV_RAY_PRERELEASE}" | grep '^rc[.]' >/dev/null 2>&1 ; then + echo "::warning::Release candidate installers must be built manually from signed binaries." + echo "::set-output name=do-build-installer::false" + exit 0 + fi + echo "::set-output name=do-build-installer::true" + + build_unix_package: + name: 'Build Unix Source Package' + needs: sanity_check + runs-on: ubuntu-latest + steps: + + - name: 'Check out Repository' + uses: actions/checkout@v2 + + - name: 'Extract Source Version Information' + uses: POV-Ray/povray/.github/actions/get_source_version@gh-actions-v1 + + - name: 'Prebuild' + uses: POV-Ray/povray/.github/actions/unix_prebuild@gh-actions-v1 + + - name: 'Package' + shell: bash + run: | + prebuild_made=`git status --porcelain --ignored | egrep '^[!]' | cut -c 4- || true` + echo "::group::Files and directories created by prebuild:" + echo "${prebuild_made}" + echo "::endgroup::" + tarfile="povunix-v${POV_RAY_FULL_VERSION}.tar" + # Bundle relevant portions of the original source tree, making sure + # to exclude interim products placed there by the prebuild process. + tar -chWf "${tarfile}" \ + --anchored \ + --exclude="*Makefile.am" \ + --exclude="unix/prebuild*" \ + --exclude="unix/scripts*" \ + --exclude="platform/windows" \ + --exclude="vfe/win" \ + doc platform source unix vfe \ + LICENSE README.md changes.txt revision.txt + # Add everything created by the prebuild process, except for some + # interim products created by the prebuild process. + # (Note that some files may have already been added by the previous + # command, so we're using `-u` instead of `-r` to avoid duplicates.) + tar -uhWf "${tarfile}" \ + --anchored \ + --exclude="*Makefile.am" \ + --exclude="configure.ac" \ + --exclude="bootstrap" \ + ${prebuild_made} + # Compress bundle into proper tarball + gzip "${tarfile}" + + - name: 'Upload Artifacts for Release' + uses: actions/upload-artifact@v2 + with: + name: artifact_unix_package + path: povunix-*.tar.gz + + build_sourcedoc: + name: 'Build Source Documentation' + needs: sanity_check + runs-on: ubuntu-latest + + steps: + + - name: 'Check out Repository' + uses: actions/checkout@v2 + + - name: 'Extract Source Version Information' + uses: POV-Ray/povray/.github/actions/get_source_version@gh-actions-v1 + + - name: 'Install Prerequisites' + shell: bash + run: | + # Make sure our package list is up to date + sudo apt-get update + # Make sure we have all the tools we want + sudo apt-get install --no-upgrade \ + doxygen \ + doxygen-latex \ + graphviz \ + p7zip-full + + - name: 'Build Source Documentation' + shell: bash + run: | + cd tools/doxygen + ./doxygen.sh + + - name: 'Bundle Source Documentation' + shell: bash + run: | + mkdir artifact + basedir=`pwd` + cd tools/doxygen/source-doc/html + 7z a "${basedir}/artifact/povray-v${POV_RAY_FULL_VERSION}-sourcedoc-html.7z" . + cd ../pdf + cp *.pdf "${basedir}/artifact/povray-v${POV_RAY_FULL_VERSION}-sourcedoc.pdf" + + - name: 'Upload Artifacts for Installer Release' + uses: actions/upload-artifact@v2 + with: + name: artifact_sourcedoc + path: artifact/* + + build_windows_binaries: + name: 'Build ${{ matrix.artifact-suffix }} Binary' + needs: sanity_check + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true # If any build fails, we need to re-run anyway. + matrix: + include: + + - artifact-suffix: Win64 + configuration: Release + platform: x64 + bin-dir: bin64 + bin-name: pvengine64.exe + install-name: pvengine64.exe + compatibility: '' + os: windows-2016 + solution-dir: vs2015 + toolset: v140 # VS 2015 + msbuild-options: '' + + - artifact-suffix: Win32-sse2 + configuration: Release-SSE2 + platform: Win32 + bin-dir: bin32 + bin-name: pvengine32-sse2.exe + install-name: pvengine-sse2.exe + compatibility: '' + os: windows-2016 + solution-dir: vs2015 + toolset: v140 # VS 2015 + msbuild-options: '' + + - artifact-suffix: Win32 + configuration: Release + platform: Win32 + bin-dir: bin32 + bin-name: pvengine32.exe + install-name: pvengine.exe + compatibility: '' + os: windows-2016 + solution-dir: vs2015 + toolset: v140 # VS 2015 + msbuild-options: '' + +# - artifact-suffix: Win32-xp +# configuration: Release +# platform: Win32 +# bin-dir: bin32 +# bin-name: pvengine32.exe +# install-name: pvengine.exe +# compatibility: 'xp' +# os: windows-2016 +# solution-dir: vs2015 +# toolset: v140_xp # VS 2015 with XP support +# msbuild-options: '/p:TargetUniversalCRTVersion=10.0.10586.0' + + steps: + + - name: 'Matrix Diagnostics' + shell: pwsh + run: | + echo "${{ toJSON(matrix) }}" + + - name: 'Check out Repository' + uses: actions/checkout@v2 + + - name: 'Add MSBuild to PATH' + uses: microsoft/setup-msbuild@v1.0.2 + + - name: 'Build' + uses: POV-Ray/povray/.github/actions/windows_build@gh-actions-v1 + with: + pov-ray-build-id: gh${{github.run_number}}${{matrix.compatibility}} + solution: ${{matrix.solution-dir}} + configuration: ${{matrix.configuration}} + platform: ${{matrix.platform}} + toolset: ${{matrix.toolset}} + msbuild-options: ${{matrix.msbuild-options}} + + - name: 'Prepare Binary for Artifact Upload' + shell: pwsh + run: | + $env:pov_binary = "windows/${{matrix.solution-dir}}/${{matrix.bin-dir}}/${{matrix.bin-name}}" + New-Item -ItemType directory -Path "installer/core/bin" | Out-Null + Copy-Item $env:pov_binary "installer/core/bin/${{matrix.install-name}}" + + - name: 'Upload Artifacts for Installer Build' + uses: actions/upload-artifact@v2 + with: + name: artifact_installer_tree + path: installer/* + + build_windows_installer: + name: 'Build Windows Installer' + needs: [ sanity_check, build_windows_binaries ] + if: ${{ needs.sanity_check.outputs.do-build-installer }} + runs-on: windows-latest + steps: + + - name: 'Check out Repository' + uses: actions/checkout@v2 + + - name: 'Populate Installer Tree' + env: + POV_RAY_SETUP_NSI: ${{ secrets.POV_RAY_SETUP_NSI_V3_8 }} + shell: bash + run: | + + mkdir "installer" + cp "distribution/agpl-3.0.txt" "installer" + cp "changes.txt" "installer" + cp "revision.txt" "installer" + echo "${POV_RAY_SETUP_NSI}" > "installer/setup.nsi" + + mkdir "installer/core" + cp -R "distribution/platform-specific/windows/Icons/." "installer/core/bin" + cp -R "distribution/platform-specific/windows/Help/." "installer/core/help" + cp -R "distribution/platform-specific/windows/Sounds/." "installer/core/sounds" + cp -R "distribution/platform-specific/windows/Tiles/." "installer/core/tiles" + + mkdir "installer/user" + cp -R "distribution/include/." "installer/user/include" + cp -R "distribution/ini/." "installer/user/ini" + cp -R "distribution/platform-specific/windows/Ini/." "installer/user/ini" + cp -R "distribution/platform-specific/windows/Insert Menu/." "installer/user/Insert Menu" + cp -R "distribution/scenes/." "installer/user/scenes" + + - name: 'Retrieve Artifacts for Installer Build' + uses: actions/download-artifact@v2 + with: + name: artifact_installer_tree + path: installer + + - name: 'Build Installer' + id: build-installer + uses: POV-Ray/povray/.github/actions/windows_build_installer@gh-actions-v1 + with: + installer-path: "installer" + version-prototype: "installer/core/bin/pvengine64.exe" + + - name: 'Upload Artifacts for Release' + uses: actions/upload-artifact@v2 + with: + name: artifact_installer + path: ${{ steps.build-installer.outputs.installer-file }} + + - name: 'Upload Installer Artifacts for Diagnostics' + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + with: + name: artifact_installer_diag + path: installer/* + + create_release: + name: 'Create GitHub Release' + runs-on: ubuntu-latest + needs: [ sanity_check, build_windows_installer, build_sourcedoc, build_unix_package ] + if: ${{ always() }} + permissions: + contents: write + steps: + + - name: 'Recap Sanity Check Result' + shell: bash + run: | + ${{ needs.sanity_check.result == 'success' }} + + - name: 'Check out Repository' + uses: actions/checkout@v2 + + - name: 'Retrieve Installer Artifacts for Release' + if: ${{ needs.build_windows_installer.status == 'success' }} + uses: actions/download-artifact@v2 + with: + name: artifact_installer + path: installer + + - name: 'Retrieve Source Documentation Artifacts for Release' + if: ${{ needs.build_sourcedoc.status == 'success' }} + uses: actions/download-artifact@v2 + with: + name: artifact_sourcedoc + path: sourcedoc + + - name: 'Retrieve Unix Source Package Artifacts for Release' + if: ${{ needs.build_unix_package.status == 'success' }} + uses: actions/download-artifact@v2 + with: + name: artifact_unix_package + path: unix_package + + - name: 'Extract Source Version Information' + uses: POV-Ray/povray/.github/actions/get_source_version@gh-actions-v1 + + - name: 'Generate Version Derived Information' + shell: bash + run: | + echo "tag_name=v${POV_RAY_FULL_VERSION}" >> ${GITHUB_ENV} + echo "prerelease=${POV_RAY_PRERELEASE}" >> ${GITHUB_ENV} + + - name: 'Prepare Release Message' + id: prepare_release_message + env: + release_message_x: | + **EXPERIMENTAL: This version of POV-Ray is not part of the official development branch!** + release_message_binary: | + **Note:** This is a binary-only release; to install, copy the binary into an existing + POV-Ray ${{ env.POV_RAY_HOST_VERSION }} installation. (Make sure to backup the original + binary first.) + release_message_no_xp: | + These binaries require Windows Vista or higher, due to limitations of our automated + build system. Please contact us on http://news.povray.org/povray.beta-test if you need + Windows XP-compatible binaries of this particular version. + shell: bash + run: | + cp /dev/null ~RELEASE_MESSAGE.txt + case "${prerelease}" in + x*) echo "${release_message_x}" >> ~RELEASE_MESSAGE.txt + echo >> ~RELEASE_MESSAGE.txt + release_type="Experimental Release" + is_prerelease="true" + ;; + alpha*) release_type="Development Release" + is_prerelease="true" + ;; + beta*) release_type="Beta Release" + is_prerelease="true" + ;; + rc*) release_type="Release Candidate" + is_prerelease="true" + ;; + "") release_type="Release" + is_prerelease="false" + ;; + *) echo "Unable to determine type of release." + exit 1 + esac + echo "${release_message_no_xp}" >> ~RELEASE_MESSAGE.txt + cp /dev/null ~RELEASE_ASSETS.txt + find "installer" -type f >> ~RELEASE_ASSETS.txt || true + find "sourcedoc" -type f >> ~RELEASE_ASSETS.txt || true + find "unix_package" -type f >> ~RELEASE_ASSETS.txt || true + echo "::set-output name=release-type::${release_type}" + echo "::set-output name=is-prerelease::${is_prerelease}" + echo "::set-output name=release-title::POV-Ray ${release_type} v${POV_RAY_FULL_VERSION}" + echo "::set-output name=release-assets::"`cat ~RELEASE_ASSETS.txt` + + - name: 'Create Release' + uses: POV-Ray/povray/.github/actions/github_create_release@gh-actions-v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + is-draft: true + is-prerelease: ${{ steps.prepare_release_message.outputs.is-prerelease }} + tag-name: "v${{ env.POV_RAY_FULL_VERSION }}" + title: "${{ steps.prepare_release_message.outputs.release-title }}" + notes-file: ~RELEASE_MESSAGE.txt + assets: ${{ steps.prepare_release_message.outputs.release-assets }} diff --git a/.github/workflows/test_build_quick.yml b/.github/workflows/test_build_quick.yml index c8abb4e3d..aa9f4584a 100644 --- a/.github/workflows/test_build_quick.yml +++ b/.github/workflows/test_build_quick.yml @@ -3,17 +3,11 @@ name: 'Quick Tests' on: workflow_dispatch: push: - branches: - - 'master' - - 'experimental/*' - - 'feature/*' - - 'release/*' + # For now, there's nothing in the following directories that we're actually checking. + paths-ignore: [ 'distribution/**', 'doc/**', 'source-doc/**' ] pull_request: - branches: - - 'master' - - 'experimental/*' - - 'feature/*' - - 'release/*' + # For now, there's nothing in the following directories that we're actually checking. + paths-ignore: [ 'distribution/**', 'doc/**', 'source-doc/**' ] jobs: build_unix: @@ -25,49 +19,49 @@ jobs: uses: actions/checkout@v2 - name: 'Install Prerequisites' - uses: POV-Ray/povray/.github/actions/unix_getlibs_apt@master + uses: POV-Ray/povray/.github/actions/unix_getlibs@gh-actions-v1 - name: 'Prebuild' - uses: POV-Ray/povray/.github/actions/unix_prebuild@master + uses: POV-Ray/povray/.github/actions/unix_prebuild@gh-actions-v1 - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - name: 'Configure' - uses: POV-Ray/povray/.github/actions/unix_configure@master + uses: POV-Ray/povray/.github/actions/unix_configure@gh-actions-v1 - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - name: 'Bundle Artifacts for Diagnostics' if: ${{ always() }} - uses: POV-Ray/povray/.github/actions/unix_bundle_ignored@master + uses: POV-Ray/povray/.github/actions/git_bundle_ignored@gh-actions-v1 with: - name: artifact_diag_unix.tar + name: artifact_diag_unix.tar.gz - name: 'Build' - uses: POV-Ray/povray/.github/actions/unix_make@master + uses: POV-Ray/povray/.github/actions/unix_make@gh-actions-v1 - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - name: 'Check Functionality' - uses: POV-Ray/povray/.github/actions/unix_make@master + uses: POV-Ray/povray/.github/actions/unix_make@gh-actions-v1 with: make-target: check - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 # - name: 'Install' -# uses: POV-Ray/povray/.github/actions/unix_make@master +# uses: POV-Ray/povray/.github/actions/unix_make@gh-actions-v1 # with: # make-target: install # - name: 'Sanity-Check Working Tree' -# uses: POV-Ray/povray/.github/actions/unix_check_repo@master +# uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - - name: 'Upload Artifacs for Diagnostics' + - name: 'Upload Artifacts for Diagnostics' if: ${{ failure() }} uses: actions/upload-artifact@v2 with: name: artifact_diag_unix - path: artifact_diag_unix.tar + path: artifact_diag_unix.tar.gz # TODO: Maybe do some basic installation checking. @@ -83,7 +77,7 @@ jobs: uses: microsoft/setup-msbuild@v1.0.2 - name: 'Build' - uses: POV-Ray/povray/.github/actions/windows_build@master + uses: POV-Ray/povray/.github/actions/windows_build@gh-actions-v1 with: pov-ray-build-id: gh${{github.run_number}} solution: vs2015 @@ -92,4 +86,4 @@ jobs: toolset: v142 msbuild-options: '' - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 diff --git a/.github/workflows/test_build_unix.yml b/.github/workflows/test_build_unix.yml index 3aefae176..5b10d5fe7 100644 --- a/.github/workflows/test_build_unix.yml +++ b/.github/workflows/test_build_unix.yml @@ -19,13 +19,10 @@ jobs: include: # os-specific - os: ubuntu-18.04 - package-manager: apt configure-options: '' - os: ubuntu-20.04 - package-manager: apt configure-options: '' - os: macos-10.15 - package-manager: brew configure-options: '--without-openexr' # TODO: Fix for OpenEXR 3.0.0 and later # compiler-specific - c-compiler: gcc @@ -36,70 +33,61 @@ jobs: steps: - name: 'Matrix Diagnostics' + shell: bash run: | - echo "os: '${{matrix.os}}'" - echo "c-compiler: '${{matrix.c-compiler}}'" - echo --- - echo "package-manager: '${{matrix.package-manager}}'" - echo "cxx-compiler: '${{matrix.cxx-compiler}}'" - echo "configure-options: '${{matrix.configure-options}}'" - echo --- + echo '${{ toJSON(matrix) }}' ${{matrix.c-compiler}} --version - name: 'Check out Repository' uses: actions/checkout@v2 - - name: 'Install Prerequisites (apt)' - if: ${{ matrix.package-manager == 'apt' }} - uses: POV-Ray/povray/.github/actions/unix_getlibs_apt@master - - name: 'Install Prerequisites (brew)' - if: ${{ matrix.package-manager == 'brew' }} - uses: POV-Ray/povray/.github/actions/unix_getlibs_brew@master + - name: 'Install Prerequisites' + uses: POV-Ray/povray/.github/actions/unix_getlibs@gh-actions-v1 - name: 'Prebuild' - uses: POV-Ray/povray/.github/actions/unix_prebuild@master + uses: POV-Ray/povray/.github/actions/unix_prebuild@gh-actions-v1 - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - name: 'Configure' - uses: POV-Ray/povray/.github/actions/unix_configure@master + uses: POV-Ray/povray/.github/actions/unix_configure@gh-actions-v1 with: c-compiler: ${{ matrix.c-compiler }} cxx-compiler: ${{ matrix.cxx-compiler }} configure-options: ${{ matrix.configure-options }} - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - name: 'Bundle Artifacts for Diagnostics' if: ${{ always() }} - uses: POV-Ray/povray/.github/actions/unix_bundle_ignored@master + uses: POV-Ray/povray/.github/actions/git_bundle_ignored@gh-actions-v1 with: - name: artifact_diag_${{ matrix.os }}_${{ matrix.c-compiler }}.tar + name: artifact_diag_${{ matrix.os }}_${{ matrix.c-compiler }}.tar.gz - name: 'Build' - uses: POV-Ray/povray/.github/actions/unix_make@master + uses: POV-Ray/povray/.github/actions/unix_make@gh-actions-v1 - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - name: 'Check Functionality' - uses: POV-Ray/povray/.github/actions/unix_make@master + uses: POV-Ray/povray/.github/actions/unix_make@gh-actions-v1 with: make-target: check - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 # - name: 'Install' -# uses: POV-Ray/povray/.github/actions/unix_make@master +# uses: POV-Ray/povray/.github/actions/unix_make@gh-actions-v1 # with: # make-target: install # - name: 'Sanity-Check Working Tree' -# uses: POV-Ray/povray/.github/actions/unix_check_repo@master +# uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 - - name: 'Upload Artifacs for Diagnostics' + - name: 'Upload Artifacts for Diagnostics' if: ${{ failure() }} uses: actions/upload-artifact@v2 with: name: artifact_diag_${{ matrix.os }}_${{ matrix.c-compiler }} - path: artifact_diag_${{ matrix.os }}_${{ matrix.c-compiler }}.tar + path: artifact_diag_${{ matrix.os }}_${{ matrix.c-compiler }}.tar.gz # TODO: Maybe do some basic installation checking. diff --git a/.github/workflows/test_build_windows.yml b/.github/workflows/test_build_windows.yml index 472757830..81823a8c3 100644 --- a/.github/workflows/test_build_windows.yml +++ b/.github/workflows/test_build_windows.yml @@ -16,9 +16,9 @@ jobs: compatibility: ['', xp] exclude: - visual-studio: 2019 - compatibility: 'xp' + compatibility: xp include: - # Set up various other options based on Visual Studio version to emulate + # Set up various options based on Visual Studio version to emulate - visual-studio: 2015 os: windows-2016 toolset: v140 @@ -31,7 +31,7 @@ jobs: os: windows-2019 toolset: v142 solution: vs2015 - # pick configuration / paltform combo + # Pick configuration / paltform combo - variant: 64 configuration: Release platform: x64 @@ -41,28 +41,20 @@ jobs: - variant: 32 configuration: Release platform: Win32 - # Set up various other options based on compatibility requirements + # Set up various options based on compatibility requirements - compatibility: '' toolset-variant: '' msbuild-options: '' - - compatibility: 'xp' + - compatibility: xp toolset-variant: '_xp' msbuild-options: '/p:TargetUniversalCRTVersion=10.0.10586.0' steps: - name: 'Matrix Diagnostics' + shell: bash run: | - echo "visual-studio: '${{matrix.visual-studio}}'" - echo "variant: '${{matrix.variant}}'" - echo "compatibility: '${{matrix.compatibility}}'" - echo "---" - echo "os: '${{matrix.os}}'" - echo "solution: '${{matrix.solution}}'" - echo "configuration: '${{matrix.configuration}}'" - echo "platform: '${{matrix.platform}}'" - echo "toolset: '${{matrix.toolset}}${{matrix.toolset-variant}}'" - echo "msbuild-options: '${{matrix.msbuild-options}}'" + echo '${{ toJSON(matrix) }}' - name: 'Check out Repository' uses: actions/checkout@v2 @@ -71,13 +63,18 @@ jobs: uses: microsoft/setup-msbuild@v1.0.2 - name: 'Build' - uses: POV-Ray/povray/.github/actions/windows_build@master + uses: POV-Ray/povray/.github/actions/windows_build@gh-actions-v1 with: - pov-ray-build-id: ghvs${{matrix.visual-studio}}${{matrix.compatibility}}${{github.run_number}} + pov-ray-build-id: ghvs${{matrix.visual-studio}}${{github.run_number}}${{matrix.compatibility}} solution: ${{matrix.solution}} configuration: ${{matrix.configuration}} platform: ${{matrix.platform}} toolset: ${{matrix.toolset}}${{matrix.toolset-variant}} msbuild-options: ${{matrix.msbuild-options}} - name: 'Sanity-Check Working Tree' - uses: POV-Ray/povray/.github/actions/unix_check_repo@master + uses: POV-Ray/povray/.github/actions/git_check_repo@gh-actions-v1 + - name: 'Upload Artifacts for Manual Testing' + uses: actions/upload-artifact@v2 + with: + name: artifact_bin_${{matrix.visual-studio}}_${{matrix.variant}}${{matrix.compatibility}} + path: windows/${{matrix.solution}}/bin*/*.exe diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a174e1ff4..000000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -env: - global: - # Required for clang. - - CXXFLAGS="-fno-fast-math" - -branches: - except: - # We're not using tags to trigger deployment, so there's no need to re-build tagged commits. - # All our tags start with a version number, including a leading `v`. - - /^v[0-9]/ - # Branches starting with "housekeeping" are intended for small changes that do not affect - # the software per se (e.g. fixing typos in documentation or comments); no activity desired. - - /^housekeeping/ - # Branches ending with "-stable" are used only to point to other branches, - # which should already have been test-built at this point; no activity needed. - - /-stable$/ - -language: cpp - -matrix: - include: - - os: linux - compiler: gcc - - os: osx - compiler: clang - -sudo: false -dist: trusty - -addons: - apt: - packages: - - libboost-dev - - libboost-date-time-dev - - libjpeg8-dev - - libopenexr-dev - - libpng12-dev - - libtiff4-dev - - zlib1g-dev - -install: -- unix/prebuild.sh -- ./configure COMPILED_BY="Travis CI" --prefix="$(pwd)/build" -- make check -- make install - -script: -- true - -notifications: - email: - recipients: - - ${NOTIFICATION_EMAIL} - on_success: change - on_failure: always diff --git a/README.md b/README.md index db65b603e..0b71aced7 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ [POV-Ray](http://www.povray.org/) - The Persistence of Vision Raytracer ======================================================================= -[![Quick Tests](https://github.com/POV-Ray/povray/actions/workflows/test_build_quick.yml/badge.svg)](https://github.com/POV-Ray/povray/actions/workflows/test_build_quick.yml "Arbitrary Ubuntu gcc / Visual Studio") -[![AppVeyor Build status](https://img.shields.io/appveyor/ci/c-lipka/povray-exwy4.svg?label=appveyor)](https://ci.appveyor.com/project/c-lipka/povray-exwy4 "AppVeyor: Windows Server 2012 R2 with Visual Studio 2015") -[![Travis CI Build Status](https://img.shields.io/travis/POV-Ray/povray.svg?label=travis%20ci)](https://travis-ci.com/POV-Ray/povray "Travis CI: Ubuntu 14.04 LTE 64-bit with gcc 4.8.4; OS X 10.13 with clang ?.?") -[![Coverity Code Analysis](https://scan.coverity.com/projects/269/badge.svg)](https://scan.coverity.com/projects/pov-ray "Coverity: Static Code Analysis") -[![Maintenance Status](https://img.shields.io/maintenance/yes/2021.svg)](README.md "Last edited 2021-06-10") +[![Quick Tests](https://github.com/POV-Ray/povray/actions/workflows/test_build_quick.yml/badge.svg)](https://github.com/POV-Ray/povray/actions/workflows/test_build_quick.yml) +[![Code Analysis](https://github.com/POV-Ray/povray/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/POV-Ray/povray/actions/workflows/codeql-analysis.yml) +[![Maintenance Status](https://img.shields.io/maintenance/yes/2021.svg)](README.md "Last edited 2021-06-26") - [License](#license) - [Forums](#forums) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index aa71ae4a7..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,113 +0,0 @@ -version: 3.8+av{build} -pull_requests: - do_not_increment_build_number: true -branches: - except: - # Special branch "coverity_scan" is used only to trigger Coverity Scan; - # no AppVeyor activity needed. - - coverity_scan - # Branches starting with "housekeeping" are intended for small changes that do not affect - # the software per se (e.g. fixing typos in documentation or comments); no activity desired. - - /^housekeeping/ - # Branches ending with "-stable" are used only to point to other branches, - # which should already have been test-built at this point; no activity needed. - - /-stable$/ - -# We're not using tags to trigger deployment, so there's no need to re-build tagged commits. -skip_tags: true - -image: Visual Studio 2015 - -shallow_clone: true - -matrix: - fast_finish: true - -environment: - PovBuildDefs: POV_RAY_IS_AUTOBUILD=1;POV_RAY_BUILD_ID="av$(APPVEYOR_BUILD_NUMBER)";BUILT_BY="AppVeyor"; - matrix: - - configuration: Release - platform: x64 - bin_dir: bin64 - artifact_suffix: -Win64 - -before_build: - -build: - project: windows/vs2015/povray.sln - parallel: true - verbosity: minimal - -test: off - -# Override individual settings depending on branch name -for: - -# -------------------------------------------------------------------------------------------------- -# Setting overrides for branches starting with "autobuild" -- - branches: - only: - - /autobuild.*/ - - environment: - PovBuildDefs: - secure: dQ/GBBYlkqKDmBEgJfgajfBn58ziSh1JPXsiWtnBL1dE3/s4QZJutGdDtLxiG3eNq0DXMVhDIbGqyPSma9Q9xazlpRZkuU7Gl8rXCw7c03A/oliLoR6q/0Jb+Q9LNH5R/oYiDCHhNP8Cx6OXys4d5A== - matrix: - - configuration: Release-SSE2 - platform: Win32 - bin_dir: bin32 - artifact_suffix: -Win32-sse2 - - configuration: Release - platform: Win32 - bin_dir: bin32 - artifact_suffix: -Win32 - - after_build: - - ps: | - Set-ExecutionPolicy remotesigned -scope process -force - ./tools/windows/get-source-version.ps1 ./source/base/version.h - $prerelease = $env:POV_RAY_PRERELEASE - $env:pov_exe_version = $env:POV_RAY_FULL_VERSION - $env:pov_tag_version = 'v' + $env:pov_exe_version - $env:pov_build_version = $env:pov_tag_version + '+av' + $env:APPVEYOR_BUILD_NUMBER - $env:pov_build_message = '' - if ($prerelease -match '^x') { - $env:pov_build_type = 'Experimental' - $env:pov_build_message += '**EXPERIMENTAL: This version of POV-Ray is not part of the official development branch!**' - $env:pov_build_message += "`n`n" - } elseif ($prerelease) { - $env:pov_build_type = 'Development' - } else { - $env:pov_build_type = 'Automated' - } - $env:pov_release_type = ($env:pov_build_type).ToLower() + ' release' - $env:pov_build_title = $env:pov_build_type + ' build' - $env:pov_build_message += '**Note:** This is a binary-only ' + $env:pov_release_type + '; to install, copy the ' - $env:pov_build_message += 'binary into an existing POV-Ray v3.7 installation. (Make sure to backup the original ' - $env:pov_build_message += 'binary first.)' - $env:pov_build_message += "`n`n" - $env:pov_build_message += 'These binaries require Windows Vista or higher, due to limitations of our automated ' - $env:pov_build_message += 'build system. Please contact us on http://news.povray.org/povray.beta-test if you need ' - $env:pov_build_message += 'Windows XP-compatible binaries of this particular version.' - $env:pov_zipdir = "povray-" + $env:pov_exe_version + '-av' + $env:APPVEYOR_BUILD_NUMBER + $env:artifact_suffix - $env:pov_binary = "Windows\vs2015\" + $env:bin_dir + "\pvengine*.exe" - $env:pov_zip = "artifacts\" + $env:pov_zipdir + ".7z" - New-Item -ItemType directory -Path $env:pov_zipdir | Out-Null - New-Item -ItemType directory -Path "artifacts" | Out-Null - Copy-Item $env:pov_binary $env:pov_zipdir - & "7z" "a" "-r" $env:pov_zip $env:pov_zipdir - - artifacts: - - path: artifacts/*.7z - name: binaryOnly7z - - deploy: - - provider: GitHub - tag: $(pov_tag_version) - release: $(pov_build_title) $(pov_build_version) - description: $(pov_build_message) - auth_token: - secure: Il7kbUpGx5Fx4ioI7cmEpEciqsq27HYiT/i4RYivOjfetfCLfMNQhIXEFGzvovoo - draft: true - prerelease: true diff --git a/tools/unix/get-source-version.sh b/tools/unix/get-source-version.sh index 66385ec1d..c22f0f410 100755 --- a/tools/unix/get-source-version.sh +++ b/tools/unix/get-source-version.sh @@ -6,14 +6,22 @@ # # eval `./tools/unix/get-source-version.sh ./source/base/version.h` # -# This procedure will cause the following envionment variables to be set: +# From GitHub Workflow scripts, run as a dedicated step as follows: +# +# - shell: bash +# run: ./tools/unix/get-source-version.sh ./source/base/version.h -github_env $GITHUB_ENV +# +# All procedures will cause the following envionment variables to be set: # # POV_RAY_COPYRIGHT Copyright string # POV_RAY_GENERATION First two fields of the version string (`X.Y`) # POV_RAY_FULL_VERSION Full version string (`X.Y.Z`[`.P`][`-PRE`]) # POV_RAY_PRERELEASE Pre-release tag portion of the version string (`PRE`), or empty if not applicable +# POV_RAY_HOST_VERSION First two fields of the "host" version string (`V.W`), or empty if not applicable version_h="$1" +format="$2" +outfile="$3" GetMacro() { file="$1" @@ -39,6 +47,7 @@ revision=`GetNumericMacro "$version_h" POV_RAY_REVISION_INT` patchlevel=`GetNumericMacro "$version_h" POV_RAY_PATCHLEVEL_INT` prerelease=`GetStringMacro "$version_h" POV_RAY_PRERELEASE` +hostversion=`GetStringMacro "$version_h" POV_RAY_HOST_VERSION` generation="$major.$minor" if test "$patchlevel" -eq 0 ; then @@ -52,10 +61,24 @@ else version="$release" fi -cat << hereEOF -POV_RAY_COPYRIGHT="$copyright" ; -POV_RAY_GENERATION="$generation" ; -POV_RAY_FULL_VERSION="$version" ; -POV_RAY_PRERELEASE="$prerelease" ; -hereEOF +case "$format" in + + '') + SetVariable() { + echo "$1='$2' ;" + } + ;; + + -github_env) + SetVariable() { + echo "$1=$2" >> "$outfile" + } + ;; + +esac +SetVariable POV_RAY_COPYRIGHT "$copyright" +SetVariable POV_RAY_GENERATION "$generation" +SetVariable POV_RAY_FULL_VERSION "$version" +SetVariable POV_RAY_PRERELEASE "$prerelease" +SetVariable POV_RAY_HOST_VERSION "$hostversion" diff --git a/tools/windows/get-exe-version.ps1 b/tools/windows/get-exe-version.ps1 new file mode 100755 index 000000000..15b76e59b --- /dev/null +++ b/tools/windows/get-exe-version.ps1 @@ -0,0 +1,76 @@ +# Extract formal version information from Windows executable +# +# From PowerShell scripts, run as follows: +# +# Set-ExecutionPolicy remotesigned -scope process -force +# ./tools/windows/get-exe-version.ps1 ./windows/vs2015/bin64/pvengine64.exe +# +# From batch files, run as follows: +# +# powershell -executionpolicy remotesigned -File ./tools/windows/get-exe-version.ps1 ./windows/vs2015/bin64/pvengine64.exe -bat version~.bat +# call version~.bat +# del version~.bat +# +# From GitHub Workflow scripts, run as a dedicated step as follows: +# +# - shell: pwsh +# run: ./tools/windows/get-exe-version.ps1 ./windows/vs2015/bin64/pvengine64.exe -github_env $env:GITHUB_ENV +# +# All procedures will cause the following envionment variables to be set +# according to the formal version info embedded in the executable: +# +# BINARY_COMPANYNAME CompanyName +# BINARY_FILEDESCRIPTION FileDescription +# BINARY_FILEVERSION FileVersion +# BINARY_INTERNALNAME InternalName +# BINARY_LEGALCOPYRIGHT LegalCopyright +# BINARY_LEGALTRADEMARKS LegalTrademarks +# BINARY_ORIGINALFILENAME OriginalFilename +# BINARY_PRODUCTNAME ProductName +# BINARY_PRODUCTVERSION ProductVersion +# BINARY_PRODUCTMAJORPART ProductMajorPart +# BINARY_PRODUCTMINORPART ProductMinorPart +# BINARY_PRODUCTBUILDPART ProductBuildPart +# BINARY_PRODUCTPRIVATEPART ProductPrivatePart +# +# [*In the batch version of the procedure, empty environment variables will be left undefined.] + +param ([string]$binary, [string]$bat, [string]$github_env) + +$version_info = (get-item $binary).VersionInfo + +if ($bat) { + + function SetVariable ([string]$name, [string]$value) { + ('set ' + $name + '=' + $value) | Out-File -FilePath $bat -Encoding ASCII -Append + } + +} elseif ($github_env) { + + function SetVariable ([string]$name, [string]$value) { + ($name + '=' + $value) | Out-File -FilePath $github_env -Encoding UTF8 -Append + } + +} else { + + function SetVariable ([string]$name, [string]$value) { + $expr = '$env:' + $name + ' = "' + $value + '"' + Invoke-Expression $expr + } + +} + +SetVariable 'BINARY_COMPANYNAME' $version_info.CompanyName +SetVariable 'BINARY_FILEDESCRIPTION' $version_info.FileDescription +SetVariable 'BINARY_FILEVERSION' $version_info.FileVersion +SetVariable 'BINARY_INTERNALNAME' $version_info.InternalName +SetVariable 'BINARY_LEGALCOPYRIGHT' $version_info.LegalCopyright +SetVariable 'BINARY_LEGALTRADEMARKS' $version_info.LegalTrademarks +SetVariable 'BINARY_ORIGINALFILENAME' $version_info.OriginalFilename +SetVariable 'BINARY_PRODUCTNAME' $version_info.ProductName +SetVariable 'BINARY_PRODUCTVERSION' $version_info.ProductVersion + +SetVariable 'BINARY_PRODUCTMAJORPART' $version_info.ProductMajorPart +SetVariable 'BINARY_PRODUCTMINORPART' $version_info.ProductMinorPart +SetVariable 'BINARY_PRODUCTBUILDPART' $version_info.ProductBuildPart +SetVariable 'BINARY_PRODUCTPRIVATEPART' $version_info.ProductPrivatePart diff --git a/tools/windows/get-source-version.bat b/tools/windows/get-source-version.bat old mode 100644 new mode 100755 index 04391c170..d13dcb414 --- a/tools/windows/get-source-version.bat +++ b/tools/windows/get-source-version.bat @@ -12,6 +12,7 @@ REM * POV_RAY_COPYRIGHT Copyright string REM * POV_RAY_GENERATION First two fields of the version string (`X.Y`) REM * POV_RAY_FULL_VERSION Full version string (`X.Y.Z`[`.P`][`-PRE`]) REM * POV_RAY_PRERELEASE Pre-release tag portion of the version string (`PRE`), or undefined if not applicable +REM * POV_RAY_HOST_VERSION First two fields of the "host" version string (`V.W`), or undefined if not applicable REM * REM * For backward compatibility with earlier versions of the script, the following (deprecated) REM * environment variables will also be set: diff --git a/tools/windows/get-source-version.ps1 b/tools/windows/get-source-version.ps1 old mode 100644 new mode 100755 index 8e8dfaded..89afdff0b --- a/tools/windows/get-source-version.ps1 +++ b/tools/windows/get-source-version.ps1 @@ -11,12 +11,18 @@ # call version~.bat # del version~.bat # -# Both procedures will cause the following envionment variables to be set: +# From GitHub Workflow scripts, run as a dedicated step as follows: +# +# - shell: pwsh +# run: ./tools/windows/get-source-version.ps1 ./source/base/version.h -github_env $env:GITHUB_ENV +# +# All procedures will cause the following envionment variables to be set: # # POV_RAY_COPYRIGHT Copyright string # POV_RAY_GENERATION First two fields of the version string (`X.Y`) # POV_RAY_FULL_VERSION Full version string (`X.Y.Z`[`.P`][`-PRE`]) # POV_RAY_PRERELEASE Pre-release tag portion of the version string (`PRE`), or empty if not applicable [*] +# POV_RAY_HOST_VERSION First two fields of the "host" version string (`V.W`), or empty if not applicable [*] # # For backward compatibility with earlier versions of the script, the following (deprecated) # environment variables will also be set: @@ -28,7 +34,7 @@ # # [*In the batch version of the procedure, empty environment variables will be left undefined.] -param ([string]$version_h, [string]$bat) +param ([string]$version_h, [string]$bat, [string]$github_env) function GetMacro ([string]$file, [string]$macro, [string]$pattern1, [string]$pattern2, [string]$pattern3) { $regexp = '^\s*#define\s+' + $macro + $pattern1 + '\s*$' @@ -46,20 +52,21 @@ function GetStringMacro ([string]$file, [string]$macro) { GetMacro $file $macro '\s*"[^"]+"' '"[^"]+"' '[^"]+' } -$copyright = GetStringMacro $version_h 'POV_RAY_COPYRIGHT' +$copyright = GetStringMacro $version_h 'POV_RAY_COPYRIGHT' -$major = GetNumericMacro $version_h 'POV_RAY_MAJOR_VERSION_INT' -$minor = GetNumericMacro $version_h 'POV_RAY_MINOR_VERSION_INT' -$revision = GetNumericMacro $version_h 'POV_RAY_REVISION_INT' -$patchlevel = GetNumericMacro $version_h 'POV_RAY_PATCHLEVEL_INT' +$major = GetNumericMacro $version_h 'POV_RAY_MAJOR_VERSION_INT' +$minor = GetNumericMacro $version_h 'POV_RAY_MINOR_VERSION_INT' +$revision = GetNumericMacro $version_h 'POV_RAY_REVISION_INT' +$patchlevel = GetNumericMacro $version_h 'POV_RAY_PATCHLEVEL_INT' -$prerelease = GetStringMacro $version_h 'POV_RAY_PRERELEASE' +$prerelease = GetStringMacro $version_h 'POV_RAY_PRERELEASE' +$hostversion = GetStringMacro $version_h 'POV_RAY_HOST_VERSION' -$generation = $major + "." + $minor +$generation = $major + '.' + $minor if ([int]$patchlevel -eq 0) { - $release = $generation + "." + $revision + $release = $generation + '.' + $revision } else { - $release = $generation + "." + $revision + "." + $patchlevel + $release = $generation + '.' + $revision + '.' + $patchlevel } if ($prerelease) { $version = $release + '-' + $prerelease @@ -69,31 +76,32 @@ if ($prerelease) { if ($bat) { - $text = "" - - $text += "set POV_RAY_COPYRIGHT=" + $copyright + "`n" - $text += "set POV_RAY_GENERATION=" + $generation + "`n" - $text += "set POV_RAY_FULL_VERSION=" + $version + "`n" - $text += "set POV_RAY_PRERELEASE=" + $prerelease + "`n" + function SetVariable ([string]$name, [string]$value) { + ('set ' + $name + '=' + $value) | Out-File -FilePath $bat -Encoding ASCII -Append + } - $text += "set POV_SOURCE_COPYRIGHT=" + $copyright + "`n" - $text += "set POV_SOURCE_GENERATION=" + $generation + "`n" - $text += "set POV_SOURCE_VERSION=" + $version + "`n" - $text += "set POV_SOURCE_PRERELEASE=" + $prerelease + "`n" +} elseif ($github_env) { - Out-File -LiteralPath $bat -Encoding ASCII -InputObject $text -NoNewline + function SetVariable ([string]$name, [string]$value) { + ($name + '=' + $value) | Out-File -FilePath $github_env -Encoding UTF8 -Append + } } else { - $env:POV_RAY_COPYRIGHT = $copyright - $env:POV_RAY_GENERATION = $generation - $env:POV_RAY_FULL_VERSION = $version - $env:POV_RAY_PRERELEASE = $prerelease - - $env:POV_SOURCE_COPYRIGHT = $copyright - $env:POV_SOURCE_GENERATION = $generation - $env:POV_SOURCE_VERSION = $version - $env:POV_SOURCE_PRERELEASE = $prerelease + function SetVariable ([string]$name, [string]$value) { + $expr = '$env:' + $name + ' = "' + $value + '"' + Invoke-Expression $expr + } } +SetVariable 'POV_RAY_COPYRIGHT' $copyright +SetVariable 'POV_RAY_GENERATION' $generation +SetVariable 'POV_RAY_FULL_VERSION' $version +SetVariable 'POV_RAY_PRERELEASE' $prerelease +SetVariable 'POV_RAY_HOST_VERSION' $hostversion + +SetVariable 'POV_SOURCE_COPYRIGHT' $copyright +SetVariable 'POV_SOURCE_GENERATION' $generation +SetVariable 'POV_SOURCE_VERSION' $version +SetVariable 'POV_SOURCE_PRERELEASE' $prerelease