Skip to content

Commit

Permalink
CI: show ccache stats, use Ninja for MSVC, misc. reformat (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews authored Jun 20, 2024
1 parent fb3c020 commit 18e8471
Showing 1 changed file with 70 additions and 55 deletions.
125 changes: 70 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
arch: 64
packages: g++
cmake: 3.15.*
cmake_extra: '-DBUILD_BENCHMARKS=ON'
cmake_extra: -D BUILD_BENCHMARKS=ON
os: ubuntu-latest

# gcc 6 and lower are not supported
Expand Down Expand Up @@ -218,6 +218,7 @@ jobs:
set -e
uname -a
sudo -E apt-get update
sudo -E apt-get autopurge -y needrestart
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make doxygen python3-pip ccache valgrind ${{ matrix.ci.packages }}
python3 -m pip install --disable-pip-version-check --user cmake==${{ matrix.ci.cmake }}
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
Expand All @@ -239,19 +240,20 @@ jobs:
CXXFLAGS: "-m${{ matrix.ci.arch }}"
run: |
set -e
mkdir build.cmake
cd build.cmake
mkdir build
cd build
cmake --version
cmake ${{ matrix.ci.cmake_extra }} \
-DCMAKE_C_COMPILER=${{ matrix.ci.c_compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.ci.cxx_compiler }} \
-DCMAKE_CXX_STANDARD=${{ matrix.ci.cxxstd }} \
-DUSE_CCACHE=ON \
-DBUILD_DOCUMENTATION=YES \
-DCMAKE_BUILD_TYPE=${{ matrix.ci.build_type }} ..
-D CMAKE_BUILD_TYPE=${{ matrix.ci.build_type }} \
-D CMAKE_C_COMPILER=${{ matrix.ci.c_compiler }} \
-D CMAKE_CXX_COMPILER=${{ matrix.ci.cxx_compiler }} \
-D CMAKE_CXX_STANDARD=${{ matrix.ci.cxxstd }} \
-D BUILD_DOCUMENTATION=YES \
-D USE_CCACHE=ON \
..
make -j $(nproc)
cmake --build . --target docs
ccache -s
ccache --show-stats
- name: Save build cache
uses: actions/cache/save@v4
Expand All @@ -260,19 +262,16 @@ jobs:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

- name: Test
run: |
set -e
cd build.cmake
ctest --output-on-failure .
working-directory: ./build
run: ctest --output-on-failure

# Run the all-unit-tests under
# the memory checker when we have Debug symbols
# available. Change to ^all to also check all-xml-tests
- name: Valgrind
if: matrix.ci.build_type == 'Debug'
working-directory: ./build
run: |
set -e
cd build.cmake
ctest --output-on-failure \
--overwrite MemoryCheckCommandOptions="--leak-check=full --error-exitcode=100" \
-R ^all-unit -C Valgrind -T memcheck
Expand All @@ -282,7 +281,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: valgrind-log
path: build.cmake/Testing/Temporary/MemoryChecker.**.log
path: build/Testing/Temporary/MemoryChecker.**.log
retention-days: 1

- name: Upload Coverage to Codecov
Expand Down Expand Up @@ -310,8 +309,13 @@ jobs:
- name: 'Setup'
uses: msys2/setup-msys2@v2
with:
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake make mingw-w64-x86_64-ccache
msystem: MINGW64
update: true
install: >-
make
mingw-w64-x86_64-ccache
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gcc
- name: Retrieve build cache
id: restore-cache
Expand All @@ -322,16 +326,19 @@ jobs:
restore-keys: windows-mingw-${{ matrix.build_type}}

- name: 'Build'
env:
CCACHE_DIR: ${{ github.workspace }}\.ccache
run: |
export CCACHE_BASE_DIR=$(pwd)
mkdir build
cd build
cmake --version
cmake \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DUSE_CCACHE=ON \
-G"MSYS Makefiles" ..
cmake --build . -j 4
mkdir build
cd build
cmake --version
cmake \
-G "MSYS Makefiles" \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type}} \
-D USE_CCACHE=ON \
..
cmake --build . -j 4
ccache --show-stats --verbose
- name: Save build cache
uses: actions/cache/save@v4
Expand All @@ -340,9 +347,8 @@ jobs:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

- name: 'Test'
run: |
cd build
ctest --output-on-failure .
working-directory: ./build
run: ctest --output-on-failure

windows-msvc:
name: 'Windows (Visual Studio)'
Expand All @@ -353,34 +359,47 @@ jobs:
- build_type: Debug
cxxstd: 14
os: windows-2022
vcdir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise

- build_type: Release
cxxstd: 14
os: windows-2019
vcdir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise

runs-on: ${{ matrix.ci.os }}
steps:
- name: 'Check Out'
uses: actions/checkout@v4

- name: 'Setup'
run: choco install ccache
run: choco install ccache ninja

