Skip to content
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6caf6d4
Analysis workflow (#783)
G-D-Petrov Aug 23, 2023
7ebe6ec
Fix some tests
Aug 23, 2023
f87f336
try to build with a different python version
Aug 23, 2023
53bebef
try to build with a different python version
Aug 23, 2023
5764fd3
Try with older python
Aug 24, 2023
47859c8
Try to change python folder
Aug 24, 2023
6265579
Try to change python folder
Aug 24, 2023
fae46a4
Try to change python folder
Aug 24, 2023
856f1cf
Try to change python folder
Aug 24, 2023
9b87fba
Try setup-python
Aug 24, 2023
a67efb8
Try setup-python
Aug 24, 2023
40b5e94
Try setup-python
Aug 24, 2023
bd0363f
Try setup-python
Aug 24, 2023
4294571
Try to add the lib and include paths to the build cmake
Aug 24, 2023
7bad8c0
Try to add the lib and include paths to the build cmake
Aug 24, 2023
93dc0b8
Try withour requiring python dev"
Aug 24, 2023
380829a
Try to use 3.6 but make it think that it is 3.11
Aug 24, 2023
27a95f3
Add a shell for composite action
Aug 24, 2023
ffc5c41
Add a shell
Aug 24, 2023
db81853
Add a shell
Aug 24, 2023
857436b
Move back to python 3.6 to test the other changes
Aug 24, 2023
cb5dee5
Move back to python 3.6 to test the other changes
Aug 24, 2023
2823aa9
Remove persistent tests for now
Aug 24, 2023
b18910c
Address PR comments
Aug 25, 2023
38fb157
Add a scheduled trigger; Revert change to test
Aug 25, 2023
6803e76
Remove unnecessary definition
Aug 25, 2023
6c841cc
Revert unnecessary changes
Aug 25, 2023
2e6ddab
Revert unnecessary changes
Aug 25, 2023
0d9ad36
Fix path to requirements file
Aug 25, 2023
e813d9f
Bring back compaction fix
Aug 25, 2023
ae079f2
Bring back compaction fix
Aug 28, 2023
b3e1d82
Try to remove the static requirements.txt
Aug 30, 2023
8bdb691
FIx path to setup.cfg
Aug 30, 2023
f9ed8ef
Revert changes that were needed for testing
Aug 31, 2023
ee66ab9
Merge branch 'master' into analysis_workflow_consolidated
G-D-Petrov Aug 31, 2023
79f964a
Fix problem with coverage cache
Aug 31, 2023
b57507d
Merge branch 'analysis_workflow_consolidated' of https://github.com/m…
Aug 31, 2023
87417ac
Disable test_stress_version_map_compact test in code coverage
Sep 1, 2023
3064fe0
Revert the on push trigger
Sep 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 195 additions & 0 deletions .github/workflows/analysis_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
name: Build with analysis tools
on:
workflow_dispatch:
inputs:
run:
type: boolean

schedule: # Schdeule the job to run at 12 a.m. daily
- cron: '0 0 * * *'
jobs:
cibw_docker_image:
uses: ./.github/workflows/cibw_docker_image.yml
permissions: {packages: write}
with:
cibuildwheel_ver: "2.12.1"
force_update: false

code_coverage:
needs: [cibw_docker_image]
runs-on: "ubuntu-latest"
container:
image: ${{needs.cibw_docker_image.outputs.tag}}
services:
mongodb:
image: mongo:4.4
ports:
- 27017:27017
env:
SCCACHE_GHA_VERSION: ${{vars.SCCACHE_GHA_VERSION || 1}} # Setting this env var enables the caching
VCPKG_NUGET_USER: ${{secrets.VCPKG_NUGET_USER || github.repository_owner}}
VCPKG_NUGET_TOKEN: ${{secrets.VCPKG_NUGET_TOKEN || secrets.GITHUB_TOKEN}}
VCPKG_MAN_NUGET_USER: ${{secrets.VCPKG_MAN_NUGET_USER}} # For forks to download pre-compiled dependencies from the Man repo
VCPKG_MAN_NUGET_TOKEN: ${{secrets.VCPKG_MAN_NUGET_TOKEN}}
CMAKE_C_COMPILER_LAUNCHER: sccache
CMAKE_CXX_COMPILER_LAUNCHER: sccache
ARCTIC_CMAKE_PRESET: linux-debug
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores

- name: Extra envs
run: |
. build_tooling/vcpkg_caching.sh # Linux follower needs another call in CIBW
echo -e "VCPKG_BINARY_SOURCES=$VCPKG_BINARY_SOURCES
VCPKG_ROOT=$PLATFORM_VCPKG_ROOT" | tee -a $GITHUB_ENV
cmake -P cpp/CMake/CpuCount.cmake | sed 's/^-- //' | tee -a $GITHUB_ENV
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{vars.CMAKE_BUILD_PARALLEL_LEVEL}}

- name: Prepare C++ compilation env
run: . build_tooling/prep_cpp_build.sh

- name: CMake compile
uses: lukka/run-cmake@v10
with:
cmakeListsTxtPath: ${{github.workspace}}/cpp/CMakeLists.txt
configurePreset: ${{env.ARCTIC_CMAKE_PRESET}}
buildPreset: ${{env.ARCTIC_CMAKE_PRESET}}
env:
ARCTICDB_CODE_COVERAGE_BUILD: 1
ARCTICDB_DEBUG_FIND_PYTHON: ${{vars.ARCTICDB_DEBUG_FIND_PYTHON}}
python_impl_name: 'cp311'

