Skip to content

Commit

Permalink
ci: Add a new top-level directory, dedicated for CI verification
Browse files Browse the repository at this point in the history
Update the ci_*.sh scripts and move them to the more conventional
ci/ directory. Update .appveyor.yml and .travis.yml, as well as
the AUTHORS file, accordingly.

Speed up ci_cmake.sh: add "-DPNG_TESTS=OFF" to the list of CMake
variables if CI_NO_TEST is true.

Remove "sudo: false" from .travis.yml.

Refactor .appveyor.yml.
  • Loading branch information
ctruta committed May 19, 2020
1 parent 28c0f88 commit 3676fd3
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 61 deletions.
45 changes: 22 additions & 23 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,58 +13,57 @@ environment:
matrix:
- TOOLCHAIN: vstudio
AUTOMATION: cmake
CI_CMAKE_GENERATOR: Visual Studio 16 2019
CI_CMAKE_GENERATOR_PLATFORM: Win32
ARCH: x86
- TOOLCHAIN: vstudio
AUTOMATION: cmake
CI_CMAKE_GENERATOR: Visual Studio 16 2019
CI_CMAKE_GENERATOR_PLATFORM: X64
ARCH: x64
- TOOLCHAIN: vstudio
AUTOMATION: cmake
CI_CMAKE_GENERATOR: Visual Studio 16 2019
CI_CMAKE_GENERATOR_PLATFORM: ARM64
ARCH: arm64
CI_NO_TEST: 1
- TOOLCHAIN: msys2
AUTOMATION: cmake
CI_CMAKE_GENERATOR: Unix Makefiles
CI_CC: i686-w64-mingw32-gcc
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: cmake
CI_CMAKE_GENERATOR: Unix Makefiles
CI_CC: x86_64-w64-mingw32-gcc
ARCH: x86_64
- TOOLCHAIN: msys2
AUTOMATION: autotools
CI_CC: i686-w64-mingw32-gcc
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: autotools
CI_CC: x86_64-w64-mingw32-gcc
ARCH: x86_64
- TOOLCHAIN: msys2
AUTOMATION: legacy
CI_CC: i686-w64-mingw32-gcc
ARCH: i686
- TOOLCHAIN: msys2
AUTOMATION: legacy
CI_CC: x86_64-w64-mingw32-gcc
ARCH: x86_64

install:
- 'if "%TOOLCHAIN%"=="vstudio" if "%CI_CMAKE_GENERATOR_PLATFORM%"=="Win32" C:\tools\vcpkg\vcpkg.exe install zlib:x86-windows'
- 'if "%TOOLCHAIN%"=="vstudio" if "%CI_CMAKE_GENERATOR_PLATFORM%"=="X64" C:\tools\vcpkg\vcpkg.exe install zlib:x64-windows'
- 'if "%TOOLCHAIN%"=="vstudio" if "%CI_CMAKE_GENERATOR_PLATFORM%"=="ARM64" C:\tools\vcpkg\vcpkg.exe install zlib:arm64-windows'
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe integrate install'

before_build:
- 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_VARS=-DCMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
- 'if "%TOOLCHAIN%"=="msys2" if "%CI_CC%"=="i686-w64-mingw32-gcc" set PATH=C:\msys64\mingw32\bin;%PATH%'
- 'if "%TOOLCHAIN%"=="msys2" if "%CI_CC%"=="x86_64-w64-mingw32-gcc" set PATH=C:\msys64\mingw64\bin;%PATH%'
- 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_GENERATOR=Visual Studio 16 2019'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x86" set CI_CMAKE_GENERATOR_PLATFORM=Win32'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x64" set CI_CMAKE_GENERATOR_PLATFORM=X64'
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_GENERATOR_PLATFORM=ARM64'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" set CI_CMAKE_GENERATOR=Unix Makefiles'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="i686" set PATH=C:\msys64\mingw32\bin;%PATH%'
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="x86_64" set PATH=C:\msys64\mingw64\bin;%PATH%'
- 'if "%TOOLCHAIN%"=="msys2" set CI_CC=%ARCH%-w64-mingw32-gcc'
- 'set CI_CMAKE_BUILD_FLAGS=--parallel 2'
- 'set CI_CTEST_FLAGS=--parallel 2'
- 'set CI_MAKE_FLAGS=-j2'
- 'set CI_LEGACY_MAKEFILES=scripts/makefile.gcc scripts/makefile.msys scripts/makefile.std'