- name: Retrieve build cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: .ccache
key: windows-msvc-${{ matrix.build_type}}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: windows-msvc-${{ matrix.build_type}}
key: windows-msvc-${{ matrix.ci.os}}-${{ matrix.ci.build_type}}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: windows-msvc-${{ matrix.ci.os}}-${{ matrix.ci.build_type}}

- name: 'Build'
env:
CCACHE_DIR: ${{ github.workspace }}\.ccache
shell: cmd
run: |
mkdir build
cd build
cmake --version
cmake -DCMAKE_BUILD_TYPE=${{ matrix.ci.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.ci.cxxstd }} -DBUILD_SHARED_LIBS=ON -DUSE_CCACHE=ON ..
cmake --build . --config ${{ matrix.ci.build_type }} -j 4
call "${{ matrix.ci.vcdir }}\VC\Auxiliary\Build\vcvars64.bat"
md build
cd build
cmake --version
cmake ^
-G Ninja ^
-D CMAKE_BUILD_TYPE=${{ matrix.ci.build_type }} ^
-D CMAKE_CXX_STANDARD=${{ matrix.ci.cxxstd }} ^
-D BUILD_SHARED_LIBS=ON ^
-D USE_CCACHE=ON ^
..
cmake --build . --config ${{ matrix.ci.build_type }} -j 4
ccache --show-stats --verbose
- name: Save build cache
uses: actions/cache/save@v4
Expand All @@ -389,9 +408,8 @@ jobs:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

- name: 'Test'
run: |
cd build
ctest --output-on-failure -C ${{ matrix.ci.build_type }}
working-directory: build
run: ctest --output-on-failure -C ${{ matrix.ci.build_type }}

macos:
name: 'macOS clang'
Expand All @@ -417,8 +435,7 @@ jobs:
steps:

- name: 'Setup'
run: |
brew install ccache
run: brew install ccache

- name: 'Install'
env:
Expand All @@ -442,19 +459,18 @@ jobs:
restore-keys: ${{ runner.os }}-${{ matrix.xcode }}-${{ matrix.build_type}}-${{ matrix.cxxstd }}

- name: 'Build'
env:
BUILD_TYPE: ${{ matrix.build_type }}
CXX_STANDARD: ${{ matrix.cxxstd }}
run: |
set -e
mkdir build
cd build
cmake --version
cmake \
-DCMAKE_CXX_STANDARD=${CXX_STANDARD} \
-DUSE_CCACHE=ON \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} ..
cmake --build . --config ${BUILD_TYPE} -j 4
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D CMAKE_CXX_STANDARD=${{ matrix.cxxstd }} \
-D USE_CCACHE=ON \
..
cmake --build . --config ${{ matrix.build_type }} -j 4
ccache --show-stats
- name: Save build cache
uses: actions/cache/save@v4
Expand All @@ -463,9 +479,8 @@ jobs:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

- name: 'Test'
run: |
cd build
ctest -V --output-on-failure -C ${BUILD_TYPE}
working-directory: ./build
run: ctest -V --output-on-failure -C ${{ matrix.build_type }}


code-quality:
Expand All @@ -482,8 +497,7 @@ jobs:
uses: actions/checkout@v4

- name: 'cppcheck'
run: |
./tools/cppcheck.sh
run: ./tools/cppcheck.sh


cmake-subproject:
Expand All @@ -495,6 +509,7 @@ jobs:
set -e
uname -a
sudo -E apt-get update
sudo -E apt-get autopurge -y needrestart
sudo -E apt-get -yq --no-install-suggests --no-install-recommends install make python3-pip g++
python3 -m pip install --disable-pip-version-check --user cmake==3.13.*
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
Expand Down

3 comments on commit 18e8471

@pramsey
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing MSVC CI failures on my personal branch of main. This is new:

\geos.dir\src\geom\Location.cpp.obj
cl : Command line warning D9025 : overriding '/W3' with '/W4'

So is this

ninja: build stopped: subcommand failed.
Cache directory:               D:\a\geos\geos\.ccache
Config file:                   D:\a\geos\geos\.ccache\ccache.conf
System config file:            C:\ProgramData\ccache\ccache.conf
Stats updated:                 06/21/24 22:25:18
Cacheable calls:                 0 / 338 ( 0.00%)
  Hits:                          0
    Direct:                      0
    Preprocessed:                0
  Misses:                        0
Uncacheable calls:             338 / 338 (100.0%)
  Unsupported compiler option: 338 / 338 (100.0%)
Successful lookups:
  Direct:                        0
  Preprocessed:                  0
Local storage:
  Cache size (GB):             0.0 / 0.3 ( 0.00%)
  Files:                         0
  Hits:                          0
  Misses:                        0
  Reads:                         0
  Writes:                        0

@mwtoews
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pramsey , I see the issue (it wasn't the warning or ccache report). I forgot that cmd will need to inspect a non-zero %ERRORLEVEL% to exit. I can fix this later today.

@mwtoews
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should now be fixed with d84cf1a

Please sign in to comment.