Skip to content

Commit

Permalink
Merge pull request #2 from slashdevops/first-implementation
Browse files Browse the repository at this point in the history
feat: add pipeline
  • Loading branch information
christiangda authored Mar 31, 2024
2 parents 7753361 + 8210830 commit b95a3ad
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/c-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: C CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install -y gcc-13 valgrind
- name: Set up gcc-13
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 90
- name: Check versions
run: |
gcc --version
make --version
- name: make build
run: make build

- name: make test
run: make test

# - name: make memcheck
# run: make memcheck


3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"string_view": "c",
"unordered_map": "c",
"vector": "c",
"format": "c"
"format": "c",
"__node_handle": "c"
},
}
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH)))

# Compiler and linker flags
CFLAGS = -Wall -Wextra -Werror -O2 -g -std=c2x -pedantic # Compiler flags
CFLAGS = -Wall -Wextra -Werror -Wunused -O2 -g -std=c2x -pedantic # Compiler flags
LDFLAGS = -shared # Linker flags (shared library) (change to -static for static library)

SRC_DIR := src
Expand Down Expand Up @@ -91,12 +91,12 @@ $(LIB_DIR):

##@ Test commands
.PHONY: test
test: clean all $(TEST_APP) ## Run tests
test: clean build $(TEST_APP) ## Run tests
@echo "Running tests..."
./$(BUILD_DIR)/$(TEST_APP)

.PHONY: memcheck
memcheck: clean all test ## Run tests and check for memory leaks
memcheck: test ## Run tests and check for memory leaks
@echo "Running tests with valgrind..."
leaks --atExit -- ./$(BUILD_DIR)/$(TEST_APP)

Expand Down

0 comments on commit b95a3ad

Please sign in to comment.