refactor: Make use of the ::group:: command to group outputs

This commit is contained in:
Whisperity
2021-11-30 18:35:09 +01:00
parent aa40a1a8b6
commit 453cde8cc2
12 changed files with 83 additions and 31 deletions

View File

@@ -157,18 +157,22 @@ jobs:
run: |
set -x
echo "::group::Installing dependencies"
sudo apt-get -y update
sudo apt-get -y install --no-install-recommends \
netcat \
wget
echo "::endgroup::"
echo "::group::Setting up server configuration"
mkdir -pv ~/codechecker-server-data
chmod 1777 ~/codechecker-server-data
cp test/codechecker.server.json ~/codechecker-server-data/server_config.json
test/prepare-docker-server.sh
echo "::endgroup::"
echo "::group::CodeChecker server configuration"
echo "::group::Debug show CodeChecker server configuration"
cd ~/codechecker-server-data
chown 950:950 server_config.json && chmod 0600 server_config.json
chown 950:950 root.user && chmod 0600 root.user
@@ -183,6 +187,7 @@ jobs:
wget -qO- http://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for | sh -s -- --timeout=30 http://0.0.0.0:8001/ -- echo "CodeChecker up"
docker ps -a
echo "::group::CodeChecker server initial log output"
docker logs codechecker-server
echo "::endgroup::"
@@ -205,8 +210,6 @@ jobs:
run: docker logs codechecker-server | grep "stored results"
- name: "Tear down CodeChecker server"
run: |
set -x
echo "::group::CodeChecker server log output"
docker logs codechecker-server
echo "::endgroup::"

View File

@@ -39,7 +39,7 @@ If you are able to generate a _compilation database_ from your build system **wi
You can specify the generated compilation database in the `logfile` variable
```yaml
runs:
job:
steps:
# Check YOUR project out!
- name: "Check out repository"
@@ -53,7 +53,7 @@ runs:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
# Run the analysis
- uses: whisperity/codechecker-analysis-action
- uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
logfile: ${{ github.workspace }}/Build/compile_commands.json
@@ -75,7 +75,7 @@ In this case, you will need to instruct CodeChecker to log a build (and spend ti
You can specify the build to execute in the `build-command` variable.
```yaml
runs:
job:
steps:
# Check YOUR project out!
- name: "Check out repository"
@@ -89,7 +89,7 @@ runs:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF
# Run the analysis
- uses: whisperity/codechecker-analysis-action
- uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
build-command: "cd ${{ github.workspace }}/Build; cmake --build ."
@@ -110,7 +110,7 @@ If requested, the _`warnings`_ output variable can be matched against to execute
To get the reports in a human-consumable form, they must be uploaded somewhere first, before the failure step fails the entire job!
```yaml
runs:
job:
steps:
# Check YOUR project out!
- name: "Check out repository"
@@ -124,7 +124,7 @@ runs:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF
# Run the analysis
- uses: whisperity/codechecker-analysis-action
- uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
build-command: "cd ${{ github.workspace }}/Build; cmake --build ."
@@ -152,7 +152,7 @@ to automatically create or update a run.
on:
push:
runs:
job:
steps:
# Check YOUR project out!
- name: "Check out repository"
@@ -166,7 +166,7 @@ runs:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF
# Run the analysis
- uses: whisperity/codechecker-analysis-action
- uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
build-command: "cd ${{ github.workspace }}/Build; cmake --build ."
@@ -175,12 +175,6 @@ runs:
store-username: ${{ secrets.CODECHECKER_STORE_USER }}
store-password: ${{ secrets.CODECHECKER_STORE_PASSWORD }}
# store-run-name: "custom run name to store against"
# Upload the results to the CI.
- uses: actions/upload-artifact@v2
with:
name: "CodeChecker Bug Reports"
path: ${{ steps.codechecker.outputs.result-html-dir }}
```
### Acting as a CI gate on pull requests
@@ -210,7 +204,7 @@ runs:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF
# Run the analysis
- uses: whisperity/codechecker-analysis-action
- uses: whisperity/codechecker-analysis-action@v1
id: codechecker
with:
build-command: "cd ${{ github.workspace }}/Build; cmake --build ."

View File

