diff --git a/.circleci/config.yml b/.circleci/config.yml index 7bf833e..e6c4f38 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,19 +30,19 @@ defaults_gradle: &defaults_gradle path: build/reports/ jobs: - build_gradle_jdk14: + build_gradle_jdk18: <<: *defaults docker: - - image: openjdk:14-jdk + - image: cimg/openjdk:18.0 <<: *defaults_gradle - build_gradle_jdk8: + build_gradle_jdk11: <<: *defaults docker: - - image: circleci/openjdk:8-jdk + - image: cimg/openjdk:11.0 <<: *defaults_gradle @@ -50,6 +50,6 @@ workflows: version: 2 gradle: jobs: - - build_gradle_jdk8 - - build_gradle_jdk14 + - build_gradle_jdk11 + - build_gradle_jdk18 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 0ee725c..ea3926d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,21 +1,63 @@ -name: Java CI with Gradle +name: gradle-ci on: [push, pull_request, workflow_dispatch] jobs: build: - runs-on: ubuntu-latest + env: + GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m" + SONAR_JDK: "11" + + strategy: + matrix: + java-version: [ 11, 18 ] + steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Test with Gradle - run: ./gradlew check - env: - BITLY_ACCESS_TOKEN: ${{ secrets.BITLY_ACCESS_TOKEN }} + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java-version }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Cache SonarCloud packages + if: matrix.java-version == env.SONAR_JDK + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle-${{ matrix.java-version }}- + + - name: Test with Gradle + env: + BITLY_ACCESS_TOKEN: ${{ secrets.BITLY_ACCESS_TOKEN }} + run: ./gradlew build check --stacktrace + + - name: SonarCloud + if: success() && matrix.java-version == env.SONAR_JDK + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew sonarqube + + - name: Cleanup Gradle Cache + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties diff --git a/.gitignore b/.gitignore index a602396..13a066e 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ /**/.idea/**/uiDesigner.xml /**/.idea/**/usage.statistics.xml /**/.idea/**/workspace.xml +/**/.idea/sonarlint* /**/.idea_modules/ Thumbs.db __pycache__ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 26820aa..7ff47e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ -image: gradle:alpine +image: gradle:7-jdk11 variables: - GRADLE_OPTS: "-Dorg.gradle.daemon=false" + GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m" before_script: - export GRADLE_USER_HOME=`pwd`/.gradle @@ -12,7 +12,7 @@ stages: build: stage: build - script: ./gradlew --build-cache assemble + script: gradle --build-cache assemble cache: key: "$CI_COMMIT_REF_NAME" policy: push @@ -22,7 +22,7 @@ build: test: stage: test - script: ./gradlew check + script: gradle check cache: key: "$CI_COMMIT_REF_NAME" policy: pull diff --git a/.idea/bitly-shorten.iml b/.idea/bitly-shorten.iml deleted file mode 100644 index 78b2cc5..0000000 --- a/.idea/bitly-shorten.iml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/copyright/Erik_s_Copyright_Notice.xml b/.idea/copyright/Erik_s_Copyright_Notice.xml index 08660a1..0b64fd2 100644 --- a/.idea/copyright/Erik_s_Copyright_Notice.xml +++ b/.idea/copyright/Erik_s_Copyright_Notice.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index d80efca..37ad52e 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -36,5 +36,20 @@