Merge pull request #3 from whisperity/fix/alternatives

Fix install of `clang-tidy` conflicting with the alternatives system.
This commit is contained in:
Whisperity
2022-06-09 12:10:41 +02:00
4 changed files with 18 additions and 12 deletions

View File

@@ -8,6 +8,8 @@ on:
branches: branches:
- master - master
- 'releases/*' - 'releases/*'
- 'fix/*'
- 'feat/*'
paths-ignore: paths-ignore:
- '**.md' - '**.md'

View File

@@ -300,12 +300,12 @@ Please refer to earlier parts of the documentation for the configuration of thes
### Versions to install ### Versions to install
| Variable | Default | Description | | Variable | Default | Description |
|------------------|------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------------|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `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 the community [PPA](http://apt.llvm.org/). The value **MUST** be a major version (e.g. `13`) that is supported by the _PPA_ for the OS used! If `latest`, automatically gather the latest (yet unreleased) version. If `ignore`, don't install anything. (Not recommended.) |
| `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. | | `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. |
| `repository` | [`Ericsson/CodeChecker`](http://github.com/Ericsson/CodeChecker) | The CodeChecker repository to check out and build, if `install-custom` is `true`. | | `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. | | `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. |
### Build log configuration ### Build log configuration

View File

@@ -19,7 +19,7 @@ inputs:
required: true required: true
default: 'master' default: 'master'
llvm-version: llvm-version:
description: 'The major version of LLVM to install and use. LLVM is installed from PPA. If "latest", automatically gather the latest version. If "ignore", do not install anything. (Not recommended)' description: 'The major version of LLVM to install and use. LLVM is installed from the community PPA at http://apt.llvm.org. The value MUST be a major version (e.g. 13) that is supported by the PPA for the OS used! If "latest", automatically gather the latest version. If "ignore", do not install anything. (Not recommended.)'
required: true required: true
default: 'latest' default: 'latest'

View File

@@ -6,6 +6,9 @@ fi
echo "::group::Installing LLVM" echo "::group::Installing LLVM"
update-alternatives --query clang
update-alternatives --query clang-tidy
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 -
@@ -21,12 +24,13 @@ fi
sudo apt-get -y --no-install-recommends install \ sudo apt-get -y --no-install-recommends install \
clang-$LLVM_VER \ clang-$LLVM_VER \
clang-tidy-$LLVM_VER clang-tidy-$LLVM_VER
sudo update-alternatives --install \ sudo update-alternatives --install \
/usr/bin/clang clang /usr/bin/clang-$LLVM_VER 1000 \ /usr/bin/clang clang /usr/bin/clang-$LLVM_VER 10000
--slave \ sudo update-alternatives --install \
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VER /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VER 10000
echo "::endgroup::"
update-alternatives --query clang update-alternatives --query clang
update-alternatives --query clang-tidy
echo "::endgroup::"
echo "::set-output name=REAL_VERSION::$(clang --version | head -n 1 | cut -d' ' -f4-)" echo "::set-output name=REAL_VERSION::$(clang --version | head -n 1 | cut -d' ' -f4-)"