Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up TriBITS testing using GitHub Actions #363

Closed
16 tasks done
bartlettroscoe opened this issue Mar 23, 2021 · 27 comments
Closed
16 tasks done

Set up TriBITS testing using GitHub Actions #363

bartlettroscoe opened this issue Mar 23, 2021 · 27 comments

Comments

@bartlettroscoe
Copy link
Member

bartlettroscoe commented Mar 23, 2021

CC: @keita, @fnrizzi, @marcinwrobel1986, @MikolajZuzek

With a lot of work on TriBITS going on and coming up (i.e. #63, #299, etc.) we need solid testing for TriBITS. I have solid testing of TriBITS on local machines set up using the checkin-test.py script (see checkin-test-crf450.sh and those it calls) but we really need to have this for PR testing as well. In the past, I did that with Travis CI. But for reasons that I can't go into here, Travis CI is not a viable option going forward.

The obvious choice for this would seem to be to use GitHub Actions (GHA) for this. But I don't know anything about GHA so this will be a learning curve.

For dependencies I need:

  • CMake 3.17
  • C++, C, and Fortran compilers
  • Python 2.7

Other dependencies that would be nice to have:

  • CMake current release (current CMake 3.19 but soon to be 3.20)
  • Python 3.x
  • Ninja 1.10+

And this would post to CDash at:

At a minimum, there needs to be a build with:

  • CMake 3.17 + Python 2.7 (or 3.x)

Other builds that would be nice to have include:

  • CMake current + Python 3.x (or 2.7 if base build is using 3.x)
  • CMake 3.17 + Ninja 1.10
  • CMake 3.17 + Ninja 1.10 (no Fortran)

Tasks:

  • Scope out new GitHub Actions driver (see PRs CI: draft action yaml #366 and TriBITS CI testing with GitHub Actions (#363) #389)
  • Create new branch '363-github-actions-tests' based off '377-provide-feedback-on-TriBITS-package-dependencies-data-structures-CI', rebase, clean up commits and create new PR .
  • Add install of docutils to github actions job and enable build_docs test.
  • Create file tribits_cmake-3.21.0_makefiles_python-3.8_g++-9_tweaks.cmake disables for cmake-3.21.0 GHA build to disable tests that fail with CMake 3.20.
  • Add new triggers workflow_dispatch and schedule.
  • Determine what branch the GitHub Action jobs was invoked on and send jobs to CDash to different CDash groups based on the event trigger: PRs and manual triggers to 'Experimental', pushes to 'master' to 'Continuous', cron jobs to 'Nightly' (see GITHUB_EVENT_NAME).
  • Set up TriBITS CDash site to send out emails if there are any failures reported to 'Continuous' or 'Nightly' dashboard'.
  • Merge new PR branch.
  • Create a side branch '363-github-actions-tests-show-ctest-3.21-defects' and create a PR that demonstrates the failures with CMake 3.21 that don't occur with CMake 3.17, post SNL Kitware issue ... See PR DO NOT MERGE: Show TriBITS test failures with CMake 3.21.0 that don't occur with CMake 3.17.5 (#363) #394 and SNL Kitware #184.
  • Do a push to 'master' and verify that the builds are fired off and submit to the 'Continuous' CDash group.
  • Verify that the workflow_dispatch trigger works and submits to the Experimental CDash group.
  • Verify that the schedule trigger works and submits to the 'Nightly' CDash group.
  • Add pull request number to the build names and send results to CDash "Pull Request" Group for PR builds.
  • Print ninja version PR Print the ninja path and version (#363) #397
  • Fix problem with pr-null_ in build name of push testing to master ... PR Deal with pr null in not preprending build name (#363) #398
  • Update TriBITS GitHub wiki from Travis CI to GitHub Actions setup ... see here and here.
@bartlettroscoe
Copy link
Member Author

As part of the IDEAS-ECP project, I have been looking into GHA so it seems like a good time to try setting up TriBITS testing (and posting to CDash) using GHA.

Some good starting references I was pointed to were:

Those link to other pages with lots more information.

Some info on doing C++ testing with CMake can be found at:

That shows how to test with CMake + Ninja and does so on Linux and Windows! This will take some time to adapt, but it should do it hopefully.

@bartlettroscoe
Copy link
Member Author

@keita, @fnrizzi, @marcinwrobel1986, @MikolajZuzek,

Any of you guys have GitHub Actions experience that you could use to help set up automated testing on GitHub for TriBITS to help drive the TriBITS refactoring work?

@fnrizzi
Copy link
Collaborator

fnrizzi commented Apr 16, 2021

@bartlettroscoe
Hi Ross! I have some, but not extensive (most of my GA experience relates to C++ and Python testing for this project https://github.com/Pressio).
I just connected with @marcinwrobel1986 @MikolajZuzek: they said they know GA a bit too. We also have another person in our group that knows it too. I would say we know enough that we can help out getting started.
Speaking of this, Keita mentioned that he would setup a meeting between all of us for mid April to talk about the trilinos work. What if we try to schedule that soon and use to talk about this too and how this fits the current work agreement we have?

@bartlettroscoe
Copy link
Member Author

I have some, but not extensive (most of my GA experience relates to C++ and Python testing for this project https://github.com/Pressio).

@fnrizzi, it turns out that TriBITS testing is basically C++ and Python testing. If you can test C++ and Python where CMake is building the C++ code, that is all that is needed for building and running the native TriBITS test suite. I could use some help getting a starting GHA workflow in place with a few different jobs as described above.

I have learned some about GHA in the last month from working on the backend workflow for https://bssw.io and the bssw.io GitHub project.

Speaking of this, Keita mentioned that he would setup a meeting between all of us for mid April to talk about the trilinos work. What if we try to schedule that soon and use to talk about this too and how this fits the current work agreement we have?

Yes, let's coordinate this offline.

@fnrizzi
Copy link
Collaborator

fnrizzi commented Apr 16, 2021

@bartlettroscoe if you want, over the next few days I can try to setup a minimal GA workflow file that builds and runs the TriBITS tests to get started with. It would be minimal, but at least something to start from. It should be relatively easy to do since you said testing works like testing in C++. Would that be useful for you? And we can coordinate offline with Keita how to move forward.

@bartlettroscoe
Copy link
Member Author

bartlettroscoe commented Apr 16, 2021

if you want, over the next few days I can try to setup a minimal GA workflow file that builds and runs the TriBITS tests to get started with

@fnrizzi, that would be great! If the env has C, C++, Fortran, MPI, CMake 3.17, and Python 2.7+, then it should be as easy as:

$ mkdir <build-dir>
$ cd <build-dir>

$ cmake \
  -D TPL_ENABLE_MPI=ON \
  -D CMAKE_C_COMPILER=gcc \
  -D TriBITS_ENABLE_Fortran=ON \
  -D TriBITS_ENABLE_TESTS=ON \
  <tribits-base>

$ make

$ ctest -j16

If you can get that to configure, build, and run the tests, then I can take it from there and get this to submit to CDash and put in a nice link.

I guess you need to develop and test this GA workflow file in your fork of TriBITS (on the 'master' branch)? That seems the only way to test and experiment with GA workflows before going into production.

@fnrizzi
Copy link
Collaborator

fnrizzi commented Apr 16, 2021

@bartlettroscoe ok, will try to have this ready by Monday or so, and will ping you then!

@fnrizzi
Copy link
Collaborator

fnrizzi commented Apr 16, 2021

@bartlettroscoe
Here is a draft of the yaml fle: https://github.com/fnrizzi/TriBITS/blob/master/.github/workflows/ghactions.yml
I have it running (without MPI for now): https://github.com/fnrizzi/TriBITS/actions/runs/756848014

Some tests fail though:
https://github.com/fnrizzi/TriBITS/runs/2365734531?check_suite_focus=true

I can change the action to run ctest -V to see the full log if you want (which you can also download btw)

@bartlettroscoe
Copy link
Member Author

Here is a draft of the yaml fle

@fnrizzi, very nice! I will take this and and see if can't match the cases listed above. (I think there is 4 build cases to start out with.)

I can change the action to run ctest -V to see the full log if you want (which you can also download btw)

I will set it up to post to CDash so we will be able to see the details very well there (and then I can fix any test failures).

I have a few questions ...

It would be nice to have a single job first run for the configuration:

  • CMake 3.17 + Python 2.7 (or 3.x)

and if that passes, then run a set of other configurations like:

  • CMake current (3.20) + Python 3.x (or 2.7 if base build is using 3.x)
  • CMake 3.17 + Ninja 1.10
  • CMake 3.17 + Ninja 1.10 (no Fortran)

That would reduce a lot of wasted computer cycles in case that single build did not work.

Does GitHub Actions support that?

I see this is running with make -j4 and ctest -j4. Doe the VMs running the GitHub action jobs have 4 cores?

@fnrizzi
Copy link
Collaborator

fnrizzi commented Apr 17, 2021

@fnrizzi, very nice! I will take this and and see if can't match the cases listed above. (I think there is 4 build cases to start out with.)

@bartlettroscoe Thanks! Do you want me to open a pull request or you just grab the yaml file?

It would be nice to have a single job first run for the configuration:

  • CMake 3.17 + Python 2.7 (or 3.x)
    and if that passes, then run a set of other configurations like:
    That would reduce a lot of wasted computer cycles in case that single build did not work.

It is possible to do so, see jobs.<job_id>.needs or Example using status check functions here.
But also note that Jobs run in parallel by default. , so in my view it would make sense to launch the jobs you want. Indeed, If one of the target config lines aborts, all the other jobs are terminated right away. If you are worried about wasting cycles, I don't think this is a big deal, unless you expect to have really heavy jobs, but it seems to me both the build and test suite are pretty quick.

I see this is running with make -j4 and ctest -j4. Doe the VMs running the GitHub action jobs have 4 cores?

Not sure! I actually read once that it is a reasonable assumption, and has always worked fine for me, but I can dig more to see if that really works or if there is a way to automate detecting the parallelism level (I think that is possible to do in Azure for instance)
Here is a link @marcinwrobel1986 informed me of https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

@bartlettroscoe
Copy link
Member Author

Do you want me to open a pull request or you just grab the yaml file?

@fnrizzi, can you go ahead and clean up your git commits and post a PR? That way you will get credit for this in git.

@fnrizzi
Copy link
Collaborator

fnrizzi commented Apr 19, 2021

@bartlettroscoe thanks!
Here it is: #366

bartlettroscoe added a commit that referenced this issue Jul 22, 2021
…well (#363)

This should help show when CMake introduced the changes that broke these
TriBITS tests.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Jul 22, 2021
Where there is not an active PR, the 'pull_number' comes back 'null'.  In this
case, we don't want to append the build name.
bartlettroscoe added a commit that referenced this issue Jul 22, 2021
Deal with pr null in not preprending build name (#363)
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Jul 22, 2021
I just had to fix a minor defect in tribits/doc/build_ref/create-build-ref.sh
and now this works fine with building the Sphinx documentation.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Jul 22, 2021
There is no need to cd into that directory anymore.  It knows where it is and
how to build the docs in-source.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Jul 22, 2021
I just had to fix a minor defect in tribits/doc/build_ref/create-build-ref.sh
and now this works fine with building the Sphinx documentation.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Jul 22, 2021
There is no need to cd into that directory anymore.  It knows where it is and
how to build the docs in-source.
@bartlettroscoe
Copy link
Member Author

FYI: I also realized I needed to update the TriBITS GitHub wiki that was still mentioning Travis CI. See here and here.

bartlettroscoe added a commit that referenced this issue Aug 12, 2021
…re failures (#363)

This is to make it so that it is easy for Kitware to reproduce the CMake
3.21.0 issues.  This commit should only exist on this side branch
'363-github-actions-tests-show-ctest-3.21-failures' in a temp PR for testing
purposes.

I also commented out the disables of the tests that show the CMake 3.21 failures.
bartlettroscoe added a commit that referenced this issue Aug 12, 2021
…well (#363)

This should help show when CMake introduced the changes that broke these
TriBITS tests.
bartlettroscoe added a commit that referenced this issue Aug 12, 2021
….19+ (#363, #394)

I also added another test case for when libs are broken in required upstream
package.

See the detailed comments, especially in the file
TribitsCTestDriverCoreHelpers.cmake.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Aug 12, 2021
….19+ (TriBITSPub#363, TriBITSPub#394)

I also added another test case for when libs are broken in required upstream
package.

See the detailed comments, especially in the file
TribitsCTestDriverCoreHelpers.cmake.
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Aug 12, 2021
…for CMake 3.21 (TriBITSPub#363, TriBITSPub#394)

Now that TriBITS has a workaround for new CMake 3.19 behavior, this test
passes.

The rest of the tests can be enabled once CMake 3.21.2 is released and the
GitHub Actions workflow is updated to use that version (see TriBITSPub#394).
bartlettroscoe added a commit that referenced this issue Aug 12, 2021
…ckage-cmake-3.19-fix

Fix tribits_ctest_driver() package-by-package mode for CMake 3.19+ (#363, #394)
bartlettroscoe added a commit that referenced this issue Aug 27, 2021
This should fix problem with accumulation of labels with ctest_test().
bartlettroscoe added a commit that referenced this issue Aug 27, 2021
…tests-show-ctest-3.21-failures (#363, #394)

I resolved conflicts in the following files:

* cmake/ctest/github_actions/tribits_cmake-3.21.0_makefiles_python-3.8_g++-9_tweaks.cmake:
  * Removed the commented out fixed test
* test/ctest_driver/TribitsExampleProject/CMakeLists.txt:
  * Took what is on 'master'
* tribits/core/package_arch/TribitsGlobalMacros.cmake:
  * Took what is on 'master'
bartlettroscoe added a commit to bartlettroscoe/TriBITS that referenced this issue Aug 27, 2021
Also remove all of the test disables as cmake 3.21.2 has a patch that fixes
all of the test failures.
bartlettroscoe added a commit that referenced this issue Aug 30, 2021
Upgrade from cmake 3.21.0 to 3.21.2 (#363, #394)

Re-enables tests that were disabled due to regression in cmake 3.21.0 and 3.21.1.
bartlettroscoe added a commit to bartlettroscoe/Trilinos that referenced this issue Sep 4, 2021
Brings in numerous refactorings to TriBITS over the last 3 months, but there
should be no breaks in backward compatibility.  Almost every file in TriBITS
is changed due to the lower-casing of command, macro and function names in PR
TriBITSPub/TriBITS#379.  But the main driver for this snapshot is to bring in
the change in PR TriBITSPub/TriBITS#413 that should make it so that Kokkos
INTERFACE_COMPILE_OPTIONS get propagated to downstream targets in TriBITS and
therefore to external customers through installed <Package>Config.cmake files
and IMPORTED targets.  I should have done several snapshots in the last few
months and not done a big snapshot like this (but I have been testing with
Trilinos locally along the way).

Overall, this merge brings in changes from a bunch of TriBITS PRs including
(from most recent):

* TriBITSPub/TriBITS#413: Change internal TriBITS target_link_libraries() to
  PUBLIC (TriBITSPub/TriBITS#299) component: core type: enhancement

* TriBITSPub/TriBITS#410: Upgrade from cmake 3.21.0 to 3.21.2
  (TriBITSPub/TriBITS#363, TriBITSPub/TriBITS#394)

* TriBITSPub/TriBITS#394: DO NOT MERGE: Show TriBITS test failures with CMake
  3.21.0 that don't occur with CMake 3.17.5 (TriBITSPub/TriBITS#363)

* TriBITSPub/TriBITS#409: Add getTestDictStatusField() to handle empty
  'status' field (SESW-383) component: ci_support type: enhancement

* TriBITSPub/TriBITS#408: Deal with spaces in CDash url parts (SESW-383)
  component: ci_support type: enhancement

* TriBITSPub/TriBITS#403: Spelling fixes

* TriBITSPub/TriBITS#407: Move tribits_get_build_url_and_write_to_file() to
  stand-alone module (TriBITSPub/TriBITS#154) component: ctest_driver type:
  enhancement

* TriBITSPub/TriBITS#388: Fixing typos (TriBITSPub/TriBITS#377)

* TriBITSPub/TriBITS#406: Fix tribits_ctest_driver() package-by-package mode
  for CMake 3.19+ (TriBITSPub/TriBITS#363, TriBITSPub/TriBITS#394) component:
  ctest_driver type: bug

* TriBITSPub/TriBITS#401: Improve GitHub Actions and CDash integration
  (TriBITSPub/TriBITS#154) type: enhancement

* TriBITSPub/TriBITS#366: CI: draft action yaml

* TriBITSPub/TriBITS#402: Revert some incorrect uppercase->lowercase changes

* TriBITSPub/TriBITS#387: Build and deploy TriBITS documentation with Sphinx
  (TriBITSPub/TriBITS#386) component: documentation type: enhancement

* TriBITSPub/TriBITS#398: Deal with pr null in not preprending build name
  (TriBITSPub/TriBITS#363) type: bug

* TriBITSPub/TriBITS#396: Send PR results to 'Pull Request' CDash group and
  add PR ID to build names (TriBITSPub/TriBITS#363) type: enhancement

* TriBITSPub/TriBITS#397: Print the ninja path and version
  (TriBITSPub/TriBITS#363)

* TriBITSPub/TriBITS#393: GitHub Actions based testing for TriBITS
  (TriBITSPub/TriBITS#363) type: enhancement

* TriBITSPub/TriBITS#389: TriBITS CI testing with GitHub Actions
  (TriBITSPub/TriBITS#363) type: enhancement

* TriBITSPub/TriBITS#392: Fix broken tests for non-Fortran and CMake 3.21
  builds (TriBITSPub/TriBITS#363) component: core

* TriBITSPub/TriBITS#391: Fix up build_docs.sh for Sphinx doc generation
  (TriBITSPub/TriBITS#386) component: documentation type: enhancement

* TriBITSPub/TriBITS#390: Add test for doc generation and fix usage of Python3
  component: documentation type: bug

* TriBITSPub/TriBITS#385: Replace last few references to
  TribitsDevelopersGuide.html (TriBITSPub/TriBITS#381) component:
  documentation type: enhancement

* TriBITSPub/TriBITS#384: Split TribitsDevelopersGuide.* into
  TribitsUsersGuide.* and TribitsMaintainersGuide.* (TriBITSPub/TriBITS#381)
  component: documentation type: enhancement

* TriBITSPub/TriBITS#383: Remove endfunction(<string>) and endmacro(<string>)
  (TriBITSPub/TriBITS#274, TriBITSPub/TriBITS#382) component: common_tpls
  type: bug

* TriBITSPub/TriBITS#380: More package-arch data-structure documentation
  updates (TriBITSPub/TriBITS#63) component: documentation type: enhancement

* TriBITSPub/TriBITS#379: Convert TriBITS to lower-case CMake command, macro,
  and function names (TriBITSPub/TriBITS#274)

The following files were conflicting where I went with what is on the Trilinos
'develop' branch:

* cmake/tribits/common_tpls/FindTPLBLAS.cmake
* cmake/tribits/common_tpls/FindTPLLAPACK.cmake
* cmake/tribits/common_tpls/FindTPLNetcdf.cmake

(It looks like the above changes never made it back into TriBITS proper.  The
conflicts were due to the case changes in cmake command calls in these files
due to TriBITSPub/TriBITS#379.)

There was also a conflict in the file:

* cmake/tribits/core/installation/TribitsProjectConfigTemplate.cmake.in

I looked at that one carefully and I think that may have been due to fixes on
both sides and then the case changes from TriBITSPub/TriBITS#379.
@bartlettroscoe bartlettroscoe moved this to Done in TriBITS Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Status: Done
Development

No branches or pull requests

3 participants