forked from faasm/faabric
-
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.
Merge remote-tracking branch 'upstream/main'
# Conflicts: # docker/faabric.dockerfile # examples/server.cpp
- Loading branch information
Showing
10 changed files
with
98 additions
and
101 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 |
---|---|---|
|
@@ -9,32 +9,32 @@ on: | |
|
||
defaults: | ||
run: | ||
working-directory: /code/faabric | ||
shell: bash | ||
|
||
jobs: | ||
# Cancel previous running actions for the same PR | ||
cancel_previous: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel Workflow Action | ||
uses: styfle/[email protected] | ||
|
||
conan-cache: | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-latest | ||
container: | ||
image: faasm/faabric:0.3.5 | ||
steps: | ||
- uses: faasm/conan-cache-action@v1 | ||
with: | ||
directory: /code/faabric | ||
- name: "Build dependencies to be shared by all runs" | ||
run: ./bin/inv_wrapper.sh dev.cmake -b Debug | ||
|
||
docs: | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-latest | ||
container: | ||
image: faasm/faabric:0.3.5 | ||
steps: | ||
- name: "Fetch ref" | ||
run: git fetch origin ${GITHUB_REF}:ci-branch | ||
- name: "Check out branch" | ||
run: git checkout --force ci-branch | ||
- name: "Check out code" | ||
uses: actions/checkout@v3 | ||
- name: "Build docs" | ||
run: ./bin/inv_wrapper.sh docs | ||
|
||
|
@@ -44,24 +44,14 @@ jobs: | |
container: | ||
image: faasm/faabric:0.3.5 | ||
steps: | ||
# --- Code update --- | ||
- name: "Fetch ref" | ||
run: git fetch origin ${GITHUB_REF}:ci-branch | ||
- name: "Check out branch" | ||
run: git checkout --force ci-branch | ||
- name: "Update python deps" | ||
run: | | ||
source venv/bin/activate | ||
pip3 install -r requirements.txt | ||
# --- Formatting checks --- | ||
- name: "Python formatting check" | ||
run: | | ||
source venv/bin/activate | ||
./bin/check_python.sh | ||
- name: "Run C/C++ formatting" | ||
run: ./bin/run_clang_format.sh | ||
- name: "Check C/C++ formatting changes" | ||
run: git diff --exit-code | ||
- name: "Check out code" | ||
uses: actions/checkout@v3 | ||
# We need to set the safe git directory as formatting relies on git-ls | ||
# See actions/checkout#766 | ||
- name: "Set the GH workspace as a safe git directory" | ||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
- name: "Code formatting checks" | ||
run: ./bin/inv_wrapper.sh format-code | ||
|
||
tests: | ||
if: github.event.pull_request.draft == false | ||
|
@@ -86,12 +76,10 @@ jobs: | |
image: redis | ||
steps: | ||
- uses: faasm/conan-cache-action@v1 | ||
with: | ||
directory: /code/faabric | ||
- name: "Ping redis" | ||
run: redis-cli -h redis ping | ||
- name: "Run cmake for tests" | ||
run: ./bin/inv_wrapper.sh dev.cmake --build=Debug --sanitiser ${{ matrix.sanitiser }} | ||
run: ./bin/inv_wrapper.sh dev.cmake --clean --build=Debug --sanitiser ${{ matrix.sanitiser }} | ||
- name: "Build tests" | ||
run: ./bin/inv_wrapper.sh dev.cc faabric_tests | ||
- name: "Run tests" | ||
|
@@ -104,17 +92,12 @@ jobs: | |
runs-on: ubuntu-latest | ||
env: | ||
CONAN_CACHE_MOUNT_SOURCE: ~/.conan/ | ||
defaults: | ||
run: | ||
working-directory: ${{ github.workspace }} | ||
steps: | ||
# --- Code update --- | ||
- name: "Check out code" | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
- name: "Conan cache" | ||
uses: faasm/conan-cache-action@v1 | ||
with: | ||
directory: ${{ github.workspace }} | ||
- name: "Build distributed tests" | ||
run: ./dist-test/build.sh | ||
- name: "Run the distributed tests" | ||
|
@@ -137,9 +120,8 @@ jobs: | |
- uses: faasm/conan-cache-action@v1 | ||
with: | ||
build-type: "release" | ||
directory: /code/faabric | ||
- name: "Run cmake shared" | ||
run: ./bin/inv_wrapper.sh dev.cmake --shared --build=Release | ||
run: ./bin/inv_wrapper.sh dev.cmake --clean --shared --build=Release | ||
- name: "Build Faabric shared library" | ||
run: ./bin/inv_wrapper.sh dev.cc faabric --shared | ||
- name: "Install Faabric shared library" | ||
|
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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,68 @@ | ||
from invoke import task | ||
from tasks.util.env import PROJ_ROOT | ||
from subprocess import run | ||
|
||
|
||
@task(default=True) | ||
def format(ctx, check=False): | ||
""" | ||
Format Python and C++ code | ||
""" | ||
# ---- Python formatting ---- | ||
|
||
files_to_check = ( | ||
run( | ||
'git ls-files -- "*.py"', | ||
shell=True, | ||
check=True, | ||
cwd=PROJ_ROOT, | ||
capture_output=True, | ||
) | ||
.stdout.decode("utf-8") | ||
.split("\n")[:-1] | ||
) | ||
black_cmd = [ | ||
"python3 -m black", | ||
"{}".format("--check" if check else ""), | ||
" ".join(files_to_check), | ||
] | ||
black_cmd = " ".join(black_cmd) | ||
run(black_cmd, shell=True, check=True, cwd=PROJ_ROOT) | ||
|
||
flake8_cmd = [ | ||
"python3 -m flake8", | ||
"{}".format("--format" if not check else ""), | ||
" ".join(files_to_check), | ||
] | ||
flake8_cmd = " ".join(flake8_cmd) | ||
run(flake8_cmd, shell=True, check=True, cwd=PROJ_ROOT) | ||
|
||
# ---- C/C++ formatting ---- | ||
|
||
files_to_check = ( | ||
run( | ||
'git ls-files -- "*.h" "*.cpp" "*.c"', | ||
shell=True, | ||
check=True, | ||
cwd=PROJ_ROOT, | ||
capture_output=True, | ||
) | ||
.stdout.decode("utf-8") | ||
.split("\n")[:-1] | ||
) | ||
|
||
clang_cmd = "clang-format-10 -i {}".format(" ".join(files_to_check)) | ||
run(clang_cmd, shell=True, check=True, cwd=PROJ_ROOT) | ||
|
||
# ---- Append newlines to C/C++ files if not there ---- | ||
|
||
for f in files_to_check: | ||
# Append opens the file from the end, but there is no easy way to read | ||
# just one character backwards unless you open the file as a byte | ||
# stream, which then makes it very involved to compare against the | ||
# newline character | ||
with open(f, "a+") as fh: | ||
fh.seek(0) | ||
read = fh.read() | ||
if read[-1] != "\n": | ||
fh.write("\n") |