build_script:
- 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_cmake.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_cmake.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="autotools" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_autotools.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="legacy" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\scripts\ci_legacy.sh"'
- 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_cmake.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="autotools" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_autotools.sh"'
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="legacy" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_legacy.sh"'

cache:
- C:\tools\vcpkg\installed
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,4 @@ before_script:
- 'export CI_LEGACY_MAKEFILES="scripts/makefile.$TRAVIS_COMPILER scripts/makefile.std"'

script:
- './scripts/ci_$AUTOMATION.sh'

sudo: false
- './ci/ci_$AUTOMATION.sh'
4 changes: 2 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ Authors, for copyright and licensing purposes.
- Dan Field

The build projects, the build scripts, the test scripts, and other
files in the "projects", "scripts" and "tests" directories, have other
copyright owners, but are released under the libpng license.
files in the "ci", "projects", "scripts" and "tests" directories, have
other copyright owners, but are released under the libpng license.

Some files in the "contrib" directory, and some tools-generated files
that are distributed with libpng, have other copyright owners, and are
Expand Down
22 changes: 11 additions & 11 deletions scripts/ci_autotools.sh → ci/ci_autotools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ set -e
# Copyright (c) 2019-2020 Cosmin Truta.
#
# This software is released under the libpng license.
# For conditions of distribution and use, see the disclaimer and license
# in png.h.
# For conditions of distribution and use, see the disclaimer
# and license in png.h.

CI_SCRIPTNAME="$(basename "$0")"
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
CI_BUILDDIR="$CI_SRCDIR/out/autotools.build"
readonly CI_SCRIPTNAME="$(basename "$0")"
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
readonly CI_BUILDDIR="$CI_SRCDIR/out/autotools.build"

function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
Expand Down Expand Up @@ -52,11 +52,11 @@ function ci_init_autotools {
}

