From a0170357aea0f4af2e61973453166bd6f9749531 Mon Sep 17 00:00:00 2001 From: Aleksandr Chikovani Date: Mon, 28 Aug 2023 22:41:04 -0400 Subject: [PATCH] chore: test --- .github/workflows/docker-publish.yml | 91 +++--- .github/workflows/gradle-build.yml | 12 +- build.gradle | 12 + config/checkstyle/checkstyle.xml | 415 +++++++++++++++++++++++++++ 4 files changed, 484 insertions(+), 46 deletions(-) create mode 100644 config/checkstyle/checkstyle.xml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 77a121a7d..e6cc21816 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -8,6 +8,36 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + style_checks: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK ${{matrix.java}} + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' + - name: Codestyle + continue-on-error: true #TODO: make false + run: ./gradlew checkstyleMain + + code_checks: + runs-on: ubuntu-latest + + #TODO: cache for libs + steps: + - uses: actions/checkout@v3 + - name: Set up JDK ${{matrix.java}} + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' + - name: Test + run: ./gradlew test + - name: Build + run: ./gradlew build + build_and_publish: runs-on: ubuntu-latest outputs: @@ -22,9 +52,6 @@ jobs: with: fetch-depth: 0 - - name: Code style check - run: echo "NIY" - - name: Calculate version id: semantic run: | @@ -91,8 +118,8 @@ jobs: release: needs: build_and_publish runs-on: ubuntu-latest - #environment: - # name: release + environment: + name: release permissions: contents: write packages: write @@ -137,10 +164,6 @@ jobs: export FIXES_ENABLED=1 done - echo "debugdebug" - wc -l /tmp/my_commits_log - echo 'debugdebug' - egrep -v "${FEATURES_REGEX}|${FIXES_REGEX}" /tmp/my_commits_log | while read l; do echo "* ${l}" >> /tmp/my_changelog_other export OTHER_ENABLED=1 @@ -174,43 +197,23 @@ jobs: echo "EOF" } >> "$GITHUB_ENV" - echo "For debug purposes:" - cat /tmp/my_changelog + - name: Login to GitHub Container Registry + uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: debug - run: | - echo ${{ needs.build_and_publish.outputs.next_version }} - echo - echo - echo $CHANGELOG + - name: Build and push Docker image + uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 + with: + context: . + push: true + tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.release-version }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + VERSION=${{ steps.semantic.outputs.release-version }} - #- name: Login to GitHub Container Registry - # uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc - # with: - # registry: ghcr.io - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - - #- name: Build and push Docker image - # uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 - # with: - # context: . - # push: true - # tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.release-version }} - # labels: ${{ steps.meta.outputs.labels }} - # build-args: | - # VERSION=${{ steps.semantic.outputs.release-version }} - - #- name: Publish tag - # uses: rickstaa/action-create-tag@07b918ecbf94359b859f25f7a70553a84e804923 - # with: - # tag: ${{ needs.build_and_publish.outputs.next_version }} - # message: | - # ${{ needs.build_and_publish.outputs.next_version }} - - # ${{ env.CHANGELOG }} - # #TODO: force_push_tag is true for debug purpose only - # force_push_tag: true - name: Release uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index e95a17211..ebdbc555b 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -13,10 +13,18 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set up JDK ${{matrix.java}} + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' - name: PR title check - run: echo "NIY" + run: | + echo "NIY" + echo "${{ github.event.pull_request.title }}" - name: Codestyle - run: echo "NIY" + continue-on-error: true #TODO: make false + run: ./gradlew checkstyleMain code_checks: runs-on: ubuntu-latest diff --git a/build.gradle b/build.gradle index bb01b85f0..63fc99b35 100644 --- a/build.gradle +++ b/build.gradle @@ -44,3 +44,15 @@ dependencies { tasks.named('test') { useJUnitPlatform() } + +apply plugin: 'checkstyle' +checkstyle { + toolVersion '7.8.1' + configFile file("config/checkstyle/checkstyle.xml") +} +checkstyleMain { + source ='src/main/java' +} +checkstyleTest { + source ='src/test/java' +} diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 000000000..d4010afb2 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,415 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +