diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index caae039..766846d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,23 +1,76 @@ -name: CI +name: Tests on: push: - branches: [ action, master ] + branches: + - 'master' pull_request: - branches: [ action, master ] + branches: + - 'master' jobs: - build: - + test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - uses: eskatos/gradle-command-action@v1 - with: - gradle-version: 6.8 - arguments: test + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: '7.1' + arguments: build -x test -x ktlintKotlinScriptCheck -x ktlintTestSourceSetCheck -x ktlintMainSourceSetCheck + - name: Cleanup Gradle Cache + # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. + # Restoring these files from a GitHub Actions cache might cause problems for future builds. + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + + - name: Lint + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: '7.1' + arguments: ktlintCheck + + - name: Test + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: '7.1' + arguments: test + + - name: Coverage + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: '7.1' + arguments: jacocoTestReport + + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: Push analyse to sonarqube + uses: eskatos/gradle-command-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + gradle-version: '7.1' + arguments: sonarqube --info diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2e6f2c5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,53 @@ +name: Publish + +on: + release: + types: [ published ] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: '7.1' + arguments: build -x test -x ktlintKotlinScriptCheck -x ktlintTestSourceSetCheck -x ktlintMainSourceSetCheck + - name: Cleanup Gradle Cache + # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. + # Restoring these files from a GitHub Actions cache might cause problems for future builds. + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + + - name: Test + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: '7.1' + arguments: test + + - name: Publish + uses: eskatos/gradle-command-action@v1 + with: + gradle-version: '7.1' + arguments: publish + env: + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.idea/.gitignore b/.idea/.gitignore index 3ad53bc..f50cf27 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -5,6 +5,5 @@ /dataSources.local.xml /compiler.xml /uiDesigner.xml -/dataSources.xml /sonarlint/ /jarRepositories.xml \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 877b662..85e6648 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -17,15 +17,7 @@