Skip to content

Commit db70316

Browse files
authored
Merge pull request polyfem#1 from jdumas/jdumas/actions
Continuous integration via GitHub Actions.
2 parents 08f3c36 + 2a9c6dc commit db70316

File tree

7 files changed

+366
-22
lines changed

7 files changed

+366
-22
lines changed

.github/workflows/continuous.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
CTEST_OUTPUT_ON_FAILURE: ON
13+
CTEST_PARALLEL_LEVEL: 2
14+
15+
jobs:
16+
####################
17+
# Linux / macOS
18+
####################
19+
20+
Unix:
21+
name: ${{ matrix.name }} (${{ matrix.config }})
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: [ubuntu-20.04, macos-11]
27+
config: [Debug, Release]
28+
include:
29+
- os: macos-11
30+
name: macOS
31+
- os: ubuntu-20.04
32+
name: Linux
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v1
36+
with:
37+
fetch-depth: 10
38+
39+
- name: Dependencies (Linux)
40+
if: runner.os == 'Linux'
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install \
44+
xorg-dev \
45+
ccache
46+
47+
- name: Dependencies (macOS)
48+
if: runner.os == 'macOS'
49+
run: |
50+
brew update
51+
brew install ccache
52+
53+
- name: Cache Build
54+
id: cache-build
55+
uses: actions/cache@v2
56+
with:
57+
path: ~/.ccache
58+
key: ${{ runner.os }}-${{ matrix.config }}-cache
59+
60+
- name: Prepare ccache
61+
run: |
62+
ccache --max-size=1.0G
63+
ccache -V && ccache --show-stats && ccache --zero-stats
64+
65+
- name: Configure
66+
run: |
67+
mkdir -p build
68+
cd build
69+
cmake .. \
70+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
71+
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \
72+
73+
- name: Build
74+
run: cd build; make -j2; ccache --show-stats
75+
76+
- name: Tests
77+
run: cd build; ctest --verbose -j2
78+
79+
####################
80+
# Windows
81+
####################
82+
83+
Windows:
84+
name: Windows (${{ matrix.config }})
85+
runs-on: windows-2022
86+
env:
87+
CC: cl.exe
88+
CXX: cl.exe
89+
strategy:
90+
fail-fast: false
91+
matrix:
92+
config: [Debug, Release]
93+
steps:
94+
- name: Checkout repository
95+
uses: actions/checkout@v1
96+
with:
97+
fetch-depth: 10
98+
99+
- name: Enable Developer Command Prompt
100+
uses: ilammy/msvc-dev-cmd@v1
101+
102+
- name: Install Ninja
103+
uses: seanmiddleditch/gha-setup-ninja@master
104+
105+
- name: Set env variable for sccache
106+
run: |
107+
echo "appdata=$env:LOCALAPPDATA" >> ${env:GITHUB_ENV}
108+
109+
- name: Cache build
110+
id: cache-build
111+
uses: actions/cache@v2
112+
with:
113+
path: ${{ env.appdata }}\Mozilla\sccache
114+
key: ${{ runner.os }}-${{ matrix.config }}-cache
115+
116+
- name: Prepare sccache
117+
run: |
118+
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
119+
scoop install sccache --global
120+
# Scoop modifies the PATH so we make it available for the next steps of the job
121+
echo "${env:PATH}" >> ${env:GITHUB_PATH}
122+
123+
- name: Configure
124+
run: |
125+
cmake -G Ninja `
126+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache `
127+
-DCMAKE_BUILD_TYPE=${{ matrix.config }} `
128+
-DCMAKE_JOB_POOLS="pool-linking=1;pool-compilation=2" `
129+
-DCMAKE_JOB_POOL_COMPILE:STRING=pool-compilation `
130+
-DCMAKE_JOB_POOL_LINK:STRING=pool-linking `
131+
-B build `
132+
-S .
133+
134+
- name: Build
135+
run: cmake --build build -j2
136+
137+
- name: Tests
138+
run: cd build; ctest --verbose -j2

.github/workflows/nightly.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: Nightly
2+
3+
on:
4+
schedule:
5+
- cron: '0 4 * * *'
6+
7+
env:
8+
CTEST_OUTPUT_ON_FAILURE: ON
9+
CTEST_PARALLEL_LEVEL: 2
10+
11+
jobs:
12+
check_date:
13+
runs-on: ubuntu-20.04
14+
name: Check latest commit
15+
outputs:
16+
should_run: ${{ steps.should_run.outputs.should_run }}
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: print latest_commit
20+
run: echo ${{ github.sha }}
21+
22+
- id: should_run
23+
continue-on-error: true
24+
name: check latest commit is less than a day
25+
if: ${{ github.event_name == 'schedule' }}
26+
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
27+
28+
####################
29+
# Linux / macOS
30+
####################
31+
32+
Unix:
33+
name: ${{ matrix.name }} (${{ matrix.config }})
34+
runs-on: ${{ matrix.os }}
35+
needs: check_date
36+
if: ${{ needs.check_date.outputs.should_run != 'false' }}
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
name: [
41+
ubuntu-20.04-gcc-8,
42+
ubuntu-20.04-gcc-9,
43+
ubuntu-20.04-gcc-10,
44+
ubuntu-20.04-gcc-11,
45+
ubuntu-20.04-clang-9,
46+
ubuntu-20.04-clang-10,
47+
ubuntu-20.04-clang-11,
48+
ubuntu-20.04-clang-12,
49+
macos-10.15,
50+
macOS-11,
51+
]
52+
config: [Debug, Release]
53+
include:
54+
- name: ubuntu-20.04-gcc-8
55+
os: ubuntu-20.04
56+
compiler: gcc
57+
version: "8"
58+
59+
- name: ubuntu-20.04-gcc-9
60+
os: ubuntu-20.04
61+
compiler: gcc
62+
version: "9"
63+
64+
- name: ubuntu-20.04-gcc-10
65+
os: ubuntu-20.04
66+
compiler: gcc
67+
version: "10"
68+
69+
- name: ubuntu-20.04-gcc-11
70+
os: ubuntu-20.04
71+
compiler: gcc
72+
version: "11"
73+
74+
- name: ubuntu-20.04-clang-9
75+
os: ubuntu-20.04
76+
compiler: clang
77+
version: "9"
78+
79+
- name: ubuntu-20.04-clang-10
80+
os: ubuntu-20.04
81+
compiler: clang
82+
version: "10"
83+
84+
- name: ubuntu-20.04-clang-11
85+
os: ubuntu-20.04
86+
compiler: clang
87+
version: "11"
88+
89+
- name: ubuntu-20.04-clang-12
90+
os: ubuntu-20.04
91+
compiler: clang
92+
version: "12"
93+
94+
- name: macOS-10.15
95+
os: macOS-10.15
96+
97+
- name: macOS-11
98+
os: macOS-11
99+
steps:
100+
- name: Checkout repository
101+
uses: actions/checkout@v1
102+
with:
103+
fetch-depth: 10
104+
105+
- name: Dependencies (Linux)
106+
if: runner.os == 'Linux'
107+
run: |
108+
sudo apt-get update
109+
110+
if [ "${{ matrix.compiler }}" = "gcc" ]; then
111+
sudo apt-get install -y g++-${{ matrix.version }}
112+
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
113+
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
114+
else
115+
sudo apt-get install -y clang-${{ matrix.version }}
116+
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
117+
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
118+
fi
119+
120+
sudo apt-get install \
121+
xorg-dev
122+
123+
- name: Configure
124+
run: |
125+
mkdir -p build
126+
cd build
127+
cmake .. \
128+
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
129+
130+
- name: Build
131+
run: cd build; make -j2
132+
133+
- name: Tests
134+
run: cd build; ctest --verbose -j2
135+
136+
####################
137+
# Windows
138+
####################
139+
140+
Windows:
141+
name: Windows (${{ matrix.config }})
142+
runs-on: windows-2022
143+
needs: check_date
144+
if: ${{ needs.check_date.outputs.should_run != 'false' }}
145+
env:
146+
CC: cl.exe
147+
CXX: cl.exe
148+
strategy:
149+
fail-fast: false
150+
matrix:
151+
config: [Debug, Release]
152+
steps:
153+
- name: Checkout repository
154+
uses: actions/checkout@v1
155+
with:
156+
fetch-depth: 10
157+
158+
- name: Enable Developer Command Prompt
159+
uses: ilammy/msvc-dev-cmd@v1
160+
161+
- name: Install Ninja
162+
uses: seanmiddleditch/gha-setup-ninja@master
163+
164+
- name: Configure
165+
run: |
166+
cmake -G Ninja `
167+
-DCMAKE_BUILD_TYPE=${{ matrix.config }} `
168+
-DCMAKE_JOB_POOLS="pool-linking=1;pool-compilation=2" `
169+
-DCMAKE_JOB_POOL_COMPILE:STRING=pool-compilation `
170+
-DCMAKE_JOB_POOL_LINK:STRING=pool-linking `
171+
-B build `
172+
-S .
173+
174+
- name: Build
175+
run: cmake --build build -j2
176+
177+
- name: Tests
178+
run: cd build; ctest --verbose -j2

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 2.8.11)
1010

1111
# Note: geogram.cmake defines GEOGRAM_WITH_VORPALINE
1212
# that we could have used instead,
13-
# but geogram.cmake needs to be included after the project()
13+
# but geogram.cmake needs to be included after the project()
1414
# command, since project() resets CFLAGS and CXXFLAGS.
1515

1616
if("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL "")
@@ -42,7 +42,7 @@ if(NOT GEOGRAM_SUB_BUILD)
4242
option(GEOGRAM_WITH_FPG "Predicate generator (Sylvain Pion's FPG)" OFF)
4343
option(GEOGRAM_USE_SYSTEM_GLFW3 "Use the version of GLFW3 installed in the system if found" OFF)
4444
option(GEOGRAM_WITH_GARGANTUA "64-bit indices" OFF)
45-
set(VORPALINE_PLATFORM "" CACHE STRING "")
45+
include(cmake/geo_detect_platform.cmake)
4646
endif()
4747

4848
include(cmake/geogram.cmake)
@@ -76,13 +76,13 @@ endif()
7676
if(GEOGRAM_WITH_VORPALINE)
7777
find_package(Subversion QUIET)
7878
if(NOT SUBVERSION_FOUND)
79-
message(WARNING "Subversion executable not found - cannot determine current revision")
79+
message(WARNING "Subversion executable not found - cannot determine current revision")
8080
else()
8181
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} Vorpaline)
8282
message(STATUS "Vorpaline revision is ${Vorpaline_WC_REVISION}")
8383
set(VORPALINE_SVN_REVISION ${Vorpaline_WC_REVISION})
8484
endif()
85-
endif()
85+
endif()
8686

8787
##############################################################################
8888
# RPATH (where executables find the .so / DLLs)
@@ -181,7 +181,7 @@ if(CPACK_GENERATOR STREQUAL "DEB")
181181
# or GET_PROPERTY(result GLOBAL ENABLED_FEATURES) (successful FIND_PACKAGE())
182182
endif()
183183

184-
if(NOT DEFINED CPACK_GENERATOR)
184+
if(NOT DEFINED CPACK_GENERATOR)
185185
if(WIN32)
186186
set(CPACK_GENERATOR ZIP)
187187
else()

cmake/geo_detect_platform.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
# Sets the CACHE variable VORPALINE_PLATFORM based on the detected operating system.
3+
#
4+
# Note that it would be better to use CMAKE_SYSTEM_NAME directly, and use other CMake
5+
# variables to enable other build-specific flags, e.g.:
6+
# - Use BUILD_SHARED_LIBS to enable behavior specific to shared libs
7+
# - Use CheckCXXCompilerFlag to enable compiler-specific flags
8+
#
9+
if(CMAKE_SYSTEM_NAME MATCHES Linux)
10+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
11+
set(VORPALINE_PLATFORM "Linux64-gcc-dynamic" CACHE STRING "")
12+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
13+
set(VORPALINE_PLATFORM "Linux64-clang-dynamic" CACHE STRING "")
14+
endif()
15+
elseif(CMAKE_SYSTEM_NAME MATCHES Darwin)
16+
set(VORPALINE_PLATFORM "Darwin-clang-dynamic" CACHE STRING "")
17+
elseif(CMAKE_SYSTEM_NAME MATCHES Windows)
18+
set(VORPALINE_PLATFORM "Win-vs-generic" CACHE STRING "")
19+
elseif(CMAKE_SYSTEM_NAME MATCHES Android)
20+
set(VORPALINE_PLATFORM "Android-aarch64-gcc-dynamic" CACHE STRING "")
21+
endif()

0 commit comments

Comments
 (0)