Skip to content

Commit 915a371

Browse files
committed
Refactoring the workflow file
1 parent dc5843c commit 915a371

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

.github/workflows/brew.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1-
brew install postgresql
2-
brew install pkg-config
1+
#!/bin/bash
2+
3+
# Check if a package is already installed via Homebrew, then skip
4+
check_and_install() {
5+
if ! brew list $1 &>/dev/null; then
6+
echo "Installing $1..."
7+
brew install $1
8+
else
9+
echo "$1 is already installed"
10+
fi
11+
}
12+
13+
# Install packages if they don't exist
14+
check_and_install postgresql
15+
check_and_install pkg-config

.github/workflows/sonarcloud.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# Workflow for building and testing the project
1+
# Backtesting C++ Workflow
2+
# To build, test and perform SonarCloud analysis
23
name: Build
34

4-
# Define when the workflow should run
55
on:
66
push:
77
branches:
88
- main # Trigger on pushes to main branch
99
pull_request:
1010
types:
1111
- opened # When PR is first created
12-
- edited # When PR description/title is edited
1312
- synchronize # When new commits are pushed to the PR
1413
- reopened # When PR is reopened after being closed
1514

@@ -37,8 +36,8 @@ jobs:
3736
- name: Install dependencies
3837
run: bash ./.github/workflows/brew.sh
3938

40-
# Step 4: Build project libraries
41-
- name: Build libraries
39+
# Step 4: Build project external libraries
40+
- name: Build C++ Libraries
4241
run: bash ./.github/workflows/build.sh
4342

4443
# Step 5: Configure Xcode version
@@ -90,10 +89,10 @@ jobs:
9089
run: |
9190
g++ --version
9291
cmake --version
93-
- name: Build libraries
92+
- name: Build C++ Libraries
9493
run: >
9594
bash ./.github/workflows/build.sh
96-
- name: Set up Python 3.8 for gcovr
95+
- name: Install Python 3.12 for gcovr
9796
uses: actions/setup-python@v5
9897
with:
9998
python-version: 3.12

0 commit comments

Comments
 (0)