function ci_build_autotools {
# Initialize the configure environment.
[[ $CI_CC ]] && export CC="$CI_CC"
[[ $CI_CC_FLAGS ]] && export CFLAGS="$CI_CC_FLAGS"
[[ $CI_SANITIZERS ]] && export CFLAGS="-fsanitize=$CI_SANITIZERS -O2 $CFLAGS"
# Build.
# Export the configure build environment.
[[ $CI_CC ]] && ci_spawn export CC="$CI_CC"
[[ $CI_CC_FLAGS ]] && ci_spawn export CFLAGS="$CI_CC_FLAGS"
[[ $CI_SANITIZERS ]] && ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS -O2 $CFLAGS"
# Build!
ci_spawn rm -fr "$CI_BUILDDIR"
ci_spawn mkdir -p "$CI_BUILDDIR"
ci_spawn cd "$CI_BUILDDIR"
Expand Down
30 changes: 16 additions & 14 deletions scripts/ci_cmake.sh → ci/ci_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ set -e
# Copyright (c) 2019-2020 Cosmin Truta.
#
# This software is released under the libpng license.
# For conditions of distribution and use, see the disclaimer and license
# in png.h.
# For conditions of distribution and use, see the disclaimer
# and license in png.h.

CI_SCRIPTNAME="$(basename "$0")"
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
CI_BUILDDIR="$CI_SRCDIR/out/cmake.build"
readonly CI_SCRIPTNAME="$(basename "$0")"
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
readonly CI_BUILDDIR="$CI_SRCDIR/out/cmake.build"

function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
Expand Down Expand Up @@ -53,14 +53,12 @@ function ci_init_cmake {
ci_info "environment option: \$CI_SANITIZERS='$CI_SANITIZERS'"
ci_info "environment option: \$CI_NO_TEST='$CI_NO_TEST'"
ci_info "environment option: \$CI_NO_CLEAN='$CI_NO_CLEAN'"
# Print the CMake/CTest program versions.
ci_spawn "$(command -v "$CI_CMAKE")" --version
ci_spawn "$(command -v "$CI_CTEST")" --version
}

function ci_build_cmake {
# Initialize the CMake environment.
[[ $CI_CMAKE_GENERATOR ]] &&
export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
# Initialize ALL_CC_FLAGS as a string.
local ALL_CC_FLAGS="$CI_CC_FLAGS"
[[ $CI_SANITIZERS ]] && ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_CC_FLAGS"
Expand All @@ -71,10 +69,14 @@ function ci_build_cmake {
[[ $ALL_CC_FLAGS ]] && ALL_CMAKE_VARS+=("-DCMAKE_C_FLAGS=$ALL_CC_FLAGS")
ALL_CMAKE_VARS+=("-DCMAKE_BUILD_TYPE=$CI_CMAKE_BUILD_TYPE")
ALL_CMAKE_VARS+=("-DCMAKE_VERBOSE_MAKEFILE=ON")
[[ $CI_NO_TEST ]] && ALL_CMAKE_VARS+=("-DPNG_TESTS=OFF")
ALL_CMAKE_VARS+=($CI_CMAKE_VARS)
# Build.
ci_spawn "$(command -v "$CI_CMAKE")" --version
ci_spawn "$(command -v "$CI_CTEST")" --version
# Export the CMake build environment.
[[ $CI_CMAKE_GENERATOR ]] &&
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
# Build!
ci_spawn "$CI_CMAKE" -E remove_directory "$CI_BUILDDIR"
ci_spawn "$CI_CMAKE" -E make_directory "$CI_BUILDDIR"
ci_spawn cd "$CI_BUILDDIR"
Expand Down
16 changes: 8 additions & 8 deletions scripts/ci_legacy.sh → ci/ci_legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ set -e
# Copyright (c) 2019-2020 Cosmin Truta.
#
# This software is released under the libpng license.
# For conditions of distribution and use, see the disclaimer and license
# in png.h.
# For conditions of distribution and use, see the disclaimer
# and license in png.h.

CI_SCRIPTNAME="$(basename "$0")"
CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
CI_BUILDDIR="$CI_SRCDIR"
readonly CI_SCRIPTNAME="$(basename "$0")"
readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
readonly CI_BUILDDIR="$CI_SRCDIR"

function ci_info {
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
Expand Down Expand Up @@ -79,12 +79,12 @@ function ci_build_legacy {
[[ $ALL_LD_FLAGS ]] && ALL_MAKE_ARGS+=("LDFLAGS=$ALL_LD_FLAGS")
ALL_MAKE_ARGS+=("LIBS=$CI_LIBS")
ALL_MAKE_ARGS+=($CI_MAKE_VARS)
# Build.
# Build!
ci_spawn cd "$CI_SRCDIR"
[[ $CI_LEGACY_MAKEFILES ]] || ci_err "bad or missing: \$CI_LEGACY_MAKEFILES"
local MY_MAKEFILE
for MY_MAKEFILE in $CI_LEGACY_MAKEFILES
do
ci_info "using makefile: $MY_MAKEFILE"
ci_spawn "$CI_MAKE" "${ALL_MAKE_ARGS[@]}" -f $MY_MAKEFILE
[[ $CI_NO_TEST ]] || ci_spawn "$CI_MAKE" "${ALL_MAKE_ARGS[@]}" -f $MY_MAKEFILE test
[[ $CI_NO_CLEAN ]] || ci_spawn "$CI_MAKE" "${ALL_MAKE_ARGS[@]}" -f $MY_MAKEFILE clean
Expand Down

0 comments on commit 3676fd3

Please sign in to comment.