Skip to content

Commit

Permalink
💚 TEST_VERBOSE env, exclude coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
trydofor committed Jan 17, 2024
1 parent 5c0d26e commit 72a7c4e
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 35 deletions.
80 changes: 48 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,42 @@ on:
workflow_dispatch:
inputs:
testCoverReport:
description: 'test and coveralls report?'
description: 'test and coverage report?'
default: true
type: boolean
required: false
testFailureIgnore:
description: 'maven.test.failure.ignore?'
description: 'test ignore failure?'
default: false
type: boolean
required: false
testVerbose:
description: 'test output verbose'
default: true
type: boolean
required: false
deployOssrh:
description: 'deploy to ossrh?'
default: true
type: boolean
required: false
release:
types: [published]

jobs:
release:
name: Release to Sonatype
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Xmx2g
TEST_VERBOSE: ${{ inputs.testVerbose }}

steps:
- name: Checkout ${{github.event.release.tag_name}}
uses: actions/checkout@v4
with:
fetch-depth: 10

## chache asdf/, m2/repository
- name: Cache Sdk & Repo
id: cache-sdk-repo
Expand All @@ -43,7 +59,26 @@ jobs:

## write settings.xml
- name: Maven settings.xml
id: settings
run: |
JAVA_HOME=$(asdf where java)
echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_OUTPUT"
echo "GIT_BRANCH=$(git branch --show-current)" >> "$GITHUB_OUTPUT"
_opt=$(git describe --tags --exact-match 2>/dev/null || true)
if [ "$_opt" != "" ]; then
_opt="-Drevision=$_opt"
echo $_opt
echo "MVN_REVISION=$_opt" >> "$GITHUB_OUTPUT"
fi
_ver=$(mvn --quiet --non-recursive -DforceStdout -Dexpression=project.version $_opt help:evaluate)
echo $_ver
echo "WINGS_VERSION=$_ver" >> "$GITHUB_OUTPUT"
mvn -v
git --no-pager log --graph -10 --pretty=format:'%H - %ai %d %s'
mkdir -p ~/.m2
cat > ~/.m2/settings.xml << "EOF"
<settings>
Expand All @@ -57,56 +92,37 @@ jobs:
</servers>
</settings>
EOF
## get JAVA_HOME
- name: Env JAVA_HOME
id: java-env
run: echo "JAVA_HOME=$(asdf where java)" >> "$GITHUB_OUTPUT"
## get revision if release
- name: Opt revision
id: opt-revision
if: github.event.release.tag_name != ''
run: echo "OPT_REVISION=-Drevision=${{github.event.release.tag_name}}" >> "$GITHUB_OUTPUT"
## info deploy
- name: Info Deploy
run: |
mvn --quiet --non-recursive -DforceStdout -Dexpression=project.version ${{ steps.opt-revision.outputs.OPT_REVISION }} help:evaluate
echo
mvn -v
git --no-pager log --graph -10 --pretty=format:'%H - %an, %ad %d : %s'
env:
JAVA_HOME: ${{ steps.java-env.outputs.JAVA_HOME }}
## ci report if not release
- name: Coveralls Report
## report if not release
- name: Test Coverage ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }}
if: inputs.testCoverReport
run: >
mvn
--quiet
--fail-at-end
-P ci
-Dtest-verbose=false
-Dmaven.test.skip=false
-P test
-Dmaven.test.failure.ignore=${{ inputs.testFailureIgnore }}
-DrepoToken=${{ secrets.COVERALLS_REPO_TOKEN }}
clean test jacoco:report coveralls:report
env:
JAVA_HOME: ${{ steps.java-env.outputs.JAVA_HOME }}
JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }}
## import gpp private key
- name: Import GPG key
if: inputs.deployOssrh
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.MVN_GPG_SKEY }}
passphrase: ${{ secrets.MVN_GPG_PASS }}

## maven deploy
- name: Maven Deploy
- name: Deploy ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }}
if: inputs.deployOssrh
run: >
mvn
-P ossrh
${{ steps.opt-revision.outputs.OPT_REVISION }}
${{ steps.settings.outputs.MVN_REVISION }}
-Dgpg.passphrase=${MVN_GPG_PASS}
-Dmaven.test.skip=true
clean deploy
env:
JAVA_HOME: ${{ steps.java-env.outputs.JAVA_HOME }}
JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }}
MVN_OSS_USER: ${{ secrets.MVN_OSS_USER }}
MVN_OSS_PASS: ${{ secrets.MVN_OSS_PASS }}
MVN_GPG_PASS: ${{ secrets.MVN_GPG_PASS }}
17 changes: 16 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
<profiles>
<profile>
<!-- -DrepoToken=${{ secrets.COVERALLS_REPO_TOKEN }} -->
<id>ci</id>
<id>test</id>
<properties>
<maven.test.skip>false</maven.test.skip>
</properties>
Expand All @@ -278,6 +278,21 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.11</version>
<configuration>
<excludes>
<exclude>**/best/**</exclude>
<exclude>**/stat/**</exclude>
<exclude>**/flow/**</exclude>
<exclude>**/img/**</exclude>
<exclude>**/data/Null*</exclude>
<exclude>**/data/Q*</exclude>
<exclude>**/data/R*</exclude>
<exclude>**/data/U*</exclude>
<exclude>**/*Assert.*</exclude>
<exclude>**/*Exception.*</exclude>
<exclude>**/WhoAmI.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/pro/fessional/mirana/SystemOut.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
public class SystemOut {

public static final String TestVerbose = "test-verbose";
public static final String TestVerbose = "TEST_VERBOSE";
private static volatile Boolean NotTestVerbose = null;

public static void printf(String format, Object... args) {
Expand All @@ -26,7 +26,7 @@ public static void printStackTrace(Throwable t) {

public static boolean notTestVerbose() {
if (NotTestVerbose == null) {
NotTestVerbose = "false".equalsIgnoreCase(System.getProperty(TestVerbose));
NotTestVerbose = "false".equalsIgnoreCase(System.getenv(TestVerbose));
}
return NotTestVerbose;
}
Expand Down

0 comments on commit 72a7c4e

Please sign in to comment.