@@ -1,6 +1,11 @@
#!/bin/bash
set -ex
set -e
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
echo "::group::Installing CodeChecker dependencies"
sudo apt-get -y update
sudo apt-get -y --no-install-recommends install \
build-essential \
@@ -8,7 +13,9 @@ sudo apt-get -y --no-install-recommends install \
gcc-multilib \
python3-dev \
python3-venv
echo "::endgroup::"
echo "::group::Build CodeChecker locally"
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..."
@@ -22,6 +29,7 @@ make venv
source venv/bin/activate
BUILD_UI_DIST=NO make standalone_package
deactivate
echo "::endgroup::"
./build/CodeChecker/bin/CodeChecker analyzer-version
if [[ "$CODECHECKER_WILL_USE_WEB_API" == "true" ]]; then

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
if [[ -z "$IN_DIFF_URL" ]]; then
echo "::error title=Configuration error::Diffing results against a server was enabled, but the product URL is not configured."

View File

@@ -1,5 +1,9 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
echo "::group::Preparing for diff"
if [[ -z "$IN_DIFF_URL" ]]; then
echo "::error title=Internal error::environment variable 'IN_DIFF_URL' missing!"
@@ -30,7 +34,9 @@ if [[ ! -z "$IN_CONFIGFILE" ]]; then
CONFIG_FLAG_2=$IN_CONFIGFILE
echo "Using configuration file \"$IN_CONFIGFILE\"!"
fi
echo "::endgroup::"
echo "::group::Generating HTML results from diff"
"$CODECHECKER_PATH"/CodeChecker \
cmd diff \
--new \
@@ -42,7 +48,9 @@ fi
$CONFIG_FLAG_1 $CONFIG_FLAG_2 \
|| true
echo "::set-output name=HTML_DIR::$OUTPUT_DIR"
echo "::endgroup::"
echo "::group::Printing diff results to log"
"$CODECHECKER_PATH"/CodeChecker \
cmd diff \
--new \
@@ -55,6 +63,7 @@ EXIT_CODE=$?
cat "$OUTPUT_LOG"
echo "::set-output name=OUTPUT_LOG::$OUTPUT_LOG"
echo "::endgroup::"
if [[ $EXIT_CODE -eq 2 ]]; then
echo "::set-output name=HAS_NEW_FINDINGS::true"

View File

@@ -1,6 +1,9 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
echo "::group::Preparing for analysis"
if [[ -z "$COMPILATION_DATABASE" ]]; then
echo "::error title=Internal error::environment variable 'COMPILATION_DATABASE' missing!"
exit 1
@@ -23,14 +26,15 @@ if [[ "$IN_CTU" == "true" ]]; then
CTU_FLAGS="--ctu --ctu-ast-mode load-from-pch"
echo "::notice title=Cross Translation Unit analyis::CTU has been enabled, the analysis might take a long time!"
fi
echo "::endgroup::"
"$CODECHECKER_PATH"/CodeChecker analyzers \
--detail \
|| true
echo "::group::Executing Static Analysis"
# Note: Ignoring the result of the analyze command in CTU mode, as we do not
# wish to break the build on a CTU failure.
"$CODECHECKER_PATH"/CodeChecker analyze \
"$COMPILATION_DATABASE" \
--output "$OUTPUT_DIR" \
@@ -39,6 +43,7 @@ fi
$CTU_FLAGS \
|| [[ "$IN_CTU" == "true" ]]
EXIT_CODE=$?
echo "::endgroup::"
echo "::set-output name=OUTPUT_DIR::$OUTPUT_DIR"
exit $EXIT_CODE

View File

