Skip to content

Commit 59003d7

Browse files
authored
Update ci.yml
1 parent 7708094 commit 59003d7

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
name: C++ Build
1+
name: C++ CI and Codecov for Multiple Projects
22

3-
# Trigger the workflow on pushes and pull requests to specific branches
43
on:
54
push:
65
branches:
@@ -10,26 +9,35 @@ on:
109
- main
1110

1211
jobs:
13-
build:
14-
# This job will run on the latest version of Ubuntu
12+
# Job 1: Build and test projects under 'data-structures'
13+
data-structures-build-and-test:
1514
runs-on: ubuntu-latest
1615

17-
# Steps define the actions within the job
16+
strategy:
17+
matrix:
18+
# Add your projects from 'data-structures'
19+
project: [LinkedList, DoublyLinkedList]
20+
1821
steps:
19-
# 1. Checkout the code from the repository
22+
# Step 1: Checkout the repository
2023
- name: Checkout code
2124
uses: actions/checkout@v2
2225

23-
# 2. Install dependencies (e.g., for C++, you might want to install compilers or build tools)
26+
# Step 2: Install dependencies (C++ tools)
2427
- name: Install dependencies
25-
run: sudo apt-get update && sudo apt-get install -y g++ make cmake
28+
run: sudo apt-get install -y gcc g++ make cmake lcov
2629

27-
# 3. Build the project
28-
- name: Build LinkedList
30+
# Step 3: Build and test each project in 'data-structures'
31+
- name: Build and test project
2932
run: |
30-
cd data-structures/linked-list
33+
# Navigate to the correct project directory
34+
cd data-structures/${{ matrix.project }}
35+
# Run the build script for the project
3136
./build.sh
37+
./bin/test_${{ matrix.project }}
3238
33-
# 4. Run tests
34-
- name: Run test_LinkedList
35-
run: ./data-structures/linked-list/bin/test_linkedlist
39+
# Step 4: Upload coverage to Codecov
40+
- name: Upload coverage to Codecov
41+
run: bash <(curl -s https://codecov.io/bash)
42+
env:
43+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)