-
Notifications
You must be signed in to change notification settings - Fork 151
Analysis workflow (#783) #784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 7ebe6ec
Fix some tests
f87f336
try to build with a different python version
53bebef
try to build with a different python version
5764fd3
Try with older python
47859c8
Try to change python folder
6265579
Try to change python folder
fae46a4
Try to change python folder
856f1cf
Try to change python folder
9b87fba
Try setup-python
a67efb8
Try setup-python
40b5e94
Try setup-python
bd0363f
Try setup-python
4294571
Try to add the lib and include paths to the build cmake
7bad8c0
Try to add the lib and include paths to the build cmake
93dc0b8
Try withour requiring python dev"
380829a
Try to use 3.6 but make it think that it is 3.11
27a95f3
Add a shell for composite action
ffc5c41
Add a shell
db81853
Add a shell
857436b
Move back to python 3.6 to test the other changes
cb5dee5
Move back to python 3.6 to test the other changes
2823aa9
Remove persistent tests for now
b18910c
Address PR comments
38fb157
Add a scheduled trigger; Revert change to test
6803e76
Remove unnecessary definition
6c841cc
Revert unnecessary changes
2e6ddab
Revert unnecessary changes
0d9ad36
Fix path to requirements file
e813d9f
Bring back compaction fix
ae079f2
Bring back compaction fix
b3e1d82
Try to remove the static requirements.txt
8bdb691
FIx path to setup.cfg
f9ed8ef
Revert changes that were needed for testing
ee66ab9
Merge branch 'master' into analysis_workflow_consolidated
G-D-Petrov 79f964a
Fix problem with coverage cache
b57507d
Merge branch 'analysis_workflow_consolidated' of https://github.com/m…
87417ac
Disable test_stress_version_map_compact test in code coverage
3064fe0
Revert the on push trigger
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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 | ||
| 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 | ||
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name wrong?