diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88bd0e8..4bb2820 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,16 +1,18 @@ name: 'Action test' on: + pull_request: push: branches: - master + - 'releases/*' jobs: ubuntu_2004: name: "Ubuntu Linux 20.04" runs-on: ubuntu-20.04 steps: - - name: "Test action" - uses: whisperity/codechecker-analysis-action@master + - uses: actions/checkout@v2 + - uses: ./ with: - version: "test" + version: "master" diff --git a/README.md b/README.md index 0ab3690..bd4708f 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,14 @@ Objective-C) using the [Clang](http://clang.llvm.org/) infrastructure and ## Overview - +:warning: **This action has been written with commands that target Ubuntu-based distributions!** ## Action configuration -~~~{.yaml} +### Installing versions + +| Variable | Default | Description | +|--------------|------------------------------------------------------------------| +| `repository` | [`Ericsson/CodeChecker`](http://github.com/Ericsson/CodeChecker) | The CodeChecker repository to check out and build | +| `version` | `master` | The branch, tag, or commit SHA in the `repository` to use. | -~~~ diff --git a/action.yml b/action.yml index 481601b..7546157 100644 --- a/action.yml +++ b/action.yml @@ -2,6 +2,10 @@ name: 'CodeChecker Static Analysis' author: 'Whisperity' description: 'Execute C/C++ static analysis of LLVM/Clang (Clang Static Analyzer and Clang-Tidy) driven via CodeChecker.' inputs: + repository: + description: 'The CodeChecker repository to check out and build from.' + required: true + default: 'Ericsson/CodeChecker' version: description: 'The version of the CodeChecker suite to obtain and execute. Might be a Git commit SHA, a branch name, or a tag.' required: true @@ -9,7 +13,53 @@ inputs: runs: using: "composite" steps: - - name: "Test" + - name: "Check out repository ${{ inputs.repository }}" + uses: actions/checkout@v2 + with: + repository: ${{ inputs.repository }} + path: CodeChecker + ref: ${{ inputs.version }} + + + - name: "Install dependencies of CodeChecker" + shell: bash run: | - echo "Foo" - echo ${{ inputs.version }} + sudo apt-get -qy update + sudo apt-get -y --no-install-recommends install \ + build-essential \ + curl \ + gcc-multilib \ + python3-dev \ + python3-venv + - name: "Build and Package CodeChecker" + id: codechecker_build + env: + CODECHECKER_WILL_USE_WEB_API: false + shell: bash + run: | + 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=CODECHECKER_PATH::$(readlink -f ./build/CodeChecker/bin)" + echo "::set-output name=CODECHECKER_VERSION::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Base package' | cut -d'|' -f 2 | tr -d ' ')" + echo "::set-output name=CODECHECKER_GITSEVEN::$(./build/CodeChecker/bin/CodeChecker analyzer-version | grep 'Git commit' | cut -d'|' -f 2 | cut -c 2-8)" + + popd