Skip to content

Commit 4a74633

Browse files
authored
Merge pull request #310 from sourceryinstitute/small-cleanups
Changes for resolving issues and release automation - Fixes #79 - Fixes #297 - Add regression test for #243 - Add regression for #172 (currently set to pass when test fails) - Migrates to use of a `.VERSION` file to make parsing easier for scripts and allow extra comments - Adds auto-upload of release assets upon tagging with git, but requires that the tag is PGP signed (`git tag -s <tag> [tree-ish]`) - This should compute the SHA 256 checksum and create a detached signature of the cryptographic SHA 256 checksum with an encrypted GPG subway I uploaded to the repo/travis. 🔮 🎩 🐇
2 parents 249922e + acbeb00 commit 4a74633

22 files changed

+423
-76
lines changed

.VERSION

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# OpenCoarrays version file. Odd patch levels indicate inter-release
2+
# version, i.e., code is from SCM/git. This project uses semantic
3+
# versioning. For details see http://semver.org
4+
5+
1.8.3

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ prerequisites/build text
2121
*.tar binary
2222
*.gz binary
2323
*.tgz binary
24+
*.enc binary
2425

2526
# Prevent dev-ops files from making it into the release archives
2627
.travis.yml export-ignore
2728
.pullapprove.yml export-ignore
2829
.gitattributes export-ignore
2930
.gitignore export-ignore
3031
developer-scripts export-ignore
31-
codecov.yml export-ignore
32+
codecov.yml export-ignore
33+
*.enc export-ignore

.pullapprove.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1-
approve_by_comment: true
2-
approve_regex: '^([Aa]pproved|:\+1:|:shipit:|:ship: it|LGTM|[Ll]ooks good to me|:zap:|:boom:|:clap:|:bow:)'
3-
reject_regex: '^([Nn]ope|[Nn]ope\.jpg|[Dd]enied|[Rr]ejected|:\-1:)'
4-
reset_on_push: true
5-
author_approval: default
6-
reviewers:
1+
version: 2
2+
extends: Default # see https://pullapprove.com/sourceryinstitute/
3+
groups:
4+
# These have all the group_defaults
5+
Maintainers:
6+
# When merging non-documentation changes into protected branches,
7+
# require core team approval
78
required: 1
8-
members:
9-
- afanfa
10-
- rouson
11-
- zbeekman
9+
conditions:
10+
branches:
11+
- master
12+
- devel
13+
- caffeinate-opencoarrays
14+
files:
15+
exclude:
16+
- "*.md"
17+
users:
18+
- afanfa
19+
- rouson
20+
- zbeekman
21+
# https://github.com/orgs/sourceryinstitute/teams/team-opencoarrays
22+
OpenCoarrays:
23+
# Whenever someone has a PR, on any branch require at least 1
24+
# collaborator to explicitly review it
25+
required: 1
26+
users: all
27+
ConfigManagers:
28+
required: 1
29+
conditions:
30+
files:
31+
- .travis.yml
32+
- .pullapprove.yml
33+
- codecov.yml
34+
- .gitattributes
35+
- "*.enc"
36+
users:
37+
- zbeekman

.travis.yml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,28 @@ matrix:
6767
- g++-6
6868

