Revision: 77673
          http://sourceforge.net/p/brlcad/code/77673
Author:   starseeker
Date:     2020-11-03 20:18:32 +0000 (Tue, 03 Nov 2020)
Log Message:
-----------
Stash attempt at simplification of github actions logic.

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

Modified: brlcad/trunk/misc/repoconv/github_ci_actions.yml
===================================================================
--- brlcad/trunk/misc/repoconv/github_ci_actions.yml    2020-11-03 19:39:24 UTC 
(rev 77672)
+++ brlcad/trunk/misc/repoconv/github_ci_actions.yml    2020-11-03 20:18:32 UTC 
(rev 77673)
@@ -1,28 +1,6 @@
+# For information about available platforms for testing, see:
 #
-#  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.  When we do, we'll want to also incorporate
-#  some sort of periodic cleanup so we don't burn too much storage space
-#  with each build - see, for example:
-#  
https://poweruser.blog/storage-housekeeping-on-github-actions-e2997b5b23d1?gi=f134f9f8b336
-#
+# 
https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners
 
 name: BRL-CAD
 
@@ -29,233 +7,108 @@
 on: [push]
 
 jobs:
-  build:
-    #
-    #  Define a matrix of the operating system and compiler combinations
-    #  we want to build against.
-    #
-    #  Note that for Windows the vcvars64.bat script is important - that
-    #  is what sets up environment variables to make sure we get the 64
-    #  bit version of the compiler and libraries.  See:
-    #  https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
-    #
-    name: ${{ matrix.config.name }}
-    runs-on: ${{ matrix.config.os }}
+  windows:
+    name: Windows Latest MSVC
+    runs-on: windows-latest
     strategy:
       fail-fast: true
-      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-20.04,
-            cc: "gcc", cxx: "g++"
-          }
-        - {
-            name: "macOS Latest Clang", artifact: "macOS.tar.xz",
-            os: macos-latest,
-            cc: "clang", cxx: "clang++"
-          }
+    steps:
+      - name: Setup - CMake
+        uses: lukka/get-cmake@latest
 
-    #
-    #  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.
-    #
+      - name: Setup - Ninja
+        uses: seanmiddleditch/gha-setup-ninja@master
+
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Add github workspace to path
+        # https://github.community/t/deprecated-add-path/136621
+        run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath 
$env:GITHUB_PATH -Encoding utf8
+
+      - name: Add msbuild to PATH
+        uses: microsoft/[email protected]
+
+      - name: Add cl.exe to PATH
+        uses: ilammy/msvc-dev-cmd@v1
+
+      - name: Configure
+        run: |
+          cmake -S . -B build -G Ninja -D CMAKE_C_COMPILER="cl.exe" -D 
CMAKE_CXX_COMPILER="cl.exe" -D ENABLE_ALL=ON -D CMAKE_BUILD_TYPE=Release
+          powershell Write-VolumeCache C
+          powershell Write-VolumeCache D
+
+      - name: Build
+        run: cmake --build build --config Release --target package
+
+      - name: Upload Package
+        uses: actions/upload-artifact@v2
+        with:
+          name: BRLCAD_Windows
+          path: ${{ github.workspace }}/build/BRL-CAD*exe
+
+  linux:
+    name: Ubuntu Latest GCC
+    runs-on: ubuntu-20.04
+    strategy:
+      fail-fast: true
     steps:
-    - uses: actions/checkout@v2
-    - uses: lukka/get-cmake@latest
-    - uses: seanmiddleditch/gha-setup-ninja@master
+      - name: Setup - CMake
+        uses: lukka/get-cmake@latest
 
-    - name: Configure
-      shell: cmake -P {0}
-      run: |
-        if ("${{ runner.os }}" STREQUAL "Windows")
-          # Try Write-VolumeCache for Windows
-          execute_process(COMMAND powershell Write-VolumeCache C)
-          execute_process(COMMAND powershell Write-VolumeCache D)
-        else ()
-          # On platforms where we have it, make sure the files are in place 
with a sync
-          execute_process(COMMAND sync)
-        endif ()
-        set(ENV{CC} ${{ matrix.config.cc }})
-        set(ENV{CXX} ${{ matrix.config.cxx }})
+      - name: Setup - Ninja
+        uses: seanmiddleditch/gha-setup-ninja@master
 
