-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 54bc505
Showing
14 changed files
with
505 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
BasedOnStyle: Google | ||
IndentWidth: 4 | ||
TabWidth: 4 | ||
UseTab: Never | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortLoopsOnASingleLine: false | ||
AlignAfterOpenBracket: AlwaysBreak | ||
BreakBeforeBraces: Mozilla | ||
IndentPPDirectives: BeforeHash | ||
ColumnLimit: 79 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Checks: "-*, | ||
bugprone-*, | ||
-bugprone-easily-swappable-parameters, | ||
misc-*, | ||
-misc-no-recursion, | ||
performance-*, | ||
portability-*, | ||
readability-*, | ||
-readability-braces-around-statements, | ||
-readability-identifier-length, | ||
-readability-magic-numbers, | ||
clang-analyzer-*, | ||
llvm-*, | ||
llvmlibc-*, | ||
-llvmlibc-restrict-system-libc-headers, | ||
" | ||
|
||
CheckOptions: | ||
- key: readability-function-cognitive-complexity.IgnoreMacros | ||
value: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
SSH_PUB_KEY: | ||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH9KSzBv3mfRAq7tOOU6/J9htV/+UTwro8q/JkO97HwO clement2104.boillot@gmail.com | ||
GH_BOT_ACC_EMAIL: | ||
69208565+github-actions[bot]@users.noreply.github.com | ||
GH_BOT_ACC_NAME: | ||
github-actions[bot] | ||
|
||
jobs: | ||
unittest: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Compiles | ||
uses: docker://epitechcontent/epitest-docker | ||
with: | ||
args: | | ||
bash -c " | ||
make -j | ||
ls ./myteams_cli ./myteams_server | ||
" | ||
fix_headers: | ||
runs-on: ubuntu-latest | ||
needs: [ unittest ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Nix cache | ||
uses: cachix/install-nix-action@v20 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-23.05 | ||
|
||
- name: Setup Git | ||
run: | | ||
git config --local user.email $GH_BOT_ACC_EMAIL | ||
git config --local user.name $GH_BOT_ACC_NAME | ||
git fetch --unshallow origin | ||
- name: Fix headers | ||
run: | | ||
nix run github:drawpitech/EpiHeader -- --name "panoramix" | ||
git add . | ||
git commit -m "Fix headers" || echo "nothing to commit." | ||
git push origin || echo "nothing to push." | ||
coding_style: | ||
runs-on: ubuntu-latest | ||
needs: [ unittest ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install SSH key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
known_hosts: $SSH_PUB_KEY | ||
|
||
- name: Nix cache | ||
uses: cachix/install-nix-action@v20 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-23.05 | ||
|
||
- name: Run coding style | ||
run: | | ||
nix run github:Sigmapitech/cs src | ||
mirror: | ||
needs: [ unittest, fix_headers, coding_style ] | ||
if: ${{ !github.event.pull_request }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install SSH key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
known_hosts: $SSH_PUB_KEY | ||
|
||
- name: Push to epitech | ||
run: | | ||
git fetch --unshallow origin | ||
git remote add epitech "${{ secrets.MIRROR_REPO }}" | ||
git push epitech --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Binaries | ||
*.out | ||
/panoramix | ||
/asan | ||
/prof | ||
/unit_tests | ||
|
||
# Compilation | ||
.build/ | ||
*.a | ||
*.o | ||
*.d | ||
*.so | ||
/result | ||
.cache/ | ||
|
||
# Editors junk | ||
*~ | ||
\#*# | ||
*.swp | ||
*.swo | ||
|
||
# Reports | ||
core.* | ||
*.log | ||
*.gcda | ||
*.gcno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
## | ||
## EPITECH PROJECT, 2024 | ||
## panoramix | ||
## File description: | ||
## Makefile | ||
## | ||
|
||
# ↓ Basic variables | ||
CC := gcc | ||
CFLAGS := -std=gnu11 -W -Wall -Wextra -Wunused -Wpedantic | ||
CFLAGS += -Wundef -Wshadow -Wcast-align | ||
CFLAGS += -Wstrict-prototypes -Wmissing-prototypes | ||
CFLAGS += -Waggregate-return -Wcast-qual | ||
CFLAGS += -Wunreachable-code | ||
CFLAGS += -U_FORTIFY_SOURCE | ||
CFLAGS += -iquote ./src | ||
LDFLAGS := | ||
|
||
# ↓ Binaries | ||
NAME := panoramix | ||
TEST_NAME := unit_tests | ||
ASAN_NAME := asan | ||
PROF_NAME := prof | ||
|
||
# Source files | ||
SRC := $(shell find ./src -name '*.c') | ||
|
||
# Tests files | ||
VPATH += tests | ||
TEST_SRC := $(subst ./src/main.c,,$(SRC)) | ||
TEST_SRC += $(shell find ./tests -name '*.c') | ||
|
||
# ↓ Objects | ||
BUILD_DIR := .build | ||
OBJ := $(SRC:%.c=$(BUILD_DIR)/source/%.o) | ||
TEST_OBJ := $(TEST_SRC:%.c=$(BUILD_DIR)/tests/%.o) | ||
ASAN_OBJ := $(SRC:%.c=$(BUILD_DIR)/asan/%.o) | ||
PROF_OBJ := $(SRC:%.c=$(BUILD_DIR)/prof/%.o) | ||
|
||
# ↓ Dependencies for headers | ||
DEPS_FLAGS := -MMD -MP | ||
DEPS := $(OBJ:.o=.d) | ||
TEST_DEPS := $(TEST_OBJ:.o=.d) | ||
ASAN_DEPS := $(ASAN_OBJ:.o=.d) | ||
PROF_DEPS := $(PROF_OBJ:.o=.d) | ||
|
||
DIE := exit 1 | ||
# ↓ Colors | ||
ECHO := echo -e | ||
C_RESET := \033[00m | ||
C_BOLD := \e[1m | ||
C_RED := \e[31m | ||
C_GREEN := \e[32m | ||
C_YELLOW := \e[33m | ||
C_BLUE := \e[34m | ||
C_PURPLE := \e[35m | ||
C_CYAN := \e[36m | ||
|
||
.PHONY: all | ||
all: $(NAME) | ||
|
||
# ↓ Compiling | ||
$(BUILD_DIR)/source/%.o: %.c | ||
@ mkdir -p $(dir $@) | ||
@ $(ECHO) "[${C_BOLD}${C_RED}CC${C_RESET}] $^" | ||
@ $(CC) -o $@ -c $< $(LDFLAGS) $(CFLAGS) $(DEPS_FLAGS) || $(DIE) | ||
|
||
$(NAME): $(OBJ) | ||
@ $(ECHO) "[${C_BOLD}${C_YELLOW}CC${C_RESET}] ${C_GREEN}$@${C_RESET}" | ||
@ $(CC) -o $@ $^ $(LDFLAGS) || $(DIE) | ||
|
||
# ↓ Unit tests | ||
$(BUILD_DIR)/tests/%.o: %.c | ||
@ mkdir -p $(dir $@) | ||
@ $(ECHO) "[${C_BOLD}${C_RED}CC${C_RESET}] $^" | ||
@ $(CC) -o $@ -c $< $(LDFLAGS) $(CFLAGS) $(DEPS_FLAGS) || $(DIE) | ||
|
||
ifneq ($(NO_COV), 1) | ||
$(TEST_NAME): LDFLAGS += -g3 --coverage | ||
endif | ||
$(TEST_NAME): LDFLAGS += -lcriterion | ||
$(TEST_NAME): $(TEST_OBJ) | ||
@ $(ECHO) "[${C_BOLD}${C_YELLOW}CC${C_RESET}] ${C_GREEN}$@${C_RESET}" | ||
@ $(CC) -o $@ $^ $(LDFLAGS) || $(DIE) | ||
|
||
.PHONY: tests_run | ||
tests_run: $(TEST_NAME) | ||
@-./$< | ||
|
||
# ↓ Asan | ||
$(BUILD_DIR)/asan/%.o: %.c | ||
@ mkdir -p $(dir $@) | ||
@ $(ECHO) "[${C_BOLD}${C_RED}CC${C_RESET}] $^" | ||
@ $(CC) -o $@ -c $< $(LDFLAGS) $(CFLAGS) $(DEPS_FLAGS) || $(DIE) | ||
|
||
$(ASAN_NAME): LDFLAGS += -fsanitize=address,leak,undefined -g3 | ||
$(ASAN_NAME): LDFLAGS += -fanalyzer | ||
$(ASAN_NAME): CFLAGS += -D DEBUG_MODE | ||
$(ASAN_NAME): $(ASAN_OBJ) | ||
@ $(ECHO) "[${C_BOLD}${C_YELLOW}CC${C_RESET}] ${C_GREEN}$@${C_RESET}" | ||
@ $(CC) -o $@ $^ $(LDFLAGS) || $(DIE) | ||
|
||
# ↓ Profiler | ||
$(BUILD_DIR)/prof/%.o: %.c | ||
@ mkdir -p $(dir $@) | ||
@ $(ECHO) "[${C_BOLD}${C_RED}CC${C_RESET}] $^" | ||
@ $(CC) -o $@ -c $< $(LDFLAGS) $(CFLAGS) $(DEPS_FLAGS) || $(DIE) | ||
|
||
$(PROF_NAME): LDFLAGS += -pg | ||
$(PROF_NAME): $(PROF_OBJ) | ||
@ $(ECHO) "[${C_BOLD}${C_YELLOW}CC${C_RESET}] ${C_GREEN}$@${C_RESET}" | ||
@ $(CC) -o $@ $^ $(LDFLAGS) || $(DIE) | ||
|
||
# ↓ Coverage | ||
.PHONY: cov | ||
cov: GCOVR_FLAGS := --exclude bonus/ | ||
cov: GCOVR_FLAGS += --exclude tests/ | ||
cov: | ||
@ gcovr $(GCOVR_FLAGS) | ||
@ gcovr $(GCOVR_FLAGS) --branches | ||
|
||
# ↓ Cleaning | ||
.PHONY: clean | ||
clean: | ||
@ $(RM) -r $(BUILD_DIR) | ||
|
||
.PHONY: fclean | ||
fclean: clean | ||
@ $(RM) $(NAME) $(TEST_NAME) $(ASAN_NAME) $(PROF_NAME) | ||
|
||
.PHONY: re | ||
.NOTPARALLEL: re | ||
re: fclean all | ||
|
||
-include $(DEPS) | ||
-include $(TEST_DEPS) | ||
-include $(ASAN_DEPS) | ||
-include $(PROF_DEPS) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[reports] | ||
merge = "multiplier" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.