Merge pull request #2045 from ClickHouse/type-conversion #2123
This file contains 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
name: Analysis | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**.md" | |
- "**/docs/**" | |
- "**/LICENSE" | |
- "**/NOTICE" | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- synchronize | |
- reopened | |
paths-ignore: | |
- "**.md" | |
- "**/docs/**" | |
- "**/LICENSE" | |
- "**/NOTICE" | |
workflow_dispatch: | |
inputs: | |
pr: | |
description: "Pull request#" | |
required: false | |
env: | |
PREFERRED_LTS_VERSION: "24.3" | |
jobs: | |
static: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
name: Static code analysis | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check out head | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
if: github.event_name == 'pull_request' | |
- name: Check out PR | |
run: | | |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 \ | |
origin pull/${{ github.event.inputs.pr }}/head:the-pr && git checkout the-pr | |
if: github.event.inputs.pr != '' | |
- name: Install JDK and Maven | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: 17 | |
cache: "maven" | |
- name: Setup Toolchain | |
shell: bash | |
run: | | |
mkdir -p $HOME/.m2 \ | |
&& cat << EOF > $HOME/.m2/toolchains.xml | |
<?xml version="1.0" encoding="UTF8"?> | |
<toolchains> | |
<toolchain> | |
<type>jdk</type> | |
<provides> | |
<version>17</version> | |
</provides> | |
<configuration> | |
<jdkHome>${{ env.JAVA_HOME }}</jdkHome> | |
</configuration> | |
</toolchain> | |
</toolchains> | |
EOF | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Update sonar config | |
run: | | |
sed -i -e 's|^\(.*<sonar.projectKey>\).*\(</sonar.projectKey>\)$|\1ClickHouse_clickhouse-jdbc\2|' \ | |
-e 's|^\(.*<sonar.organization>\).*\(</sonar.organization>\)$|\1clickhouse-java\2|' pom.xml | |
if: github.repository_owner == 'ClickHouse' | |
- name: Build and install | |
run: | | |
find . -type f -name "simplelogger.*" -exec rm -fv '{}' \; | |
mvn -q --batch-mode -DclickhouseVersion=$PREFERRED_LTS_VERSION \ | |
-DskipTests install | |
- name: Analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
mvn --batch-mode -DclickhouseVersion=$PREFERRED_LTS_VERSION -Dclient.tests.useNewImplementation=true \ | |
-Panalysis verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | |
continue-on-error: true |