-        # Microsoft's environment setup presents a particular challenge.  We 
want the
-        # proper setup when we run CMake below to configure the build, but 
that requires
-        # setting up the command line first:
-        #
-        # 
https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line
-        #
-        # However, by the time we are here we are already off and running.  We 
can execute
-        # the setup file, but its setup will be scoped to the executed 
process, not this
-        # process.  To "lift" up the results of the script to the current 
environment, we
-        # capture the current state of the subprocess environment after script 
execute by
-        # printing it with a "set" command and having execute process capture 
it to a file.
-        # Then, that file is parsed into key/value pairs and the set(ENV) 
cmake command is
-        # used to apply those values to the current environment.
-        if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ 
matrix.config.environment_script }}" STREQUAL "x")
+      - name: Checkout
+        uses: actions/checkout@v2
 
-           # Collect the dev env info.
-           #
-           # Off by default, but we can set VSCMD_DEBUG to report debug
-           # info for debugging purposes (max value is 3 - we start at 1).
-           #set(ENV{VSCMD_DEBUG} 1)
-           execute_process(
-             COMMAND "${{ matrix.config.environment_script }}" && set
-             OUTPUT_FILE environment_script_output.txt
-           )
+      - name: Configure
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D 
CMAKE_BUILD_TYPE=Release
 
-           # Eliminate backslashes on the end of lines for file(STRINGS)
-           file(READ environment_script_output.txt file_contents)
-           string(REPLACE "\\\n" "\n" NFILE "${file_contents}")
-           file(WRITE environment_script_output.txt "${NFILE}")
+      - name: Build
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          cmake --build build --config Release --target package
 
-           # Extract environment key/value pairs
-           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()
+      - name: Upload Package
+        uses: actions/upload-artifact@v2
+        with:
+          name: BRLCAD_Linux
+          path: ${{ github.workspace }}/build/BRL-CAD*gz
 
-        endif()
+  osx:
+    name: macOS Latest Clang
+    runs-on: macos-latest
+    strategy:
+      fail-fast: true
+    steps:
+      - name: Setup - CMake
+        uses: lukka/get-cmake@latest
 
-        set(path_separator ":")
-        if ("${{ runner.os }}" STREQUAL "Windows")
-          set(path_separator ";")
-        endif()
-        set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
+      - name: Setup - Ninja
+        uses: seanmiddleditch/gha-setup-ninja@master
 
-        execute_process(
-          COMMAND cmake
-            -S .
-            -G Ninja
-            -B build
-            -D ENABLE_ALL=ON
-            -D CMAKE_BUILD_TYPE=Release
-            -D CMAKE_VERBOSE_DISTCHECK=ON
-            -D BRLCAD_ENABLE_GDAL=OFF
-            -D BRLCAD_ENABLE_STEP=OFF
-            -D BRLCAD_EXTRADOCS=OFF
-            -D BUILD_STATIC_LIBS=OFF
-           RESULT_VARIABLE result
-        )
-        if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ 
matrix.config.environment_script }}" STREQUAL "x")
-          # Try Write-VolumeCache for Windows
-          execute_process(COMMAND powershell Write-VolumeCache C)
-          execute_process(COMMAND powershell Write-VolumeCache D)
-        else()
-          # On platforms where we have it, make sure the files are in place 
with a sync
-          execute_process(COMMAND sync)
-        endif()
-        if (NOT result EQUAL 0)
-          message(FATAL_ERROR "Bad exit status")
-        endif()
+      - name: Checkout
+        uses: actions/checkout@v2
 
-    #
-    #  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()
+      - name: Configure
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          export CC=clang
+          export CXX=clang++
+          cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D 
CMAKE_BUILD_TYPE=Release
 
