Skip to content

Commit

Permalink
[package] pypi package support
Browse files Browse the repository at this point in the history
  • Loading branch information
csordasmarton committed Apr 30, 2021
1 parent 18d9c63 commit 3caa307
Show file tree
Hide file tree
Showing 35 changed files with 696 additions and 228 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: pypi-package-tests

# Triggers the workflow on push or pull request events.
on: [push, pull_request]

jobs:
build:
name: Build pypi package
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.6'
- uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Install dependencies
run: |
sudo apt-get update -q
sudo apt-get install g++ gcc-multilib
- name: Create the pypi package
run: |
BUILD_UI_DIST=NO make dist
mv dist/codechecker-*.tar.gz dist/codechecker.tar.gz
- uses: actions/upload-artifact@master
with:
name: pypi-package-and-tests
path: |
dist
tests/functional/binary_package/
test:
name: Install and test pypi package
runs-on: ${{ matrix.os }}
needs: build

strategy:
matrix:
os: [ubuntu-18.04, macos-10.15, windows-2019]

steps:
- uses: actions/setup-python@v2
with:
python-version: '3.6'

- uses: actions/download-artifact@master
with:
name: pypi-package-and-tests
path: ./

- name: "Install run-time dependencies (Linux)"
if: ${{ matrix.os == 'ubuntu-18.04' }}
run:
sudo apt-get update && sudo apt-get install g++ clang clang-tidy

- name: "Install run-time dependencies (OSX)"
if: ${{ matrix.os == 'macos-10.15' }}
run:
brew install llvm

- name: "Install run-time dependencies (Windows)"
if: ${{ matrix.os == 'windows-2019' }}
shell: powershell
run: |
choco install llvm;
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Install pypi package"
run: |
pip install wheel nose
pip install dist/codechecker.tar.gz
- name: "Test CodeChecker commands"
run: |
nosetests tests/functional/binary_package/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*.py[cod]

build
build_dist
dist
venv
venv_dev
Makefile.local
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
-include Makefile.local

CURRENT_DIR = ${CURDIR}
BUILD_DIR = $(CURRENT_DIR)/build
VENDOR_DIR = $(CURRENT_DIR)/vendor
BUILD_DIR ?= $(CURRENT_DIR)/build
PYTHON_BIN ?= python3

CC_BUILD_DIR = $(BUILD_DIR)/CodeChecker
Expand Down Expand Up @@ -63,19 +62,20 @@ package: package_dir_structure set_git_commit_template package_gerrit_skiplist
$(CC_BUILD_DIR)/config/analyzer_version.json \
$(CC_BUILD_DIR)/config/web_version.json

mkdir -p $(CC_BUILD_DIR)/cc_bin && \
${PYTHON_BIN} ./scripts/build/create_commands.py -b $(BUILD_DIR) \
--cmd-dir $(ROOT)/codechecker_common/cmd \
$(CC_WEB)/codechecker_web/cmd \
$(CC_SERVER)/codechecker_server/cmd \
$(CC_CLIENT)/codechecker_client/cmd \
$(CC_ANALYZER)/codechecker_analyzer/cmd \
--bin-file $(ROOT)/bin/CodeChecker \
--cc-bin-file $(ROOT)/bin/CodeChecker.py
--bin-file $(ROOT)/bin/CodeChecker

# Copy license file.
cp $(ROOT)/LICENSE.TXT $(CC_BUILD_DIR)

package_api:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) package_api

standalone_package: venv package
# Create a version of the package, which uses a wrapper script to
# eliminate the need to manually source the virtual environment before
Expand All @@ -90,6 +90,10 @@ standalone_package: venv package
-b _CodeChecker \
-o CodeChecker

.PHONY: dist
dist:
${PYTHON_BIN} setup.py sdist

venv:
# Create a virtual environment which can be used to run the build package.
python3 -m venv venv --prompt="CodeChecker venv" && \
Expand Down
4 changes: 1 addition & 3 deletions analyzer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ package: package_analyzer
$(CC_BUILD_DIR)/config/analyzer_version.json \

# Copy CodeChecker entry point sub-commands.
mkdir -p $(CC_BUILD_DIR)/cc_bin && \
${PYTHON_BIN} $(ROOT)/scripts/build/create_commands.py -b $(BUILD_DIR) \
--cmd-dir $(ROOT)/codechecker_common/cmd \
$(CC_ANALYZER)/codechecker_analyzer/cmd \
--bin-file $(ROOT)/bin/CodeChecker \
--cc-bin-file $(ROOT)/bin/CodeChecker.py
--bin-file $(ROOT)/bin/CodeChecker

# Copy license file.
cp $(ROOT)/LICENSE.TXT $(CC_BUILD_DIR)
Expand Down
3 changes: 2 additions & 1 deletion analyzer/codechecker_analyzer/analysis_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,13 +780,14 @@ def signal_handler(signum, frame):
# proxy objects before passing them to other processes via
# map_async.
# Note that even deep-copying is known to be insufficient.
timeout = 3155760 if sys.platform == 'win32' else 31557600
pool.map_async(check,
analyzed_actions,
1,
callback=lambda results: worker_result_handler(
results, metadata_tool, output_path,
context.analyzer_binaries)
).get(31557600)
).get(timeout)

pool.close()
except Exception:
Expand Down
Loading

0 comments on commit 3caa307

Please sign in to comment.