Revision: 76740
          http://sourceforge.net/p/brlcad/code/76740
Author:   starseeker
Date:     2020-08-13 17:31:14 +0000 (Thu, 13 Aug 2020)
Log Message:
-----------
This is now useful enough to warrant checkpointing - using Github CI actions to 
do BRL-CAD builds on multiple platforms.

Modified Paths:
--------------
    brlcad/trunk/misc/CMakeLists.txt

Added Paths:
-----------
    brlcad/trunk/misc/repoconv/github_ci_actions.yml

Modified: brlcad/trunk/misc/CMakeLists.txt
===================================================================
--- brlcad/trunk/misc/CMakeLists.txt    2020-08-13 17:17:11 UTC (rev 76739)
+++ brlcad/trunk/misc/CMakeLists.txt    2020-08-13 17:31:14 UTC (rev 76740)
@@ -215,6 +215,7 @@
   repoconv/email_fixups.txt
   repoconv/cvs_repaired/sphflake.pix,v
   repoconv/gitattributes
+  repoconv/github_ci_actions.yml
   repoconv/gitignore.tar.gz
   repoconv/manual_merge_info.tar.gz
   repoconv/md5.hpp

Added: brlcad/trunk/misc/repoconv/github_ci_actions.yml
===================================================================
--- brlcad/trunk/misc/repoconv/github_ci_actions.yml                            
(rev 0)
+++ brlcad/trunk/misc/repoconv/github_ci_actions.yml    2020-08-13 17:31:14 UTC 
(rev 76740)
@@ -0,0 +1,150 @@
+#
+#  This logic defines cross platform build testing for BRL-CAD using
+#  Github's "Actions" mechanism.
+#
+#  We define a setup similar to https://github.com/cristianadam/HelloWorld/
+#
+#  Github has a time limit on these tests, and we also don't want to stress the
+#  system too heavily (particularly if we want to run them per-commit.)   For
+#  testing purposes we're currently using distcheck, but for eventual
+#  production use we need to change our build targets to something more
+#  streamlined.  It is probably also worth disabling step and gdal based
+#  features for the standard tests, as those compilation pieces are quite
+#  expensive - they should probably be regulated to something like a once-a-day
+#  test.
+#
+#  TODO - figure out how to schedule chron based jobs as well as the per
+#  commit tests below, so we can define rarer but progressively more
+#  comprehensive and heaver test runs.
+#
+#  TODO - figure out if we can generate actual release binaries from the
+#  artifacts of these builds.
+#
+
+name: BRL-CAD
+
+on: [push]
+
+jobs:
+  build:
+    #
+    #  Define a matrix of the operating system and compiler combinations
+    #  we want to build against.
+    #
+    name: ${{ matrix.config.name }}
+    runs-on: ${{ matrix.config.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+        - {
+            name: "Windows Latest MSVC", artifact: "Windows-MSVC.tar.xz",
+            os: windows-latest,
+            cc: "cl", cxx: "cl",
+            environment_script: "C:/Program Files (x86)/Microsoft Visual 
Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
+          }
+        - {
+            name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz",
+            os: ubuntu-latest,
+            cc: "gcc", cxx: "g++"
+          }
+        - {
+            name: "macOS Latest Clang", artifact: "macOS.tar.xz",
+            os: macos-latest,
+            cc: "clang", cxx: "clang++"
+          }
+
+    #
+    #  For each platform, we need to checkout the git repository,
+    #  and run CMake.
+    #
+    #  The logic below uses the approach demonstrated by Cristian Adam
+    #  which takes CMake's scripting mode (-P) and passes in from stdin
+    #  a script that incorporates values defined in the YAML environment.
+    #
+    #  Windows in particular needs the environment set up for compilation,
+    #  so the script recognizes when it is in that environment and
+    #  operates accordingly.
+    #
+    steps:
+    - uses: actions/checkout@v1
+
+    - name: Configure
+      shell: cmake -P {0}
+      run: |
+        set(ENV{CC} ${{ matrix.config.cc }})
+        set(ENV{CXX} ${{ matrix.config.cxx }})
+
+        if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ 
matrix.config.environment_script }}" STREQUAL "x")
+          execute_process(
+            COMMAND "${{ matrix.config.environment_script }}" && set
+            OUTPUT_FILE environment_script_output.txt
+          )
+          file(STRINGS environment_script_output.txt output_lines)
+          foreach(line IN LISTS output_lines)
+            if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
+              set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
+            endif()
+          endforeach()
+        endif()
+
+        set(path_separator ":")
+        if ("${{ runner.os }}" STREQUAL "Windows")
+          set(path_separator ";")
+        endif()
+        set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
+
+        execute_process(
+          COMMAND cmake
+            -S .
+            -B build
+            -D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
+            -D CMAKE_VERBOSE_DISTCHECK=ON
+          RESULT_VARIABLE result
+        )
+        if (NOT result EQUAL 0)
+          message(FATAL_ERROR "Bad exit status")
+        endif()
+
+    #
+    #  As with the configure stage, the build uses CMake's scripting mode (-P)
+    #  and passes a script in on stdin.
+    #
+    #  Windows needs the environment set up for compilation - paths for the
+    #  compilation are not set up by default in command line environments,
+    #  unlike most Unix-like systems.  Accordingly the script recognizes when
+    #  it is on Windows and executes the necessary setup code.
+    #
+    - name: Build
+      shell: cmake -P {0}
+      run: |
+        if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ 
matrix.config.environment_script }}" STREQUAL "x")
+          file(STRINGS environment_script_output.txt output_lines)
+          foreach(line IN LISTS output_lines)
+            if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
+              set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
+            endif()
+          endforeach()
+        endif()
+
+        set(path_separator ":")
+        if ("${{ runner.os }}" STREQUAL "Windows")
+          set(path_separator ";")
+        endif()
+        set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
+
+        if ("${{ runner.os }}" STREQUAL "Windows")
+           execute_process(
+             COMMAND cmake --build build --config Release --target 
distcheck-enableall_release
+             RESULT_VARIABLE result
+           )
+        else ("${{ runner.os }}" STREQUAL "Windows")
+           execute_process(
+             COMMAND cmake --build build --config Release --target distcheck
+             RESULT_VARIABLE result
+           )
+        endif ("${{ runner.os }}" STREQUAL "Windows")
+        if (NOT result EQUAL 0)
+          message(FATAL_ERROR "Bad exit status")
+        endif()
+


Property changes on: brlcad/trunk/misc/repoconv/github_ci_actions.yml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to