Skip to content

Commit

Permalink
Atualiza o template de acordo com as aplicações
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospereira committed Oct 26, 2023
1 parent 42cfc39 commit 882f15a
Show file tree
Hide file tree
Showing 25 changed files with 476 additions and 215 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
rebase-strategy: auto
schedule:
interval: "daily"
day: "sunday"
commit-message:
prefix: "[gradle]"
- package-ecosystem: "github-actions"
directory: "/"
rebase-strategy: auto
schedule:
interval: "weekly"
day: "sunday"
commit-message:
prefix: "[github-actions]"
130 changes: 107 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,29 @@ on:
permissions:
contents: read

env:
GRADLE_OPTS: "-Dorg.gradle.console=plain"

jobs:
compile:
name: Build / compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- uses: Liber-UFPE/spring-gradle-build-action@v2
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Run testCompile
run: ./gradlew compileTestKotlin
- name: Starts Gradle Daemon
run: ./gradlew
# Manually execute the task graph to measure time
- run: ./gradlew generateJte
- run: ./gradlew kspKotlin
- run: ./gradlew processResources
- run: ./gradlew compileKotlin
- run: ./gradlew compileJava
- run: ./gradlew classes
- run: ./gradlew kspTestKotlin
- run: ./gradlew compileTestKotlin

detekt:
name: Code Analysis / detekt
Expand Down Expand Up @@ -49,31 +61,58 @@ jobs:
- name: run ktlin
run: ktlint --relative >> $GITHUB_STEP_SUMMARY

# diktat:
# name: Code Analysis / diktat
# runs-on: ubuntu-latest
# needs:
# - compile
# steps:
# - uses: actions/checkout@v4
# - uses: Liber-UFPE/spring-gradle-build-action@v1
# - name: Run diktatCheck
# run: ./gradlew diktatCheck mergeDiktatReports
accessibility-test:
name: Tests / Accessibility
runs-on: ubuntu-latest
# Since this job is experimental
continue-on-error: true
needs:
- detekt
- ktlint
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v2
# Manually execute the task graph to measure time
- run: ./gradlew generateJte
- run: ./gradlew kspKotlin
- run: ./gradlew processResources
- run: ./gradlew compileKotlin
- run: ./gradlew compileJava
- run: ./gradlew classes
- run: ./gradlew kspTestKotlin
- run: ./gradlew compileTestKotlin
- run: ./gradlew testClasses
- run: ./gradlew kspAccessibilityTestKotlin
- run: ./gradlew processAccessibilityTestResources
- run: ./gradlew compileAccessibilityTestKotlin
- run: ./gradlew compileAccessibilityTestJava
- run: ./gradlew accessibilityTestClasses
- name: Run Accessibility Tests
# For some annoying reason, Gradle insists in execute the `test` task
# too. -x removes it from the task graph for this execution.
run: ./gradlew accessibilityTest

test:
name: Tests / test
runs-on: ubuntu-latest
needs:
- detekt
- ktlint
# - diktat
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- name: Run tests
run: ./gradlew test
- name: Coverage HTML Report
run: ./gradlew koverHtmlReport
- uses: Liber-UFPE/spring-gradle-build-action@v2
# Manually execute the task graph to measure time
- run: ./gradlew generateJte
- run: ./gradlew kspKotlin
- run: ./gradlew processResources
- run: ./gradlew compileKotlin
- run: ./gradlew compileJava
- run: ./gradlew classes
- run: ./gradlew kspTestKotlin
- run: ./gradlew compileTestKotlin
- run: ./gradlew testClasses
- run: ./gradlew test
- run: ./gradlew koverHtmlReport
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Output Kover summary
Expand All @@ -99,9 +138,15 @@ jobs:
- test
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- name: Run build
run: ./gradlew build
- uses: Liber-UFPE/spring-gradle-build-action@v2
# Manually execute the task graph to measure time
- run: ./gradlew generateJte
- run: ./gradlew kspKotlin
- run: ./gradlew processResources
- run: ./gradlew compileKotlin
- run: ./gradlew compileJava
- run: ./gradlew classes
- run: ./gradlew shadowJar

build-docker:
name: Package / Docker / build
Expand All @@ -110,6 +155,45 @@ jobs:
- test
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- uses: Liber-UFPE/spring-gradle-build-action@v2
- name: Run dockerBuild
run: ./gradlew dockerBuild

check-if-prod:
if: ${{ github.ref == 'refs/heads/main' }}
name: Check if prod
runs-on: ubuntu-latest
needs:
- test
steps:
- run: echo "This is a push to main branch. Following with release and deploy"

create-release:
name: Creates a GitHub Release
runs-on: ubuntu-latest
needs:
- check-if-prod
- build
# Docs:
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
contents: write
packages: read # to preserve default permissions
steps:
- uses: actions/checkout@v4
with:
# `0` indicates all history for all branches and tags.
# See https://github.com/actions/checkout#usage.
# This is relevant to properly generate git.properties file
# when deploying.
fetch-depth: 0
- uses: Liber-UFPE/spring-gradle-build-action@v2
- name: Create Release Package
run: ./gradlew clean shadowJar
- name: Create Github Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_TITLE=$(./gradlew releaseDate --quiet)
TAG_NAME="v${{ github.run_number }}-$(git log HEAD -1 --pretty=format:'%h')"
gh release create "$TAG_NAME" ./build/libs/*.jar --title "$RELEASE_TITLE" --generate-notes --latest
69 changes: 20 additions & 49 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,29 @@
name: Main

on:
workflow_run:
workflows: [CI]
branches: [main]
types:
- completed
push:
branches: [ main ]

jobs:
on-ci-workflow-failure:
name: CI / Failure
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
steps:
# `false` makes this step fail, which is what we want
# since no code coverage will be reported.
- run: |
echo 'The triggering workflow failed' && false
permissions:
contents: write

on-ci-workflow-success:
name: CI / Success
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Triggering Workflow Summary
run: |
echo "## CI Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Summary for the workflow that triggered this deploy." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Field | Value |" >> $GITHUB_STEP_SUMMARY
echo "|:------|:------|" >> $GITHUB_STEP_SUMMARY
echo "| Id | ${{ github.event.workflow_run.id }} |" >> $GITHUB_STEP_SUMMARY
echo "| Title | ${{ github.event.workflow_run.display_title }} |" >> $GITHUB_STEP_SUMMARY
echo "| URL | <${{ github.event.workflow_run.html_url }}> |" >> $GITHUB_STEP_SUMMARY
echo "| Started at | ${{ github.event.workflow_run.created_at }} |" >> $GITHUB_STEP_SUMMARY
echo "| Finished at | ${{ github.event.workflow_run.updated_at }} |" >> $GITHUB_STEP_SUMMARY
echo "| Who | [${{ github.event.workflow_run.actor.login }}](${{ github.event.workflow_run.actor.html_url}}) |" >> $GITHUB_STEP_SUMMARY
env:
GRADLE_OPTS: "-Dorg.gradle.console=plain"

code-coverage:
name: Test / code coverage
jobs:
gh-dependency-graph:
name: Generate and Submit Dependency Graph
runs-on: ubuntu-latest
needs:
- on-ci-workflow-success
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- name: Run tests
run: ./gradlew test
- name: Coverage XML Report
run: ./gradlew koverXmlReport
- name: Report results to DeepSource
run: |
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key kotlin --value-file build/reports/kover/report.xml
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
dependency-graph: generate-and-submit
- name: Generate Dependency Graph
run: ./gradlew compileTestKotlin
Loading

0 comments on commit 882f15a

Please sign in to comment.