-
Notifications
You must be signed in to change notification settings - Fork 457
Add PEP 517-compliant pip install workflow #4828
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
Open
gamesh411
wants to merge
3
commits into
Ericsson:master
Choose a base branch
from
gamesh411:pip-install-modernization
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,128 @@ | ||
| name: pip install | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - 'setup.py' | ||
| - 'pyproject.toml' | ||
| - 'MANIFEST.in' | ||
| - 'config/**' | ||
| - 'codechecker_common/**' | ||
| - 'analyzer/**' | ||
| - 'web/**' | ||
| - 'tools/**' | ||
| - '.github/workflows/pip-install.yml' | ||
| pull_request: | ||
| paths: | ||
| - 'setup.py' | ||
| - 'pyproject.toml' | ||
| - 'MANIFEST.in' | ||
| - 'config/**' | ||
| - 'codechecker_common/**' | ||
| - 'analyzer/**' | ||
| - 'web/**' | ||
| - 'tools/**' | ||
| - '.github/workflows/pip-install.yml' | ||
|
|
||
| permissions: read-all | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| pip-install-smoke: | ||
| name: "pip install (${{ matrix.os }}, Python ${{ matrix.python }})" | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-24.04, macos-latest, windows-latest] | ||
| python: ['3.9', '3.12', '3.13'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python }} | ||
|
|
||
| - name: pip install . | ||
| run: pip install . | ||
|
|
||
| - name: Smoke test | ||
| run: | | ||
| CodeChecker --help | ||
| CodeChecker version | ||
| report-converter --help | ||
| merge-clang-extdef-mappings --help | ||
| post-process-stats --help | ||
| tu_collector --help | ||
|
|
||
| - name: Verify data files installed | ||
| run: | | ||
| python -c " | ||
| import sysconfig, os | ||
| data = sysconfig.get_path('data') | ||
| cfg = os.path.join(data, 'share', 'codechecker', 'config') | ||
| assert os.path.isdir(cfg), f'Config dir missing: {cfg}' | ||
| assert os.path.isfile(os.path.join(cfg, 'package_layout.json')), 'package_layout.json missing' | ||
| " | ||
|
|
||
| pip-install-editable: | ||
| name: "pip install -e . (ubuntu, Python 3.12)" | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: pip install -e . | ||
| run: pip install -e . | ||
|
|
||
| - name: Smoke test | ||
| run: | | ||
| CodeChecker --help | ||
| CodeChecker version | ||
|
|
||
| pip-install-analyze: | ||
| name: "pip install + analyze (ubuntu, Python 3.12)" | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update -q | ||
| sudo apt-get install -y clang clang-tidy cppcheck | ||
|
|
||
| - name: pip install . | ||
| run: pip install . | ||
|
|
||
| - name: Test analyze and parse | ||
| run: | | ||
| WORK="$RUNNER_TEMP/analyze-test" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally I'd imagine this in a separate file too because of the length of the script. Also if JQ is available, counting reports could be done with it: |
||
| mkdir -p "$WORK" | ||
|
|
||
| cat > "$WORK/main.c" <<'EOF' | ||
| int main() { int i = 1 / 0; return i; } | ||
| EOF | ||
|
|
||
| cat > "$WORK/compile_commands.json" <<EOF | ||
| [{"directory": "$WORK", "command": "gcc -c $WORK/main.c", "file": "$WORK/main.c"}] | ||
| EOF | ||
|
|
||
| CodeChecker analyze "$WORK/compile_commands.json" -o "$WORK/reports" | ||
| CodeChecker parse "$WORK/reports" -e json | python -c " | ||
| import sys, json | ||
| reports = json.load(sys.stdin) | ||
| assert len(reports) > 0, 'Expected at least one report' | ||
| " | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,9 @@ | ||
| recursive-include build_dist/CodeChecker/lib/python3/codechecker_report_converter/report/output/html/static * | ||
| recursive-include tools/report-converter/codechecker_report_converter/report/output/html/static * | ||
| recursive-include config * | ||
| recursive-include analyzer/config * | ||
| recursive-include web/config * | ||
| recursive-include web/server/config * | ||
| include LICENSE.TXT | ||
| include docs/README.md | ||
| include analyzer/requirements.txt | ||
| include web/requirements.txt |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
I'd move this part to a separate file to make it more readable and invoke it here. Also given the simplicity of this task, couldn't it be done with bash instead of python?