From 0c1ed04c623bd7dcb19e76f02350ecf289dc73a7 Mon Sep 17 00:00:00 2001 From: Alex Zima Date: Mon, 18 Apr 2022 14:20:27 +0000 Subject: [PATCH] feat: integrate codecov - enable semantic-release maven steps - enable lint ans test jobs in ci - add Upload coverage step to test job Closes: #81 --- .github/workflows/DEPLOY.yml | 112 +++++++++++++++++++---------------- .releaserc.yml | 10 ++-- 2 files changed, 66 insertions(+), 56 deletions(-) diff --git a/.github/workflows/DEPLOY.yml b/.github/workflows/DEPLOY.yml index e3f6776..6badaeb 100644 --- a/.github/workflows/DEPLOY.yml +++ b/.github/workflows/DEPLOY.yml @@ -17,53 +17,10 @@ permissions: pull-requests: write jobs: - # commit-lint: - # if: ${{ github.event_name != 'pull_request' || !(github.head_ref == 'rc' && github.base_ref == 'master') }} - # name: Lint Commit Messages - # runs-on: ubuntu-latest - # steps: - # - name: ⤵️ Check out code from GitHub - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # - # - uses: wagoid/commitlint-github-action@v4.1.9 - # with: - # configFile: .github/commitlint.config.js - # helpURL: https://www.conventionalcommits.org - - # run-test: - # needs: [ commit-lint ] - # name: Run tests - # runs-on: ubuntu-latest - # steps: - # - name: ⤵️ Check out code from GitHub - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # - # - name: init jvm - # uses: actions/setup-java@v2 - # with: - # distribution: 'temurin' - # java-version: '11' - # cache: 'maven' - # - # - run: ./mvnw clean test - # - # - name: Publish Unit Test Results - # uses: EnricoMi/publish-unit-test-result-action@v1 - # if: always() - # with: - # files: "target/surefire-reports/TEST-*.xml" - - release: + lint: if: ${{ !(github.event_name == 'pull_request' && contains('master rc', github.head_ref)) }} - # needs: [ run-test ] - name: Release + name: Lint runs-on: ubuntu-latest - outputs: - new_release_published: ${{ steps.release.outputs.new_release_published }} steps: - name: Debug action uses: hmarr/debug-action@v2.0.1 @@ -74,18 +31,71 @@ jobs: GITHUB_CONTENT: "${{ toJson(github) }}" run: "echo 'Debug echo'" + - name: ⤵️ Check out code from GitHub + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Lint Commit Messages + uses: wagoid/commitlint-github-action@v4.1.9 + with: + configFile: .github/commitlint.config.js + helpURL: https://www.conventionalcommits.org + + test: + needs: [ lint ] + name: Run tests + runs-on: ubuntu-latest + steps: + - name: ⤵️ Check out code from GitHub + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: init jvm + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '11' + cache: 'maven' + + - name: Run tests + run: ./mvnw clean package + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3.0.0 + with: + # token: ${{ secrets.CODECOV_TOKEN }} Required for private repos + files: target/site/jacoco/jacoco.xml + env_vars: RUNNER_OS,JAVA_HOME + verbose: true + fail_ci_if_error: true + + - name: Publish Unit Test Results + uses: EnricoMi/publish-unit-test-result-action@v1 + if: always() + with: + files: "target/surefire-reports/TEST-*.xml" + + release: + needs: [ test ] + name: Release + runs-on: ubuntu-latest + outputs: + new_release_published: ${{ steps.release.outputs.new_release_published }} + steps: - name: ⤵️ Check out code from GitHub uses: actions/checkout@v3 with: fetch-depth: 0 persist-credentials: false - # - name: init jvm - # uses: actions/setup-java@v2 - # with: - # distribution: 'temurin' - # java-version: '11' - # cache: 'maven' + - name: init jvm + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '11' + cache: 'maven' - name: init npm uses: actions/setup-node@v3 diff --git a/.releaserc.yml b/.releaserc.yml index fbeb9d5..a21cdec 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -24,11 +24,11 @@ plugins: - "@semantic-release/release-notes-generator" - "@semantic-release/changelog" - - "@semantic-release/exec" - # - prepareCmd: | - # ./mvnw -B com.mycila:license-maven-plugin:4.1:format org.codehaus.mojo:license-maven-plugin:2.0.0:add-third-party - # publishCmd: | - # ./mvnw -B clean license:check package - - successCmd: | + - prepareCmd: | + ./mvnw -B com.mycila:license-maven-plugin:4.1:format org.codehaus.mojo:license-maven-plugin:2.0.0:add-third-party + publishCmd: | + ./mvnw -B clean license:check package + successCmd: | echo "::set-output name=new_release_published::true" echo "::set-output name=new_release_version::${nextRelease.version}" echo "::set-output name=branch_type::${branch.type}"