mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
chore: Refactor the ci in order to dispatch dependeding of file changes
This commit is contained in:
18
.github/workflows/build_on_pr_push.yml
vendored
18
.github/workflows/build_on_pr_push.yml
vendored
@@ -1,18 +0,0 @@
|
||||
# Trigger an AWS build each time commits are pushed to a pull request.
|
||||
name: PR AWS build trigger
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: mshick/add-pr-comment@v2
|
||||
with:
|
||||
allow-repeats: true
|
||||
message: |
|
||||
@slab-ci compiler-cpu-build
|
||||
@slab-ci compiler-gpu-build
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Compiler Build and Test (CPU)
|
||||
name: Compiler - Build and Test (CPU)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Compiler Build and Test (GPU)
|
||||
name: Compiler - Build and Test (GPU)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -1,41 +1,38 @@
|
||||
name: Check format and run linters
|
||||
name: Compiler - Compliance
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: main
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
FormattingAndLinting:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
|
||||
- name: Format with clang-format (Cpp)
|
||||
run: sudo apt install moreutils && .github/workflows/scripts/format_cpp.sh
|
||||
run: |
|
||||
sudo apt install moreutils
|
||||
cd compilers/concrete-compiler/compiler
|
||||
./scripts/format_cpp.sh
|
||||
- name: Format with cmake-format (Cmake)
|
||||
run: pip3 install cmakelang && .github/workflows/scripts/format_cmake.sh
|
||||
run: |
|
||||
pip3 install cmakelang
|
||||
cd compilers/concrete-compiler/compiler
|
||||
./scripts/format_cmake.sh
|
||||
- name: Format with black (Python)
|
||||
run: |
|
||||
cd compiler
|
||||
cd compilers/concrete-compiler/compiler
|
||||
pip install -r lib/Bindings/Python/requirements_dev.txt
|
||||
make check-python-format
|
||||
- name: Lint with pylint (Python)
|
||||
run: |
|
||||
cd compiler
|
||||
cd compilers/concrete-compiler/compiler
|
||||
# compiler requirements to lint
|
||||
pip install numpy
|
||||
make python-lint
|
||||
- name: Format with rustfmt (Rust)
|
||||
run: |
|
||||
cd compiler
|
||||
cd compilers/concrete-compiler/compiler
|
||||
make check-rust-format
|
||||
- name: Linelint
|
||||
uses: fernandrone/linelint@0.0.4
|
||||
id: linelint
|
||||
|
||||
CheckLicense:
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -2,10 +2,12 @@
|
||||
name: MacOsBuild
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
workflow_call:
|
||||
secrets:
|
||||
CONCRETE_CI_SSH_PRIVATE:
|
||||
required: true
|
||||
CONCRETE_ACTIONS_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
BuildAndTestMacOS:
|
||||
@@ -60,7 +62,7 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
set -e
|
||||
cd compiler
|
||||
cd compilers/concrete-compiler/compiler
|
||||
echo "Debug: ccache statistics (prior to the build):"
|
||||
ccache -s
|
||||
make Python3_EXECUTABLE=$(which python3.10) all run-check-tests python-package
|
||||
@@ -71,7 +73,7 @@ jobs:
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
set -e
|
||||
cd compiler
|
||||
cd compilers/concrete-compiler/compiler
|
||||
echo "Debug: ccache statistics (prior to the tests):"
|
||||
ccache -s
|
||||
export CONCRETE_COMPILER_DATAFLOW_EXECUTION_ENABLED=OFF
|
||||
60
.github/workflows/main.yml
vendored
Normal file
60
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# Trigger an AWS build each time commits are pushed to a pull request.
|
||||
name: Main
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
# This jobs outputs for each modules of our mono-repo if it changed,
|
||||
# in order to launch jobs only for the changed modules
|
||||
file-change:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
outputs:
|
||||
compiler: ${{ steps.compiler.outputs.any_changed }}
|
||||
optimizer: ${{ steps.optimizer.outputs.any_changed }}
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.CONCRETE_ACTIONS_TOKEN }}
|
||||
|
||||
- name: Get changed files in the concrete-compiler directory
|
||||
id: compiler
|
||||
uses: tj-actions/changed-files@7a453ffa2eb31a7e84f3281f88ef6d774c4d807d
|
||||
with:
|
||||
files: compilers/concrete-compiler
|
||||
|
||||
- name: Get changed files in the concrete-optimizer directory
|
||||
id: optimizer
|
||||
uses: tj-actions/changed-files@7a453ffa2eb31a7e84f3281f88ef6d774c4d807d
|
||||
with:
|
||||
files: compilers/concrete-optimizer
|
||||
|
||||
#################################################
|
||||
# Compiler jobs #################################
|
||||
compiler-compliance:
|
||||
needs: file-change
|
||||
if: needs.file-change.outputs.compiler == 'true'
|
||||
uses: ./.github/workflows/compiler_format_and_linting.yml
|
||||
|
||||
compiler-aws-tests:
|
||||
needs: file-change
|
||||
if: needs.file-change.outputs.compiler == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Launch compiler test on AWS using Slab
|
||||
uses: mshick/add-pr-comment@v2
|
||||
with:
|
||||
allow-repeats: true
|
||||
message: |
|
||||
@slab-ci compiler-cpu-build
|
||||
@slab-ci compiler-gpu-build
|
||||
|
||||
compiler-macos-tests:
|
||||
needs: file-change
|
||||
if: needs.file-change.outputs.compiler == 'true'
|
||||
uses: ./.github/workflows/compiler_macos_build_and_test.yml
|
||||
secrets: inherit
|
||||
12
.github/workflows/scripts/format_cmake.sh
vendored
12
.github/workflows/scripts/format_cmake.sh
vendored
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
cmake-format -i compiler/CMakeLists.txt -c compiler/.cmake-format-config.py
|
||||
|
||||
find ./compiler/{include,lib,src,tests} -type f -name "CMakeLists.txt" | xargs -I % sh -c 'cmake-format -i % -c compiler/.cmake-format-config.py'
|
||||
|
||||
# show changes if any
|
||||
git --no-pager diff
|
||||
# fail if there is a diff, success otherwise
|
||||
git diff | ifne exit 1
|
||||
12
.github/workflows/scripts/format_cpp.sh
vendored
12
.github/workflows/scripts/format_cpp.sh
vendored
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
EXCLUDE_DIRS="-path ./compiler/include/boost-single-header -prune -o"
|
||||
|
||||
find ./compiler/{include,lib,src,tests} $EXCLUDE_DIRS -iregex '^.*\.\(cpp\|cc\|h\|hpp\)$' -print | xargs clang-format -i -style='file'
|
||||
|
||||
# show changes if any
|
||||
git --no-pager diff
|
||||
# fail if there is a diff, success otherwise
|
||||
git diff | ifne exit 1
|
||||
@@ -81,10 +81,8 @@ ExternalProject_Add(
|
||||
|
||||
add_library(concrete_optimizer STATIC ${CONCRETE_OPTIMIZER_DIR}/concrete-optimizer-cpp/src/cpp/concrete-optimizer.cpp)
|
||||
|
||||
target_link_libraries(concrete_optimizer PRIVATE
|
||||
pthread m dl
|
||||
"${CONCRETE_OPTIMIZER_DIR}/target/release/libconcrete_optimizer_cpp.a"
|
||||
)
|
||||
target_link_libraries(concrete_optimizer PRIVATE pthread m dl
|
||||
"${CONCRETE_OPTIMIZER_DIR}/target/release/libconcrete_optimizer_cpp.a")
|
||||
install(TARGETS concrete_optimizer EXPORT concrete_optimizer)
|
||||
install(EXPORT concrete_optimizer DESTINATION "./")
|
||||
|
||||
@@ -92,7 +90,6 @@ add_dependencies(concrete_optimizer concrete_optimizer_rust)
|
||||
# TODO - Remove the global include directory
|
||||
include_directories(${CONCRETE_OPTIMIZER_INCLUDE_DIR})
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------
|
||||
# Concrete Backends
|
||||
# -------------------------------------------------------------------------------
|
||||
|
||||
12
compilers/concrete-compiler/compiler/scripts/format_cmake.sh
Executable file
12
compilers/concrete-compiler/compiler/scripts/format_cmake.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
cmake-format -i CMakeLists.txt -c .cmake-format-config.py
|
||||
|
||||
find ./{include,lib,src,tests} -type f -name "CMakeLists.txt" | xargs -I % sh -c 'cmake-format -i % -c .cmake-format-config.py'
|
||||
|
||||
# show changes if any
|
||||
git --no-pager diff
|
||||
# fail if there is a diff, success otherwise
|
||||
git diff | ifne exit 1
|
||||
12
compilers/concrete-compiler/compiler/scripts/format_cpp.sh
Executable file
12
compilers/concrete-compiler/compiler/scripts/format_cpp.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
EXCLUDE_DIRS="-path ./include/boost-single-header -prune -o"
|
||||
|
||||
find ./{include,lib,src,tests} $EXCLUDE_DIRS -iregex '^.*\.\(cpp\|cc\|h\|hpp\)$' -print | xargs clang-format -i -style='file'
|
||||
|
||||
# show changes if any
|
||||
git --no-pager diff
|
||||
# fail if there is a diff, success otherwise
|
||||
git diff | ifne exit 1
|
||||
Reference in New Issue
Block a user