- name: Run C++ Tests
shell: bash -l {0}
run: |
cd cpp/out/linux-debug-build/
ls arcticdb
make -j ${{ steps.cpu-cores.outputs.count }} arcticdb_rapidcheck_tests
make -j ${{ steps.cpu-cores.outputs.count }} test_unit_arcticdb
ctest

# We are chainging the python here because we want to use the default python to build (it is devel version)
# and this python for the rest of the testing
- name: Select Python (Linux)
run: echo /opt/python/cp36-cp36m/bin >> $GITHUB_PATH

- name: Test with pytest
shell: bash -l {0}
run: |
yum install nodejs npm -y
npm config set strict-ssl false
npm install -g azurite
python -m pip install --upgrade pip

python >build_tooling/requirements-analysis-workflow.txt <<END
from configparser import ConfigParser
cf = ConfigParser()
cf.read("setup.cfg");

# setup_requires is not needed
print(cf['options']['setup_requires'])
print(cf['options']['install_requires'])
print(cf['options.extras_require']['Testing'])
END

python -m pip install -r build_tooling/requirements-analysis-workflow.txt
python -m grpc_tools.protoc -Icpp/proto --python_out=./python cpp/proto/arcticc/pb2/*.proto
cd python
ln -s ../cpp/out/linux-debug-build/arcticdb/arcticdb_ext.cpython-36m-x86_64-linux-gnu.so
python -m coverage run -m pytest tests
env:
TEST_OUTPUT_DIR: ${{runner.temp}}
# Use the Mongo created in the service container above to test against
CI_MONGO_HOST: mongodb
ARCTICDB_PERSISTENT_STORAGE_LIB_NAME: 'test_${{ github.run_id }}_${{matrix.os}}_${{env.python_impl_name}}${{matrix.python_deps_id}}'

- name: Get python Coverage report
shell: bash -l {0}
run: |
cd python
python -m coverage report -m | tee output.txt
python -m coverage html
zip -r python_cov.zip htmlcov/

echo "PYTHON_COV_PERCENT=$(cat output.txt | grep 'TOTAL' | awk '{print $NF}' | tr -d '%')" >> $GITHUB_ENV

- name: Run Gcovr manually post-pytest
shell: bash -l {0}
run: |
cd cpp/out/linux-debug-build/
python -m pip install gcovr
mkdir coverage
python -m gcovr --txt --html-details coverage/index.html -e vcpkg_installed/ -e proto/ -e ../../third_party -e ../../arcticdb/util/test/ -r ../.. --exclude-throw-branches --exclude-unreachable-branches -u --exclude-function-lines | tee output.txt
zip -r coverage.zip coverage/

echo "CPP_COV_PERCENT=$(cat output.txt | grep 'TOTAL' | awk '{print $NF}' | tr -d '%')" >> $GITHUB_ENV

- name: Upload Coverage
uses: actions/upload-artifact@v3
with:
name: cpp-coverage-artifact
path: cpp/out/linux-debug-build/coverage.zip

- name: Upload Python Coverage
uses: actions/upload-artifact@v3
with:
name: python-coverage-artifact
path: python/python_cov.zip

- name: Restore cpp cache
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name wrong?

id: cache
uses: actions/cache@v2
with:
path: coverage.txt
key: coverage

- name: Get and compare coverage if cache was restored
run: |
# if cache was restored, compare coverage
if [ -f coverage.txt ]; then
PREV_COVERAGE=$(cat coverage.txt | cut -d' ' -f2)
echo "Previous coverage: $PREV_COVERAGE"
CURR_COVERAGE=${{env.CPP_COV_PERCENT}}
echo "CPP_COV_PREV_PERCENT=$PREV_COVERAGE" >> $GITHUB_ENV
echo "Current coverage: $CURR_COVERAGE"
if [ $CURR_COVERAGE -gt $PREV_COVERAGE ]; then
echo "Coverage increased"
elif [ $CURR_COVERAGE -lt $PREV_COVERAGE ]; then
echo "Coverage decreased"
else
echo "Coverage unchanged"
fi
fi

- name: Save coverage percentage to file
run: |
echo "Coverage: ${{ env.CPP_COV_PERCENT }}" > coverage.txt

- name: Check percentage and send Slack notification
if: ${{ env.CPP_COV_PREV_PERCENT && env.CPP_COV_PERCENT && env.CPP_COV_PERCENT < env.CPP_COV_PREV_PERCENT }}
uses: slackapi/[email protected]
with:
# For posting a rich message using Block Kit
payload: |
{
"text": "The CPP Code Coverage has been reduced",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "The CPP Code Coverage from the current run(${{ env.CPP_COV_PERCENT }}%) is lower the previous one(${{ env.CPP_COV_PREV_PERCENT }}%)."
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ARCTICDB_DEV_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
3 changes: 3 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb")
if(DEFINED ENV{ARCTICDB_CODE_COVERAGE_BUILD})
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage -g -O0")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -ggdb")
endif()
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Testing =
pymongo
azure-storage-blob
azure-identity
coverage

[options.entry_points]
console_scripts =
Expand Down