11# C-programming-pre-lab <!-- omit in toc -->
22
3+ [ ![ Tests] ( ../../workflows/gtest/badge.svg )] ( ../../actions?query=workflow%3A"gtest" )
4+ [ ![ Main Valgrind] ( ../../workflows/main-valgrind/badge.svg )] ( ../../actions?query=workflow%3A"main-valgrind" )
5+ [ ![ Test Valgrind] ( ../../workflows/test-valgrind/badge.svg )] ( ../../actions?query=workflow%3A"test-valgrind" )
6+
7+
38This is a pre-lab to get you started started on compiling and running C programs
49and using ` valgrind ` to identify memory leaks. The tools have been installed on the lab computers.
510Be aware that if you want to use your own machine you will have to go through quite a few extra steps to
@@ -9,6 +14,7 @@ install the `gtest` test suite and the `valgrind` memory leak detection program
914 - [ Compiling and running a C program] ( #compiling-and-running-a-c-program )
1015 - [ Compiling and running the tests] ( #compiling-and-running-the-tests )
1116 - [ Using valgrind to find memory leaks] ( #using-valgrind-to-find-memory-leaks )
17+ - [ GitHub Actions and badges] ( #github-actions-and-badges )
1218- [ What to do] ( #what-to-do )
1319
1420## Background
@@ -324,6 +330,42 @@ Once you have everything happy, you will hopefully get a line like:
324330
325331at the end indicating that you now have 0 errors and all is well.
326332
333+ ## GitHub Actions and badges
334+
335+ We've set up GitHub Actions to automatically run three checks on your
336+ code every time you push changes to GitHub:
337+
338+ - The code compiles and the tests pass.
339+ - Valgrind returns no errors when running the ` main ` function.
340+ - Valgrind returns no errors when running the test code.
341+
342+ You should be able to see the status of these in a commit or pull request
343+ in GitHub. Here, for example, is a status from a pull request:
344+
345+ ![ Screen grab of GitHub Action status showing success, failure, and pending] ( images/GitHub_action_status.png )
346+
347+ We have all three possible status indicators here:
348+
349+ - The red x indicates a failing check
350+ - The orange dot indicates a check that's still in progress
351+ - The green checkmark indicates a check that passed
352+
353+ When you initially check out the code for the pre-lab, the ` gtest `
354+ check should pass (the tests pass), but the other two should fail
355+ because there are memory issues with both the ` check_whitespace `
356+ ` main() ` and the tests.
357+
358+ We have also added three badges to the top of this README that indicate
359+ the status of each of these three status checks. The tests badge should
360+ be green from the beginning (and stay green throughout the process).
361+ The two ` valgrind ` badges will both start off red (because the ` valgrind `
362+ checks fail initially) but turn green after you've fixed the memory
363+ management issue.
364+
365+ > :warning : The badges won't update instantly, so don't fret if
366+ > your status checks are green but the badge is still red. That
367+ > should update in a few minutes.
368+
327369## What to do
328370
329371- [ ] Compile the program ` check_whitespace `
0 commit comments