6969
before_install:
70+
- |
71+
set -o errexit
72+
if [[ "$TRAVIS_TAG" ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]] && $TRAVIS_SECURE_ENV_VARS ; then
73+
brew update > /dev/null
74+
[[ "$(brew ls --versions gpg2)" ]] || brew install gpg2
75+
brew outdated gpg2 || brew upgrade gpg2
76+
which openssl || brew install openssl
77+
fi
78+
if ! [[ "$TRAVIS_TAG" ]] || ! $TRAVIS_SECURE_ENV_VARS ; then
79+
unset encrypted_ef4535c39461_key || true
80+
unset encrypted_ef4535c39461_iv || true
81+
rm subkey-328B3A0E-secret.asc{,.enc} || true
82+
83+
fi
84+
if [[ "$TRAVIS_TAG" ]] ; then
85+
curl https://izaakbeekman.com/izaak.pubkey.txt | gpg --import
86+
git tag -v ${TRAVIS_TAG}
87+
fi
88+
set +o errexit
89+
-
90+
-
91+
-
7092
- |
7193
set -o errexit
7294
if [[ $TRAVIS ]] && [[ "X$TRAVIS_OS_NAME" = "Xosx" ]]; then
@@ -142,24 +164,78 @@ script:
142164
export PATH="$PATH:$HOME/bin"
143165
./install.sh --yes-to-all -i "$HOME/opt/opencoarrays" -j 4 -f "$HOME/bin/gfortran" -c "$HOME/bin/gcc" -C "$HOME/bin/g++"
144166
cd prerequisites/builds/opencoarrays/*
145-
../../../installations/cmake/*/bin/ctest --output-on-failure
167+
../../../installations/cmake/*/bin/ctest --output-on-failure --schedule-random --repeat-until-fail 7
146168
cd -
147169
else
148170
mkdir cmake-build
149171
cd cmake-build
150172
cmake -DCMAKE_INSTALL_PREFIX:PATH="$HOME/OpenCoarrays" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ..
151173
make -j 4
152-
ctest --output-on-failure
174+
ctest --output-on-failure --schedule-random --repeat-until-fail 7
153175
make install
154176
cd ..
155177
fi
156178
set +o errexit
157179
180+
after_script:
181+
- |
182+
if [ "$TRAVIS_TAG" ]; then
183+
if [[ "v$TRAVIS_TAG" != "v$(sed -n 's/\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)/\1/p' .VERSION)" ]]; then
184+
echo "ERROR: You are trying to tag a new release but have a version missmatch in \`.VERSION\`"
185+
false # throw an error
186+
fi
187+
fi
188+
158189
after_success:
159190
- find . -name '*.gcno' -print
160191
- gcov-6 --version
161192
- bash <(curl -s https://codecov.io/bash) -x $(which gcov-6)
162193

194+
before_deploy:
195+
- git archive -v --prefix "OpenCoarrays-${TRAVIS_TAG}/" -o "OpenCoarrays-${TRAVIS_TAG}.tar.gz" ${TRAVIS_TAG}
196+
- |
197+
echo '# To verify cryptographic checksums `shasum -c opencoarrays-'"${TRAVIS_TAG}"'-SHA256.txt` on Mac OS X,' > "opencoarrays-${TRAVIS_TAG}-SHA256.txt
198+
echo '# `sha256sum -c opencoarrays-'"${TRAVIS_TAG}"'-SHA256.txt` on Linux.' >> "opencoarrays-${TRAVIS_TAG}-SHA256.txt
199+
if [[ "X$(uname -s)" == "XDarwin" ]]; then
200+
shasum -a 256 "OpenCoarrays-${TRAVIS_TAG}.tar.gz" >> "opencoarrays-${TRAVIS_TAG}-SHA256.txt
201+
else
202+
sha256sum "OpenCoarrays-${TRAVIS_TAG}.tar.gz" >> "opencoarrays-${TRAVIS_TAG}-SHA256.txt
203+
fi
204+
- |
205+
set -o errexit
206+
openssl aes-256-cbc -K $encrypted_ef4535c39461_key -iv $encrypted_ef4535c39461_iv -in subkey-328B3A0E-secret.asc.enc -out ./subkey-328B3A0E-secret.asc -d
207+
gpg --allow-secret-key-import --import ./subkey-328B3A0E-secret.asc && rm subkey-328B3A0E-secret.asc
208+
rm subkey-328B3A0E-secret.* || true
209+
unset encrypted_ef4535c39461_key || true
210+
unset encrypted_ef4535c39461_iv || true
211+
gpg --armor --detach-sign -u 328B3A0E --comment 'Mac users can use GPGTools - https://gpgtools.org' \
212+
--comment "Download Izaak Beekman's GPG public key from your" \
213+
--comment 'trusted key server or from' \
214+
--comment 'https://izaakbeekman.com/izaak.pubkey.txt' \
215+
--comment 'Next add it to your GPG keyring, e.g.,' \
216+
--comment '`curl https://izaakbeekman.com/izaak.pubkey.txt | gpg --import`' \
217+
--comment "Make sure you have verified that the release archive's" \
218+
--comment 'SHA256 checksum matches the provided' \
219+
--comment "opencoarrays-${TRAVIS_TAG}-SHA256.txt and ensure that this file" \
220+
--comment "and it's signature are in the same directory. Then" \
221+
--comment 'verify with:' \
222+
--comment '`gpg --verify opencoarrays-'"${TRAVIS_TAG}"'-SHA256.txt.asc`' \
223+
"opencoarrays-${TRAVIS_TAG}-SHA256.txt"
224+
set +o errexit
225+
226+
deploy:
227+
provider: releases
228+
api_key:
229+
secure: lBj4VgKhU74xfzPc0CDIji6cFrN/xEQIHLHjMcnDPWEF5JQe79aunMS5qiYu5ttve6khGI1WMFEe7clUO3TXiDUPyRMS4M8B2q3fuvUIsIbYgWcKq7ut+x6+dEQDj4DE3yWpPb8IDugWFp4vno1eQ2Rid1yr6Vn+rjnbE2i6z5SkXPnIv1ziQ9G+TF4ChUA8IOd1T78gJmML86P0rbt6nW8eVuJbza2y1ggHAY//q/b6rrbOFw5PqiOBqZ/BRrKJ5d2U2mvsoZtNn4OYyXw4eKEvNDIydwaIZROXfPRmN9zJ5G7+01QA5jlXpq17KfPBr7MXkn7nrQ5q9Z2ji4hRHk/AFzM/etfl1k4WCshYs13NlORpnU0vZtCMmmmsXWxj2kpsOHLWZQKdUAPs3olMPIG6aVnO5Abk1vrVSNy/ZeknbBTKCGScET1qRSaj6d43ynBwGkqHgaJdLBAwGe0Dpap6SsLGsAg56ZqHTngGlXB1KsbJKMkUsSC5RAgEuh9m55nsMaRlTYTrv+YADAQts7lV8yMCciMeJlrd3EYryyn4ZY1O82eOofhZZ5vQUktbXHtg6YnzguFwQyn+9yY/CQfi/vu2Aoq79NJEO/9UJ82ogn6gOoIebzb0xgIONjw4M68luR2U1CXtibzSYKWLGTeOj43khqZdbOpp6xncIv0=
230+
file:
231+
- "OpenCoarrays-${TRAVIS_TAG}.tar.gz"
232+
- "opencoarrays-${TRAVIS_TAG}-SHA256.txt"
233+
- "opencoarrays-${TRAVIS_TAG}-SHA256.txt.asc"
234+
skip_cleanup: true
235+
on:
236+
tags: true
237+
# repo: sourceryinstitute/opencoarrays
238+
163239
notifications:
164240
webhooks:
165241
urls:

CMakeLists.txt

Lines changed: 68 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ set ( CMAKE_BUILD_TYPE "Release"
66
CACHE STRING "Select which configuration to build." )
77
set_property ( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
88

9-
#Name project and specify source languages
10-
project(opencoarrays VERSION 1.8.3 LANGUAGES C Fortran)
9+
# Name project and specify source languages
10+
# Parse version from .VERSION file so that more info can be added and easier to get from scripts
11+
file( STRINGS ".VERSION" OpenCoarraysVersion
12+
REGEX "[0-9]+\\.[0-9]+\\.[0-9]+"
13+
)
14+
project(opencoarrays VERSION "${OpenCoarraysVersion}" LANGUAGES C Fortran)
15+
message( STATUS "Building OpenCoarrays version: ${OpenCoarraysVersion}" )
1116

1217
#Print an error message on an attempt to build inside the source directory tree:
1318
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
@@ -45,8 +50,48 @@ else()
4550
)
4651
endif()
4752

48-
if (NOT (CMAKE_VERSION VERSION_LESS 3.3.1))
49-
# Detect Fortran compiler version directly
53+
#-----------------------------------------------------------------
54+
# Set CMAKE_Fortran_COMPILER_VERSION if CMake doesn't do it for us
55+
#-----------------------------------------------------------------
56+
if ( NOT CMAKE_Fortran_COMPILER_VERSION )
57+
if ( NOT (CMAKE_VERSION VERSION_LESS 3.3.1) )
58+
message( AUTHOR_WARNING
59+
"CMake ${CMAKE_VERSION} should know about Fortran compiler versions but is missing CMAKE_Fortran_COMPILER_VERSION variable."
60+
)
61+
endif()
62+
# No CMAKE_Fortran_COMPILER_VERSION set, build our own
63+
# Try extracting it directly from ISO_FORTRAN_ENV's compiler_version
64+
# Write program for introspection
65+
file( WRITE "${CMAKE_BINARY_DIR}/get_compiler_ver.f90"
66+
"program main
67+
use iso_fortran_env, only: compiler_version, output_unit
68+
write(output_unit,'(a)') compiler_version()
69+
end program"
70+
)
71+
try_run( PROG_RAN COMPILE_SUCCESS
72+
"${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/get_compiler_ver.f90"
73+
RUN_OUTPUT_VARIABLE VER_STRING
74+
)
75+
if ( COMPILE_SUCCESS )
76+
string( REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?"
77+
DETECTED_VER "${VER_STRING}"
78+
)
79+
message( STATUS "Detected Fortran compiler as ${VER_STRING}" )
80+
message( STATUS "Extracted version number: ${DETECTED_VER}" )
81+
endif()
82+
if( ( NOT COMPILE_SUCCESS ) OR ( NOT DETECTED_VER ) )
83+
message( WARNING "Could not reliably detect Fortran compiler version. We'll infer it from
84+
the C compiler if it matches the Fortran compiler ID." )
85+
endif()
86+
if( "${CMAKE_C_COMPILER_ID}" MATCHES "${CMAKE_Fortran_COMPILER_ID}" )
87+
set( DETECTED_VER "${CMAKE_C_COMPILER_VERSION}" )
88+
else()
89+
message( FATAL_ERROR "Exhausted all possible means of detecting the Fortran compiler version, cannot proceed!" )
90+
endif()
91+
set( CMAKE_Fortran_COMPILER_VERSION "${DETECTED_VER}" )
92+
endif()
93+
94+
# We have populated CMAKE_Fortran_COMPILER_VERSION if it was missing
5095
if(gfortran_compiler AND (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 5.0.0))
5196
set(opencoarrays_aware_compiler true)
5297
add_definitions(-DPREFIX_NAME=_gfortran_caf_)
@@ -65,27 +110,9 @@ if (NOT (CMAKE_VERSION VERSION_LESS 3.3.1))
65110
CACHE STRING "Flags used by the compiler during release builds with debug info" FORCE)
66111
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0")
67112
endif()
68-
else()
69-
# Use the C compiler version as a proxy for the Fortran compiler version (won't work with NAG)
70-
if(gfortran_compiler AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0.0))
71-
set(opencoarrays_aware_compiler true)
72-
add_definitions(-DPREFIX_NAME=_gfortran_caf_)
73-
else()
74-
set(opencoarrays_aware_compiler false)
75-
add_definitions(-DPREFIX_NAME=_caf_extensions_)
113+
if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 ) )
114+
add_definitions(-DGCC_GE_7) # Tell library to build against GFortran 7.x bindings b/c we might be using clang for C
76115
endif()
77-
if(gfortran_compiler AND (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.4))
78-
# GCC patch to fix issue accepted for the 5.4 release
79-
# See https://github.com/sourceryinstitute/opencoarrays/issues/28 and
80-
# https://groups.google.com/forum/#!msg/opencoarrays/RZOwwYTqG80/46S9eL696dgJ
81-
message( STATUS "Disabling optimization flags due to GCC < 5.4 bug")
82-
set(CMAKE_Fortran_FLAGS_RELEASE -O0
83-
CACHE STRING "Flags used by the compiler during release builds." FORCE)
84-
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -O0"
85-
CACHE STRING "Flags used by the compiler during release builds with debug info" FORCE)
86-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0")
87-
endif()
88-
endif()
89116

90117
if(gfortran_compiler)
91118
set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
@@ -119,10 +146,10 @@ get_filename_component( FTN_COMPILER_DIR "${CMAKE_Fortran_COMPILER}"
119146
get_filename_component( C_COMPILER_DIR "${CMAKE_C_COMPILER}"
120147
REALPATH )
121148

122-
if (FTN_COMPILER_NAME MATCHES '^[mM][pP][iI]')
149+
if (FTN_COMPILER_NAME MATCHES "^[mM][pP][iI]")
123150
set (MPI_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}")
124151
endif()
125-
if (C_COMPILER_NAME MATCHES '^[mM][pP][iI]')
152+
if (C_COMPILER_NAME MATCHES "^[mM][pP][iI]")
126153
set (MPI_C_COMPILER "${CMAKE_C_COMPILER}")
127154
endif()
128155

@@ -271,6 +298,11 @@ set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_Fortran_COM
271298
set(CMAKE_Fortran_LINK_FLAGS ${CMAKE_Fortran_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS})
272299
include_directories(BEFORE ${MPI_C_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH})
273300

301+
#---------------------------------------------------
302+
# Use standardized GNU install directory conventions
303+
#---------------------------------------------------
304+
include(GNUInstallDirs)
305+
274306
#-------------------------------
275307
# Recurse into the src directory
276308
#-------------------------------
@@ -285,7 +317,7 @@ install(EXPORT OpenCoarraysTargets
285317
NAMESPACE
286318
OpenCoarrays::
287319
DESTINATION
288-
lib/cmake/opencoarrays
320+
"${CMAKE_INSTALL_LIBDIR}/cmake/opencoarrays"
289321
)
290322
include(CMakePackageConfigHelpers) # standard CMake module
291323
write_basic_package_version_file(
@@ -301,15 +333,13 @@ install(
301333
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/OpenCoarraysConfig.cmake"
302334
"${CMAKE_CURRENT_BINARY_DIR}/OpenCoarraysConfigVersion.cmake"
303335
DESTINATION
304-
lib/cmake/opencoarrays
336+
"${CMAKE_INSTALL_LIBDIR}/cmake/opencoarrays"
305337
)
306338

307339
add_library(OpenCoarrays INTERFACE)
308340
target_compile_options(OpenCoarrays INTERFACE -fcoarray=lib)
309341
target_link_libraries(OpenCoarrays INTERFACE caf_mpi)
310342

311-
install(DIRECTORY ${CMAKE_BINARY_DIR}/mod DESTINATION .)
312-
313343
#------------------------------------------
314344
# Add portable unistall command to makefile
315345
#------------------------------------------
@@ -390,6 +420,7 @@ if(opencoarrays_aware_compiler)
390420
add_mpi_test(syncimages2 32 ${tests_root}/unit/sync/syncimages2)
391421
add_mpi_test(duplicate_syncimages 8 ${tests_root}/unit/sync/duplicate_syncimages)
392422
add_mpi_test(co_reduce 4 ${tests_root}/unit/collectives/co_reduce_test)
423+
add_mpi_test(co_reduce_res_im 4 ${tests_root}/unit/collectives/co_reduce_res_im)
393424
add_mpi_test(syncimages_status 32 ${tests_root}/unit/sync/syncimages_status)
394425
add_mpi_test(sync_ring_abort_np3 3 ${tests_root}/unit/sync/sync_image_ring_abort_on_stopped_image)
395426
add_mpi_test(sync_ring_abort_np7 7 ${tests_root}/unit/sync/sync_image_ring_abort_on_stopped_image)
@@ -402,16 +433,17 @@ if(opencoarrays_aware_compiler)
402433
add_mpi_test(coarray_burgers_pde 2 ${tests_root}/integration/pde_solvers/coarrayBurgers/coarray_burgers_pde)
403434
add_mpi_test(co_heat 2 ${tests_root}/integration/pde_solvers/coarrayHeatSimplified/co_heat)
404435
add_mpi_test(asynchronous_hello_world 3 ${tests_root}/integration/events/asynchronous_hello_world)
405-
if ( ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64") AND ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") )
406-
if ( (NOT (DEFINED ENV{TRAVIS})) AND (NOT SKIP_ASSEMBLY_DEPS) )
407-
add_mpi_test(coarray_navier_stokes 2 ${tests_root}/integration/pde_solvers/navier-stokes/coarray_navier_stokes)
408-
set_property(TEST coarray_navier_stokes PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
409-
endif()
410-
endif()
411436

412437
# Regression tests based on reported issues
438+
if(gfortran_compiler AND (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0))
439+
# GFortran PR 78505 only fixed on trunk/gcc 7
440+
add_mpi_test(source-alloc-no-sync 8 ${tests_root}/regression/reported/source-alloc-sync)
441+
endif()
413442
add_mpi_test(convert-before-put 3 ${tests_root}/regression/reported/convert-before-put)
414443
add_mpi_test(event-post 3 ${tests_root}/regression/reported/event-post)
444+
add_mpi_test(co_reduce-factorial 4 ${tests_root}/regression/reported/co_reduce-factorial)
445+
# remove this before merging into master
446+
set_property(TEST co_reduce-factorial PROPERTY WILL_FAIL TRUE)
415447
else()
416448
add_test(co_sum_extension ${tests_root}/unit/extensions/test-co_sum-extension.sh)
417449
set_property(TEST co_sum_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")

0 commit comments

Comments
 (0)