From df47771872312db3ea49bb6e38e7db5480e0b302 Mon Sep 17 00:00:00 2001 From: Tifa <62847935+Tiphereth-A@users.noreply.github.com> Date: Wed, 24 Apr 2024 19:03:41 +0800 Subject: [PATCH] ci: fix --- .github/workflows/codeql.yml | 17 ++++++++-------- .github/workflows/release.yml | 4 ++++ .github/workflows/verify.yml | 3 +++ Makefile | 37 +++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 7e856faf7..b14a706ac 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -17,7 +17,7 @@ on: pull_request: branches: [ "master" ] schedule: - - cron: '28 14 * * 6' + - cron: '0 0 * * 6' jobs: analyze: @@ -44,8 +44,8 @@ jobs: fail-fast: false matrix: include: - # - language: c-cpp - # build-mode: autobuild + - language: c-cpp + build-mode: manual - language: python build-mode: none # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' @@ -73,6 +73,10 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality + - name: Autobuild + if: matrix.build-mode == 'autobuild' + uses: github/codeql-action/autobuild@v3 + # If the analyze step fails for one of the languages you are analyzing with # "We were unable to automatically build your code", modify the matrix above # to set the build mode to "manual" for that language. Then modify this step @@ -81,12 +85,7 @@ jobs: # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - if: matrix.build-mode == 'manual' run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 + make all - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb640594b..fddcdd981 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,10 @@ on: push: branches: - master + paths: + - '**.hpp' + - '**.cpp' + - '**.tex' pull_request: branches: - master diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index e999d449f..176a8f6a0 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -3,6 +3,9 @@ on: push: branches: - master + paths: + - '**.hpp' + - '**.cpp' pull_request: branches: - master diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..5510fdbd9 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# AIGC + +# Compiler +CXX := g++-12 +# Compiler flags +CXXFLAGS := -std=gnu++20 -Wall -Wextra + +# Directories +SRCDIRS := src/test_tinplate src/test_cpverifier +# Source files +SOURCES := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*/*.cpp)) +# Object files +OBJECTS := $(SOURCES:.cpp=.o) + +# Output directory +OUTDIR := bin +# Target executable +TARGET := $(OUTDIR)/main + +# Rule to build the target executable +$(TARGET): $(OBJECTS) + @mkdir -p $(OUTDIR) + $(CXX) $(CXXFLAGS) $^ -o $@ + +# Rule to compile each source file into object files +%.o: %.cpp + $(CXX) $(CXXFLAGS) -c $< -o $@ + +# Phony targets +.PHONY: all clean + +# Target to build all +all: $(TARGET) + +# Target to clean the generated files +clean: + rm -rf $(OUTDIR) $(OBJECTS)