@@ -1,5 +1,10 @@
#!/bin/bash
set -ex
set -e
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
echo "::group::Installing LLVM"
export DISTRO_FANCYNAME="$(lsb_release -c | awk '{ print $2 }')"
curl -sL http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
@@ -20,6 +25,8 @@ sudo update-alternatives --install \
/usr/bin/clang clang /usr/bin/clang-$LLVM_VER 1000 \
--slave \
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VER
echo "::endgroup::"
update-alternatives --query clang
echo "::set-output name=REAL_VERSION::$(clang --version | head -n 1 | cut -d' ' -f4-)"

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
if [[ ! -z "$IN_LOGFILE" && ! -z "$IN_COMMAND" ]]; then
echo "::error title=Configuration error::'logfile' and 'build-command' both specified!"
@@ -15,10 +17,12 @@ if [[ ! -z "$IN_LOGFILE" ]]; then
cp -v "$IN_LOGFILE" "$OUT_FILE"
EXIT_CODE=$?
elif [[ ! -z "$IN_COMMAND" ]]; then
echo "::group::Creating a build log by executing the build"
"$CODECHECKER_PATH"/CodeChecker log \
--build "$IN_COMMAND" \
--output "$OUT_FILE"
EXIT_CODE=$?
echo "::endgroup::"
else
echo "::error title=Configuration error::neither 'logfile' nor 'build-command' specified!"
echo "[]" > "$OUT_FILE"

View File

@@ -1,6 +1,9 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
echo "::group::Preparing for parse"
if [[ -z "$PROJECT_PATH" ]]; then
echo "::error title=Internal error::environment variable 'PROJECT_PATH' missing!"
exit 1
@@ -20,7 +23,9 @@ if [[ ! -z "$IN_CONFIGFILE" ]]; then
CONFIG_FLAG_2=$IN_CONFIGFILE
echo "Using configuration file \"$IN_CONFIGFILE\"!"
fi
echo "::endgroup::"
echo "::group::Generating HTML results from analysis"
"$CODECHECKER_PATH"/CodeChecker parse \
"$RAW_RESULT_DIR" \
--export "html" \
@@ -28,7 +33,9 @@ fi
--trim-path-prefix "$PROJECT_PATH" \
|| true
echo "::set-output name=HTML_DIR::$OUTPUT_DIR"
echo "::endgroup::"
echo "::group::Printing analysis results to log"
"$CODECHECKER_PATH"/CodeChecker parse \
"$RAW_RESULT_DIR" \
--trim-path-prefix "$PROJECT_PATH" \
@@ -37,6 +44,7 @@ EXIT_CODE=$?
cat "$OUTPUT_LOG"
echo "::set-output name=OUTPUT_LOG::$OUTPUT_LOG"
echo "::endgroup::"
if [[ $EXIT_CODE -eq 2 ]]; then
echo "::set-output name=HAS_FINDINGS::true"

View File

@@ -1,6 +1,9 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
echo "::group::Installing CodeChecker for PyPI"
if [[ "$IN_VERSION" == "master" ]]; then
# The default branch name "master" is offered as a convenient shortcut for
# fetching the latest release.
@@ -8,10 +11,10 @@ if [[ "$IN_VERSION" == "master" ]]; then
else
pip3 install codechecker=="$IN_VERSION"
fi
pip3 show codechecker
which CodeChecker
echo "::endgroup::"
which CodeChecker
CodeChecker analyzer-version
CodeChecker web-version

View File

@@ -1,5 +1,7 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
if [[ -z "$IN_STORE_URL" ]]; then
echo "::error title=Configuration error::Uploading results to a server was enabled, but the upload URL is not configured."

View File

@@ -1,5 +1,9 @@
#!/bin/bash
set -x
if [[ ! -z "$CODECHECKER_ACTION_DEBUG" ]]; then
set -x
fi
echo "::group::Preparing for store"
if [[ -z "$IN_STORE_URL" ]]; then
echo "::error title=Internal error::environment variable 'IN_STORE_URL' missing!"
@@ -31,7 +35,9 @@ if [[ ! -z "$CODECHECKER_STORE_RUN_TAG" ]]; then
RUN_TAG_FLAG_1="--tag"
RUN_TAG_FLAG_2=$CODECHECKER_STORE_RUN_TAG
fi
echo "::endgroup::"
echo "::group::Storing results to server"
"$CODECHECKER_PATH"/CodeChecker \
store \
"$RAW_RESULT_DIR" \
@@ -41,6 +47,7 @@ fi
$RUN_TAG_FLAG_1 $RUN_TAG_FLAG_2 \
$CONFIG_FLAG_1 $CONFIG_FLAG_2
SUCCESS=$?
echo "::endgroup::"
if [[ $SUCCESS -ne 0 ]]; then
echo "::warning title=Storing results failed::Executing 'CodeChecker store' to upload analysis results to the server has failed. The logs usually provide more information."