Skip to content

Commit

Permalink
Define template repository code
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospereira committed Sep 13, 2023
1 parent 2db577a commit bf879e9
Show file tree
Hide file tree
Showing 44 changed files with 1,766 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# flyctl launch added from .gitignore
**/bin
**/Thumbs.db
**/.DS_Store
**/.gradle
**/build
**/target
**/out
**/.micronaut
**/.idea
**/*.iml
**/*.ipr
**/*.iws
**/.project
**/.settings
**/.classpath
**/.factorypath

# Added from .idea/.gitignore
# Default ignored files
.idea/shelf
.idea/workspace.xml
# Editor-based HTTP Client requests
.idea/httpRequests
# Datasource local storage ignored files
.idea/dataSources
.idea/dataSources.local.xml
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*.{kt,kts}]
ktlint_code_style = intellij_idea
indent_size = 4
indent_style = space

max_line_length = 120
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
71 changes: 71 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#
# Configuration for Github App Settings:
# https://github.com/apps/settings
#
---
repository:
name: project-starter
description: "UFPE / Liber / project-starter"
homepage: "http://www.liber.ufpe.br/project-starter/"
private: true
has_issues: true
has_projects: true
has_wiki: false
default_branch: main
allow_squash_merge: false
allow_merge_commit: true
allow_rebase_merge: true
delete_branch_on_merge: true
enable_automated_security_fixes: true
enable_vulnerability_alerts: true

labels:
- name: "bug"
description: "Something isn't working"
color: "#D73A4A"
- name: "documentation"
description: "Improvements or additions to documentation"
color: "#0075CA"
- name: "duplicate"
description: "This issue or pull request already exists"
color: "#CFD3D7"
- name: "enhancement"
description: "New feature or request"
color: "#A2EEEF"
- name: "good first issue"
description: "Good for newcomers"
color: "#7057FF"
- name: "help wanted"
description: "Extra attention is needed"
color: "#008672"
- name: "invalid"
description: "This doesn't seem right"
color: "#E4E669"
- name: "question"
description: "Further information is requested"
color: "#D876E3"
- name: "wontfix"
description: "This will not be worked on"
color: "#FFFFFF"
- name: "dependencies"
description: "Pull requests that update a dependency file"
color: "#0366D6"
- name: "github_actions"
description: "Pull requests that update GitHub Actions code"
color: "#000000"
- name: "java"
description: "Pull requests that update Java code"
color: "#FFA221"

branches:
- name: main
protection:
enforce_admins: true
required_linear_history: true
required_pull_request_reviews:
required_approving_review_count: 1
dismiss_stale_reviews: false
require_code_owner_reviews: false
required_status_checks:
strict: true
context: ["Build / compile", "Tests / test"]
115 changes: 115 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
compile:
name: Build / compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Run testCompile
run: ./gradlew compileTestKotlin

detekt:
name: Code Analysis / detekt
runs-on: ubuntu-latest
needs:
- compile
steps:
- uses: actions/checkout@v4
- name: detekt report
uses: natiginfo/[email protected]
with:
args: |
--report md:build/reports/detekt/detekt.md
- name: Detekt Summary
run: cat build/reports/detekt/detekt.md >> $GITHUB_STEP_SUMMARY

ktlint:
name: Code Analysis / ktlint
runs-on: ubuntu-latest
needs:
- compile
steps:
- uses: actions/checkout@v4
- uses: nbadal/action-ktlint-setup@v1
- name: ktlint version
run: ktlint --version
- 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

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
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Output Kover summary
# Adapted from https://github.com/Kotlin/kotlinx-kover/issues/419#issuecomment-1632572084
run: |
pandoc build/reports/kover/html/index.html -f html -t gfm | \
sed -n '/# project-starter: Overall Coverage Summary/,/<\/div>/p' | \
grep -v "</div>" >> $GITHUB_STEP_SUMMARY
- name: Test Summary Report
uses: phoenix-actions/test-reporting@v12
if: always()
with:
name: Kotest Report
path: "build/test-results/test/TEST-*.xml"
reporter: java-junit
output-to: "step-summary"
only-summary: "true"

build:
name: Package / build
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- name: Run build
run: ./gradlew build

build-docker:
name: Package / Docker / build
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v1
- name: Run dockerBuild
run: ./gradlew dockerBuild
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Main

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

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
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
code-coverage:
name: Test / code coverage
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 }}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.gradle
**/build/
!src/**/build/

bin

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
Thum
bs.db
.DS_Store
out/
.micronaut/
.idea
*.iml
*.ipr
*.iws
.settings
.factorypath
Loading

0 comments on commit bf879e9

Please sign in to comment.