11# .github/workflows/ci.yml
22
3- # 1. Workflow Name: Give a name to your workflow.
3+ # 1. Workflow Name
44name : C++ CI for mygit
55
6- # 2. Triggers: Define when the workflow should run.
6+ # 2. Triggers
77on :
8- # Run on every push to the 'main' or 'master' branch.
98 push :
109 branches : [ "main", "master" ]
11- # Run on every pull request targeting the 'main' or 'master' branch.
1210 pull_request :
1311 branches : [ "main", "master" ]
1412
15- # 3. Jobs: Define a sequence of tasks to be executed.
13+ # 3. Jobs
1614jobs :
17- # We will have a single job called 'build-and-test'.
1815 build-and-test :
19- # 4. Runner: Specify the type of machine to run the job on.
20- # We use the latest version of Ubuntu, as your dependencies are for Debian/Ubuntu.
16+ # 4. Runner
2117 runs-on : ubuntu-latest
2218
23- # 5. Steps: A sequence of tasks that make up the job.
19+ # 5. Steps
2420 steps :
25- # Step 1: Check out your repository's code.
26- # This downloads your code into the runner.
2721 - name : Checkout repository
2822 uses : actions/checkout@v4
2923
30- # Step 2: Install system dependencies using apt-get.
31- # This corresponds to the 'Prerequisites' section of your README.
3224 - name : Install system dependencies
3325 run : |
3426 sudo apt-get update
3527 sudo apt-get install -y build-essential cmake libssl-dev zlib1g-dev libcurl4-openssl-dev
3628
37- # Step 3: Install the 'cpr' library from source.
38- # This automates the manual installation steps from your README.
3929 - name : Install cpr library
4030 run : |
4131 git clone https://github.com/libcpr/cpr.git
@@ -45,19 +35,17 @@ jobs:
4535 cmake --build .
4636 sudo cmake --install .
4737
48- # Step 4: Make build and test scripts executable.
49- # This is equivalent to running 'chmod +x'.
5038 - name : Make scripts executable
5139 run : |
5240 chmod +x build.sh
5341 chmod +x tests/*.sh
5442
55- # Step 5: Build the 'mygit' executable.
56- # This runs your existing build script.
5743 - name : Build the project
5844 run : ./build.sh
5945
60- # Step 6: Run the integration tests.
61- # This runs your existing test suite to validate the build.
46+ # CORRECTED STEP: Run tests from within the 'tests' directory
6247 - name : Run tests
63- run : ./tests/run_all_tests.sh
48+ # This tells the runner to execute the following command
49+ # inside the 'tests' directory.
50+ working-directory : ./tests
51+ run : ./run_all_tests.sh
0 commit comments