-        set(path_separator ":")
-        if ("${{ runner.os }}" STREQUAL "Windows")
-          set(path_separator ";")
-        endif()
-        set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
+      - name: Build
+        run: |
+          export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
+          cmake --build build --config Release --target package
 
-        if ("${{ runner.os }}" STREQUAL "Windows")
-           set(BCNT 0)
-           set(result 1)
-           while(result AND ${BCNT} LESS 4)
-             execute_process(COMMAND cmake --build build --config Release 
--target all RESULT_VARIABLE result)
-             if (NOT ${result})
-               execute_process(COMMAND powershell Write-VolumeCache C)
-               execute_process(COMMAND powershell Write-VolumeCache D)
-               execute_process(COMMAND cmake --build build --config Release 
--target check RESULT_VARIABLE result)
-             endif()
-             if (NOT ${result})
-               execute_process(COMMAND powershell Write-VolumeCache C)
-               execute_process(COMMAND powershell Write-VolumeCache D)
-               execute_process(COMMAND cmake --build build --config Release 
--target package RESULT_VARIABLE result)
-             endif()
-             math(EXPR BCNT "${BCNT}+1")
-           endwhile()
-           execute_process(COMMAND powershell Write-VolumeCache C)
-           execute_process(COMMAND powershell Write-VolumeCache D)
-        else ("${{ runner.os }}" STREQUAL "Windows")
-           set(BCNT 0)
-           set(result 1)
-           while(result AND ${BCNT} LESS 4)
-             execute_process(COMMAND cmake --build build --config Release 
--target all RESULT_VARIABLE result)
-             if (NOT ${result})
-               execute_process(COMMAND sync)
-               execute_process(COMMAND cmake --build build --config Release 
--target check RESULT_VARIABLE result)
-             endif()
-             if (NOT ${result})
-               execute_process(COMMAND sync)
-               execute_process(COMMAND cmake --build build --config Release 
--target package RESULT_VARIABLE result)
-             endif()
-             math(EXPR BCNT "${BCNT}+1")
-           endwhile()
-           execute_process(COMMAND sync)
-        endif ("${{ runner.os }}" STREQUAL "Windows")
-        if (NOT result EQUAL 0)
-          message(FATAL_ERROR "Bad exit status")
-        endif()
+      - name: Upload Package
+        uses: actions/upload-artifact@v2
+        with:
+          name: BRLCAD_OSX
+          path: ${{ github.workspace }}/build/BRL-CAD*gz
 
-    - name: Package
-      shell: cmake -P {0}
-      run: |
-        file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" gw_path)
-        message("gw_path: ${gw_path}")
-        # https://cmake.org/pipermail/cmake/2007-July/015471.html
-        file(MAKE_DIRECTORY "${gw_path}/package")
-        file(GLOB pkgs_zip "${gw_path}/build/BRL-CAD*zip")
-        file(GLOB pkgs_gz "${gw_path}/build/BRL-CAD*gz")
-        file(GLOB pkgs_exe "${gw_path}/build/BRL-CAD*exe")
-        set(pkgs ${pkgs_zip} ${pkgs_gz} ${pkgs_exe})
-        foreach(praw ${pkgs})
-           string(REPLACE "\\" "/" p ${praw})
-           get_filename_component(proot ${p} NAME)
-           file(RENAME "${p}" "${gw_path}/package/${proot}")
-           if (NOT EXISTS "${gw_path}/package/${proot}")
-              message(FATAL_ERROR "RENAME of ${p} FAILED!")
-           else (NOT EXISTS "${gw_path}/package/${proot}")
-              message("staged ${gw_path}/package/${proot}")
-           endif (NOT EXISTS "${gw_path}/package/${proot}")
-        endforeach()
 
-    - uses: actions/upload-artifact@v2
-      with:
-        name: BRL-CAD_${{ runner.os }}
-        path: ${{ github.workspace }}/package/*
-

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