mirror of
https://github.com/whisperity/CodeChecker-Action.git
synced 2026-02-09 22:57:45 +00:00
feat: Grab CodeChecker release from PyPI by default
This commit is contained in:
49
.github/workflows/test.yml
vendored
49
.github/workflows/test.yml
vendored
@@ -12,30 +12,39 @@ on:
|
|||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Fetch tests do not produce results, but test the functionality of the
|
fetch-tests:
|
||||||
# "grab LLVM" and "grab and build CodeChecker" features.
|
strategy:
|
||||||
fetch_ubuntu-2004_latest-llvm:
|
fail-fast: false
|
||||||
name: "Fetch: Ubuntu Linux 20.04 (latest LLVM)"
|
matrix:
|
||||||
runs-on: ubuntu-20.04
|
include:
|
||||||
|
- os: ubuntu-18.04
|
||||||
|
install-custom: true
|
||||||
|
version: v6.16.0
|
||||||
|
llvm-version: '12'
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
install-custom: false
|
||||||
|
version: 6.17.0
|
||||||
|
llvm-version: '13'
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
install-custom: true
|
||||||
|
version: master
|
||||||
|
llvm-version: 'latest'
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
install-custom: false
|
||||||
|
version: master
|
||||||
|
llvm-version: 'latest'
|
||||||
|
name: "Fetch: ${{ matrix.os }}, LLVM ${{ matrix.llvm-version }}, ${{ matrix.install-custom && 'repository' || 'pip' }} ${{ matrix.version }}"
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ./
|
- uses: ./
|
||||||
|
id: codechecker
|
||||||
with:
|
with:
|
||||||
version: "master"
|
install-custom: ${{ matrix.install-custom }}
|
||||||
llvm-version: "latest"
|
version: ${{ matrix.version }}
|
||||||
logfile: "test/empty/compile_commands.json"
|
llvm-version: ${{ matrix.llvm-version }}
|
||||||
fetch_ubuntu-1804_12-llvm:
|
|
||||||
name: "Fetch: Ubuntu Linux 18.04 (LLVM 12.y)"
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: ./
|
|
||||||
with:
|
|
||||||
version: "master"
|
|
||||||
llvm-version: 12
|
|
||||||
logfile: "test/empty/compile_commands.json"
|
logfile: "test/empty/compile_commands.json"
|
||||||
|
|
||||||
# Test simple build and analysis configuration.
|
|
||||||
simple-analysis-tests:
|
simple-analysis-tests:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -169,7 +178,7 @@ jobs:
|
|||||||
id: codechecker
|
id: codechecker
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
version: "v${{ env.CODECHECKER_VERSION }}"
|
version: "${{ env.CODECHECKER_VERSION }}"
|
||||||
logfile: 'test/simple/compile_commands.json'
|
logfile: 'test/simple/compile_commands.json'
|
||||||
store: true
|
store: true
|
||||||
store-url: 'http://0.0.0.0:8001/Default'
|
store-url: 'http://0.0.0.0:8001/Default'
|
||||||
@@ -179,7 +188,7 @@ jobs:
|
|||||||
id: test
|
id: test
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: docker logs codechecker-server | grep "stored results"
|
run: docker logs codechecker-server | grep "stored results"
|
||||||
- name: "Teardown CodeChecker server"
|
- name: "Tear down CodeChecker server"
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
|||||||
@@ -106,9 +106,10 @@ runs:
|
|||||||
### Versions to install
|
### Versions to install
|
||||||
|
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
|----------------|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|------------------|------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `repository` | [`Ericsson/CodeChecker`](http://github.com/Ericsson/CodeChecker) | The CodeChecker repository to check out and build |
|
| `install-custom` | `false` | If set to `true`, opens the ability to locally clone and install CodeChecker from the specified `repository` and `version`. Otherwise, `version` is taken as a release version, and the [CodeChecker suite from PyPI](http://pypi.org/project/codechecker) is downloaded. |
|
||||||
| `version` | `master` | The branch, tag, or commit SHA in the `repository` to use. |
|
| `repository` | [`Ericsson/CodeChecker`](http://github.com/Ericsson/CodeChecker) | The CodeChecker repository to check out and build, if `install-custom` is `true`. |
|
||||||
|
| `version` | `master` | If `install-custom` is `false`, the release version (e.g. `6.18.0`) to download from PyPI, or `master` to fetch the latest release. Otherwise, the branch (defaulting to `master`), tag, or commit SHA in the `repository` to check out. |
|
||||||
| `llvm-version` | `latest` | The major version of LLVM to install and use. LLVM is installed from [PPA](http://apt.llvm.org/). If `latest`, automatically gather the latest version. If `ignore`, don't install anything. (Not recommended) |
|
| `llvm-version` | `latest` | The major version of LLVM to install and use. LLVM is installed from [PPA](http://apt.llvm.org/). If `latest`, automatically gather the latest version. If `ignore`, don't install anything. (Not recommended) |
|
||||||
|
|
||||||
### Build log configuration
|
### Build log configuration
|
||||||
|
|||||||
69
action.yml
69
action.yml
@@ -6,12 +6,16 @@ branding:
|
|||||||
color: 'blue'
|
color: 'blue'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
|
install-custom:
|
||||||
|
description: 'Whether to download, check out, and build a CodeChecker package manually in the CI.'
|
||||||
|
required: true
|
||||||
|
default: 'false'
|
||||||
repository:
|
repository:
|
||||||
description: 'The CodeChecker repository to check out and build from.'
|
description: 'The CodeChecker repository to check out and build from.'
|
||||||
required: true
|
required: true
|
||||||
default: 'Ericsson/CodeChecker'
|
default: 'Ericsson/CodeChecker'
|
||||||
version:
|
version:
|
||||||
description: 'The version of the CodeChecker suite to obtain and execute. Might be a Git commit SHA, a branch name, or a tag.'
|
description: 'The version of the CodeChecker suite to obtain and execute. Might be a Git commit SHA, a branch name, or a tag if building a custom package, or a release version if downloading from PyPI. If "master" and downloading from PyPI, fetch the latest release.'
|
||||||
required: true
|
required: true
|
||||||
default: 'master'
|
default: 'master'
|
||||||
llvm-version:
|
llvm-version:
|
||||||
@@ -32,24 +36,24 @@ inputs:
|
|||||||
|
|
||||||
analyze-output:
|
analyze-output:
|
||||||
description: 'The output directory where the raw analysis output should be stored. If left the default empty, the path will be generated automatically.'
|
description: 'The output directory where the raw analysis output should be stored. If left the default empty, the path will be generated automatically.'
|
||||||
default: ''
|
|
||||||
required: false
|
required: false
|
||||||
|
default: ''
|
||||||
ctu:
|
ctu:
|
||||||
description: 'Whether to enable Cross Translation Unit (CTU) analysis in the Clang Static Analyzer.'
|
description: 'Whether to enable Cross Translation Unit (CTU) analysis in the Clang Static Analyzer.'
|
||||||
default: 'false'
|
|
||||||
required: true
|
required: true
|
||||||
|
default: 'false'
|
||||||
|
|
||||||
fail-build-if-reports:
|
fail-build-if-reports:
|
||||||
description: 'Whether to fail the build if static analysis warnings are emitted.'
|
description: 'Whether to fail the build if static analysis warnings are emitted.'
|
||||||
default: 'false'
|
|
||||||
required: true
|
required: true
|
||||||
|
default: 'false'
|
||||||
|
|
||||||
store:
|
store:
|
||||||
description: 'Whether to enable storing the results to a CodeChecker server. If enabled, other flags, such as `store-url` must also be set.'
|
description: 'Whether to enable storing the results to a CodeChecker server. If enabled, other flags, such as "store-url" must also be set.'
|
||||||
default: 'false'
|
|
||||||
required: true
|
required: true
|
||||||
|
default: 'false'
|
||||||
store-url:
|
store-url:
|
||||||
description: 'The CodeChecker product URL (usually in the format of http://example.com/ProductName) where the store should connect to. Mandatory if `store` is true.'
|
description: 'The CodeChecker product URL (usually in the format of http://example.com/ProductName) where the store should connect to. Mandatory if "store" is true.'
|
||||||
required: false
|
required: false
|
||||||
store-username:
|
store-username:
|
||||||
description: 'If the server requires authentication, the username to authenticate with.'
|
description: 'If the server requires authentication, the username to authenticate with.'
|
||||||
@@ -59,8 +63,8 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
store-run-name:
|
store-run-name:
|
||||||
description: 'An identifying name of the analysis run. A run usually correlates to a set of configuration, e.g. analysis mode, branch, etc. If left default, the name is automatically generated from the current repository and branch name.'
|
description: 'An identifying name of the analysis run. A run usually correlates to a set of configuration, e.g. analysis mode, branch, etc. If left default, the name is automatically generated from the current repository and branch name.'
|
||||||
default: '__DEFAULT__'
|
|
||||||
required: true
|
required: true
|
||||||
|
default: '__DEFAULT__'
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
logfile:
|
logfile:
|
||||||
@@ -90,61 +94,36 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: "Check out repository ${{ inputs.repository }}"
|
- name: "Check out repository ${{ inputs.repository }}"
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
if: ${{ inputs.install-custom == 'true' }}
|
||||||
with:
|
with:
|
||||||
repository: ${{ inputs.repository }}
|
|
||||||
path: CodeChecker
|
path: CodeChecker
|
||||||
|
repository: ${{ inputs.repository }}
|
||||||
ref: ${{ inputs.version }}
|
ref: ${{ inputs.version }}
|
||||||
|
|
||||||
- name: "Install dependencies of CodeChecker"
|
- name: "Install LLVM (${{ inputs.llvm-version }})"
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
sudo apt-get -qy update
|
|
||||||
${{ github.action_path }}/src/apt-dependencies.sh
|
|
||||||
|
|
||||||
- name: "Install LLVM version"
|
|
||||||
id: llvm
|
id: llvm
|
||||||
if: ${{ inputs.llvm-version != 'ignore' }}
|
if: ${{ inputs.llvm-version != 'ignore' }}
|
||||||
env:
|
env:
|
||||||
CONFIGURED_LLVM_VERSION: ${{ inputs.llvm-version }}
|
IN_LLVM_VERSION: ${{ inputs.llvm-version }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: ${{ github.action_path }}/src/get-llvm.sh
|
||||||
${{ github.action_path }}/src/get-llvm.sh
|
|
||||||
echo "::set-output name=REAL_VERSION::$(clang --version | head -n 1 | cut -d' ' -f4-)"
|
|
||||||
|
|
||||||
- name: "Build and Package CodeChecker"
|
- name: "Build and Package CodeChecker"
|
||||||
id: codechecker
|
id: codechecker
|
||||||
env:
|
env:
|
||||||
CODECHECKER_WILL_USE_WEB_API: ${{ inputs.store == 'true' }}
|
CODECHECKER_WILL_USE_WEB_API: ${{ inputs.store == 'true' }}
|
||||||
|
|
||||||
|
IN_INSTALL_CUSTOM: ${{ inputs.install-custom }}
|
||||||
|
IN_VERSION: ${{ inputs.version }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -ex
|
set -x
|
||||||
if [[ "$CODECHECKER_WILL_USE_WEB_API" == "false" ]]; then
|
if [[ "$IN_INSTALL_CUSTOM" == "true" ]]; then
|
||||||
# If the job is only running analysis, do not spend time with building the API stuff!
|
${{ github.action_path }}/src/build-codechecker.sh
|
||||||
echo "Building only 'analyzer' module..."
|
|
||||||
pushd CodeChecker/analyzer
|
|
||||||
else
|
else
|
||||||
echo "Building full CodeChecker package..."
|
${{ github.action_path }}/src/pip-codechecker.sh
|
||||||
pushd CodeChecker
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make venv
|
|
||||||
source venv/bin/activate
|
|
||||||
BUILD_UI_DIST=NO make standalone_package
|
|
||||||
deactivate
|
|
||||||
|
|
||||||
./build/CodeChecker/bin/CodeChecker analyzer-version
|
|
||||||
if [[ "$CODECHECKER_WILL_USE_WEB_API" == "true" ]]; then
|
|
||||||
./build/CodeChecker/bin/CodeChecker web-version
|
|
||||||
else
|
|
||||||
echo "CodeChecker 'web' package not built."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "::set-output name=PATH::$(readlink -f ./build/CodeChecker/bin)"
|
|
||||||
echo "::set-output name=VERSION::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')"
|
|
||||||
echo "::set-output name=GITSEVEN::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)"
|
|
||||||
|
|
||||||
popd
|
|
||||||
|
|
||||||
- name: "Prepare JSON Compilation Database"
|
- name: "Prepare JSON Compilation Database"
|
||||||
id: log
|
id: log
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -x
|
|
||||||
|
|
||||||
sudo apt-get -y --no-install-recommends install \
|
|
||||||
build-essential \
|
|
||||||
curl \
|
|
||||||
gcc-multilib \
|
|
||||||
python3-dev \
|
|
||||||
python3-venv
|
|
||||||
37
src/build-codechecker.sh
Executable file
37
src/build-codechecker.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
sudo apt-get -y update
|
||||||
|
sudo apt-get -y --no-install-recommends install \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
gcc-multilib \
|
||||||
|
python3-dev \
|
||||||
|
python3-venv
|
||||||
|
|
||||||
|
if [[ "$CODECHECKER_WILL_USE_WEB_API" == "false" ]]; then
|
||||||
|
# If the job is only running analysis, do not spend time with building the API stuff!
|
||||||
|
echo "Building only 'analyzer' module..."
|
||||||
|
pushd CodeChecker/analyzer
|
||||||
|
else
|
||||||
|
echo "Building full CodeChecker package..."
|
||||||
|
pushd CodeChecker
|
||||||
|
fi
|
||||||
|
|
||||||
|
make venv
|
||||||
|
source venv/bin/activate
|
||||||
|
BUILD_UI_DIST=NO make standalone_package
|
||||||
|
deactivate
|
||||||
|
|
||||||
|
./build/CodeChecker/bin/CodeChecker analyzer-version
|
||||||
|
if [[ "$CODECHECKER_WILL_USE_WEB_API" == "true" ]]; then
|
||||||
|
./build/CodeChecker/bin/CodeChecker web-version
|
||||||
|
else
|
||||||
|
echo "CodeChecker 'web' package not built."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "::set-output name=PATH::$(readlink -f ./build/CodeChecker/bin)"
|
||||||
|
echo "::set-output name=VERSION::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')"
|
||||||
|
echo "::set-output name=GITSEVEN::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)"
|
||||||
|
|
||||||
|
popd
|
||||||
@@ -4,13 +4,13 @@ set -ex
|
|||||||
export DISTRO_FANCYNAME="$(lsb_release -c | awk '{ print $2 }')"
|
export DISTRO_FANCYNAME="$(lsb_release -c | awk '{ print $2 }')"
|
||||||
curl -sL http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
curl -sL http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
|
|
||||||
if [[ "$CONFIGURED_LLVM_VERSION" == "latest" ]]; then
|
if [[ "$IN_LLVM_VERSION" == "latest" ]]; then
|
||||||
sudo add-apt-repository -y "deb http://apt.llvm.org/$DISTRO_FANCYNAME/ llvm-toolchain-$DISTRO_FANCYNAME main"
|
sudo add-apt-repository -y "deb http://apt.llvm.org/$DISTRO_FANCYNAME/ llvm-toolchain-$DISTRO_FANCYNAME main"
|
||||||
# Get the largest Clang package number available.
|
# Get the largest Clang package number available.
|
||||||
export LLVM_VER="$(apt-cache search --full 'clang-[[:digit:]]*$' | grep '^Package: clang' | cut -d ' ' -f 2 | sort -V | tail -n 1 | sed 's/clang-//')"
|
export LLVM_VER="$(apt-cache search --full 'clang-[[:digit:]]*$' | grep '^Package: clang' | cut -d ' ' -f 2 | sort -V | tail -n 1 | sed 's/clang-//')"
|
||||||
else
|
else
|
||||||
sudo add-apt-repository -y "deb http://apt.llvm.org/$DISTRO_FANCYNAME/ llvm-toolchain-$DISTRO_FANCYNAME-$CONFIGURED_LLVM_VERSION main"
|
sudo add-apt-repository -y "deb http://apt.llvm.org/$DISTRO_FANCYNAME/ llvm-toolchain-$DISTRO_FANCYNAME-$IN_LLVM_VERSION main"
|
||||||
export LLVM_VER="$CONFIGURED_LLVM_VERSION"
|
export LLVM_VER="$IN_LLVM_VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo apt-get -y --no-install-recommends install \
|
sudo apt-get -y --no-install-recommends install \
|
||||||
@@ -21,3 +21,5 @@ sudo update-alternatives --install \
|
|||||||
--slave \
|
--slave \
|
||||||
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VER
|
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VER
|
||||||
update-alternatives --query clang
|
update-alternatives --query clang
|
||||||
|
|
||||||
|
echo "::set-output name=REAL_VERSION::$(clang --version | head -n 1 | cut -d' ' -f4-)"
|
||||||
|
|||||||
20
src/pip-codechecker.sh
Executable file
20
src/pip-codechecker.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [[ "$IN_VERSION" == "master" ]]; then
|
||||||
|
# The default branch name "master" is offered as a convenient shortcut for
|
||||||
|
# fetching the latest release.
|
||||||
|
pip3 install codechecker
|
||||||
|
else
|
||||||
|
pip3 install codechecker=="$IN_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pip3 show codechecker
|
||||||
|
which CodeChecker
|
||||||
|
|
||||||
|
CodeChecker analyzer-version
|
||||||
|
CodeChecker web-version
|
||||||
|
|
||||||
|
echo "::set-output name=PATH::$(dirname $(which CodeChecker))"
|
||||||
|
echo "::set-output name=VERSION::$(CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')"
|
||||||
|
echo "::set-output name=GITSEVEN::$(CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)"
|
||||||
Reference in New Issue
Block a user