Skip to content

Commit 06b4768

Browse files
committed
Add GitHub Actions CI workflow
1 parent e1f4161 commit 06b4768

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# .github/workflows/ci.yml
2+
3+
# 1. Workflow Name: Give a name to your workflow.
4+
name: C++ CI for mygit
5+
6+
# 2. Triggers: Define when the workflow should run.
7+
on:
8+
# Run on every push to the 'main' or 'master' branch.
9+
push:
10+
branches: [ "main", "master" ]
11+
# Run on every pull request targeting the 'main' or 'master' branch.
12+
pull_request:
13+
branches: [ "main", "master" ]
14+
15+
# 3. Jobs: Define a sequence of tasks to be executed.
16+
jobs:
17+
# We will have a single job called 'build-and-test'.
18+
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.
21+
runs-on: ubuntu-latest
22+
23+
# 5. Steps: A sequence of tasks that make up the job.
24+
steps:
25+
# Step 1: Check out your repository's code.
26+
# This downloads your code into the runner.
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
# Step 2: Install system dependencies using apt-get.
31+
# This corresponds to the 'Prerequisites' section of your README.
32+
- name: Install system dependencies
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y build-essential cmake libssl-dev zlib1g-dev libcurl4-openssl-dev
36+
37+
# Step 3: Install the 'cpr' library from source.
38+
# This automates the manual installation steps from your README.
39+
- name: Install cpr library
40+
run: |
41+
git clone https://github.com/libcpr/cpr.git
42+
cd cpr
43+
mkdir build && cd build
44+
cmake .. -DCPR_USE_SYSTEM_CURL=ON
45+
cmake --build .
46+
sudo cmake --install .
47+
48+
# Step 4: Make build and test scripts executable.
49+
# This is equivalent to running 'chmod +x'.
50+
- name: Make scripts executable
51+
run: |
52+
chmod +x build.sh
53+
chmod +x tests/*.sh
54+
55+
# Step 5: Build the 'mygit' executable.
56+
# This runs your existing build script.
57+
- name: Build the project
58+
run: ./build.sh
59+
60+
# Step 6: Run the integration tests.
61+
# This runs your existing test suite to validate the build.
62+
- name: Run tests
63+
run: ./tests/run_all_tests.sh

0 commit comments

Comments
 (0)