Skip to content

Test example with math functions in C and CI with GitHub Actions.

License

Notifications You must be signed in to change notification settings

jotavare/github-actions-overview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABOUT

This repository contains basic math functions (add, subtract, multiply, divide) written in C and a test example to ensure their correctness. It also includes a GitHub Actions workflow for continuous integration (CI) to automatically compile and test the code.

FILES

  • math.c: Contains the implementation of the math functions.
  • math.h: Header file declaring the math functions.
  • test_math.c: Contains test cases to verify the functionality of the math functions.
  • .github/workflows/ci.yml: GitHub Actions workflow configuration for continuous integration (CI).

FUNCTIONS

int add(int a, int b);
int subtract(int a, int b);
int multiply(int a, int b);
double divide(int a, int b);

TEST LOCALLY

To compile and run the tests locally, you need to have GCC installed.

  1. Clone the repository:

    git clone https://github.com/yourusername/math-functions.git
    cd math-functions
  2. Compile the code:

    gcc -o test_math math.c test_math.c
  3. Run the tests:

    ./test_math

If all tests pass, you will see the message:

All tests passed

CI WORKFLOW STEPS

  1. Checkout Code: Checks out the repository code.
  2. Install Dependencies: Installs GCC.
  3. Compile: Compiles the math.c and test_math.c files.
  4. Run Tests: Runs the compiled test executable.

The tests are run automatically on every push and pull request to the repository. Other events that trigger workflows are available here.

CONTRIBUTING

If you find any issues or have suggestions for improvements, feel free to fork the repository and open an issue or submit a pull request.

LICENSE

This project is available under the MIT License. For further details, please refer to the LICENSE file.

About

Test example with math functions in C and CI with GitHub Actions.

Topics

Resources

License

Stars

Watchers

Forks

Languages