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

Fixes #212, Add unit test workflow #219

Closed
wants to merge 1 commit into from

Conversation

chillfig
Copy link
Contributor

@chillfig chillfig commented Mar 28, 2022

Changes enable_unit_test to true, changes ctest_output_on_failure to true,
Adds repo_name, changes ubuntu-latest to ubuntu-18.04, splits build-run
Copied and pasted this file from a successful run
Adds matrix method to ubuntu-18.04 and ubuntu-20.04

Checklist (Please check before submitting)

Describe the contribution
Fixes #212

Testing performed
Testing performed on fork: https://github.com/chillfig/CF/actions/runs/2054990660

Expected behavior changes
Passing workflow

System(s) tested on
Ubuntu 18.04
Ubuntu 20.04

Additional context
The build release tested on Ubuntu 20.04 catches a format truncation warning in nasa/osal. #1241 documents this issue. Passing workflow requires truncation suppression, depends on nasa/cFE#2078.

Contributor Info - All information REQUIRED for consideration of pull request
Justin Figueroa, ASRC Federal

@astrogeco astrogeco added the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Mar 29, 2022
@astrogeco astrogeco changed the title Fixes #212, Adds unit test workflow Fixes #212, Add unit test workflow Mar 30, 2022
@dmknutsen
Copy link
Contributor

On hold - Investigate why compile_options were not as expected

uses: actions/cache@v2
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: build-${{ github.run_number }}-${{ matrix.buildtype }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an extra item to the cache key to indicate which os you're building for, otherwise you can get a cache collision and unexpected results

uses: actions/cache@v2
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: build-${{ github.run_number }}-${{ matrix.buildtype }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add cache key for OS

uses: actions/cache@v2
with:
path: /home/runner/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/*
key: build-${{ github.run_number }}-${{ matrix.buildtype }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add cache key for OS

@astrogeco
Copy link
Contributor

Screen Shot 2022-04-01 at 8 25 53 AM

We might need to rearchitect this. If one of the builds fails the remaining builds do not run the "Run" or "Unit Test" jobs.
Even if one part of the matrix fails, the other unrelated builds should continue down the job "train"

This is actually a limmitation on github actions. I have two ideas:

  1. Don't have separate jobs for "run" and "unit test"
  2. Try some of the answers in this link https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional

@chillfig chillfig force-pushed the add_unit_test branch 2 times, most recently from aa21622 to 2401ec2 Compare April 1, 2022 20:58
os: [ubuntu-18.04, ubuntu-20.04]
buildtype: [debug, release]

# Set the type of machine to run on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment doesn't match action.

Comment on lines +118 to +115
- name: Check Coverage
run: make lcov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend breaking up this workflow since it seems to be doing many different things and overlapping other workflows. If the point is to just build and run CF I recommend actually checking for the CF startup message. The 2nd sed line also could be more generic (just append to the list and simply the search, probably makes more sense appending to MISSION_APP_LIST) and it's not clear why the first one adds at line 7 (seems overly specific).

Doing the entire bundle set of tests and lcov seems like overkill, suggest a separate workflow that just does the unit tests and CF coverage (with enforcement) to both simplify this workflow and avoid the potential of throwing unrelated errors.

@chillfig chillfig self-assigned this Apr 5, 2022
@astrogeco astrogeco removed the CCB:Ready Ready for discussion at the Configuration Control Board (CCB) label Apr 6, 2022
@chillfig chillfig force-pushed the add_unit_test branch 2 times, most recently from 2db6ba0 to 080dcde Compare April 7, 2022 15:08

jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
check-for-duplicates:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks for duplicates can run on ubuntu-latest

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need to do the matrix


jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
check-for-duplicates:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need to do the matrix

fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
buildtype: [debug, release]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will result in 4 runs, what if we reduce that to 3 runs by running debug with ubuntu-latest and release with both 18.04 and 20.04? @skliper and @jphickey thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might benefit from a real-time discussion. There's a handful of trades and I'd be interested in talking through it. I still don't think doing the full test and lcov are worth it at the end if the focus of this workflow is to just build and run. Building without unit tests and skipping the tests is going to save a large percentage of time.

Copy link
Contributor

@skliper skliper Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically what I'm trying to say for a unit test workflow within the CF repo, just build and test CF. If you are doing a full build and run, don't do the unit test. Doing a full build with unit tests and running all the unit tests is a big investment for very little likelihood of catching an issue due to CF changes (or even related to CF at all). I'd recommend instead to add a branch at the bundle level that does all the actively maintained apps together, and use that to do the fully integrated set of tests. I have exactly such a branch in my local cFS bundle to do integrated testing. Or instead of a branch you could have a workflow that creates that specific distribution (use a script or build into makefile, it's a simple set of changes) and runs the integrated tests... probably easier to maintain that way.

Changes enable_unit_test to true, changes ctest_output_on_failure to true,
Adds repo_name, Adds matrix method to ubuntu-18.04 and ubuntu-20.04 for build,run,test
Adds cache key for os, moves build, run, test steps into one job,
Removes redundant caches
@astrogeco
Copy link
Contributor

Closing in favor of #235. Thanks for getting things started!

@astrogeco astrogeco closed this May 2, 2022
@chillfig chillfig deleted the add_unit_test branch May 2, 2022 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit test workflow
4 participants