Skip to content

Commit

Permalink
🎉 initial source: add project #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen215 committed Jul 27, 2024
0 parents commit fe575e7
Show file tree
Hide file tree
Showing 25 changed files with 1,043 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

111 changes: 111 additions & 0 deletions .github/workflows/ci_notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Notify

on:
push:
branches: ["master"]
tags:
- "v*"
pull_request:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

notify:
runs-on: ubuntu-latest
needs: build
steps:
- name: Check Secrets
id: check
run: |
if [[ -z "${{ secrets.TELEGRAM_CHAT_ID }}" || -z "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
echo "::set-output name=skip::true"
else
echo "::set-output name=skip::false"
fi
- name: Send Telegram Notification
if: steps.check.outputs.skip == 'false'
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
format: markdown
message: |
🚀 CI Commit
🔯 `${{ github.actor }}` created commit:
- message: `${{ github.event.commits[0].message }}`
- hash: `${{ github.sha }}`
- repository: `${{ github.repository }}`
- head: `${{ github.event.head_commit.message }}`
🍀 See changes: `https://github.com/${{ github.repository }}/commit/${{github.sha}}`
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check if tag exists
id: check_tag
run: |
if [ -n "$GITHUB_REF" ]; then
TAG=${GITHUB_REF#refs/tags/}
# echo "::set-output name=tag::$TAG"
echo "TAG=${TAG}" >> $GITHUB_ENV
else
# echo "::set-output name=tag::"
echo "TAG=" >> $GITHUB_ENV
fi
shell: bash

- name: Check Secrets
id: check
run: |
if [[ -z "${{ secrets.TELEGRAM_CHAT_ID }}" || -z "${{ secrets.TELEGRAM_BOT_TOKEN }}" ]]; then
echo "::set-output name=skip::true"
else
echo "::set-output name=skip::false"
fi
- name: Generate Changelog
id: changelog
run: |
# Generate your changelog here and set it as an output variable
CHANGELOG=$(git log --pretty=format:"%h - %s" -n 10)
echo "::set-output name=changelog::$CHANGELOG"
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG }}
body: |
:gem: released new version ${{ env.TAG }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Send Telegram Notification
if: steps.check.outputs.skip == 'false'
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
format: markdown
message: |
🚀 New tag created: **${{ env.TAG }}**
🔯 `${{ github.actor }}` created tag:
- repository: `${{ github.repository }}`
- head: `${{ github.event.head_commit.message }}`
🍀 See changes: `https://github.com/${{ github.repository }}/releases/tag/${{ env.TAG }}`
📜 Changelog:
`${{ steps.changelog.outputs.changelog }}`
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
logs/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**
!**/src/test/**
plugin/build/
plugin/bin/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
src/main/java/META-INF/
*.gz
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Define the directory where the JAR file is located after build
BUILD_DIR=./plugin/build
LOG_DIR=logs
# Declare targets as phony to avoid conflicts with files of the same name
.PHONY: build test jar clean

build:
clear
rm -rf $(BUILD_DIR)
./gradlew jar

clean:
./gradlew clean

jar: build

list-task:
./gradlew tasks

test:
./gradlew test

groovy:
./gradlew build

tree:
# Create logs directory if not exists
mkdir -p $(LOG_DIR)
# Generate project structure and save it to logs/project_structure.txt
tree -I ".gradle|.idea|build|logs" > ./$(LOG_DIR)/project_structure.txt
111 changes: 111 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# wizards2s4j

## Introduction

**wizards2s4j**: A Java 1.8 library offering a robust collection of utility functions for streamlined development. It
provides an opinionated view of the Spring platform and third-party libraries, enabling you to get started with minimal
configuration.

## Features

- Comprehensive set of utility functions.
- Written in Java 1.8.
- Well-documented code for easy understanding.
- Regular updates and maintenance.

## Installation

```bash
git clone --depth 1 https://github.com/sivaosorg/wizards2s4j.git
```

## Generation Plugin Java

```bash
curl https://gradle-initializr.cleverapps.io/starter.zip -d type=groovy-gradle-plugin -d testFramework=testng -d projectName=wizards2s4j -o wizards2s4j.zip
```

## Modules

Explain how users can interact with the various modules.

### Tidying up

To tidy up the project's Java modules, use the following command:

```bash
./gradlew clean
```

or

```bash
make clean
```

### Building SDK

```bash
./gradlew jar
```

or

```bash
make jar
```

### Upgrading version

- file `gradle.yml`

```yaml
ng:
name: wizards2s4j
version: v1.0.0
enabled_link: false # enable compression and attachment of the external libraries
jars:
# unify4J: Java 1.8 skeleton library offering a rich toolkit of utility functions
# for collections, strings, date/time, JSON, maps, and more.
- enabled: false # enable compression and attachment of the external libraries
source: "./../libs/unify4j-v1.0.0.jar"
# alpha4J: is a Java 8 library featuring common data structures and algorithms.
# Enhance your projects with efficient and easy-to-use implementations designed for performance and clarity.
- enabled: true
source: "./../libs/alpha4j-v1.0.0.jar"
```
## Add dependencies
```groovy
// The "spring-core" library, version 5.3.31, is a fundamental component of the Spring Framework,
// offering essential functionality for dependency injection, bean management, and core utilities to facilitate robust Java application development within the Spring ecosystem.
implementation group: 'org.springframework', name: 'spring-core', version: '5.3.31'
// The "spring-boot-starter-web" library, version 2.7.18, is a Spring Boot starter module that facilitates the setup of web applications,
// providing essential dependencies and configurations for building web-based projects.
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.7.18'
// The "spring-boot-configuration-processor" library, version 2.7.18,
// is a Spring Boot module that processes configuration metadata annotations to generate metadata files and aid in auto-configuration of Spring applications.
implementation group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: '2.7.18'
```
## Integration
1. Add dependency into file `build.gradle`

```gradle
implementation files('libs/wizards2s4j-v1.0.0.jar') // filename based on ng.name and ng.version
```

2. Edit file `main Spring Boot application` (optional)

```java
@SpringBootApplication
@ComponentScan(basePackages = {"your_package", "org.wizards2s4j"}) // root name of package wizard4j
public class ApiApplication {
public static void main(String[] args) {
SpringApplication.run(ApiApplication.class, args);
}
}
```
25 changes: 25 additions & 0 deletions TOOLS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Tree

You can use the tree command-line utility in Node.js to generate a tree-like structure of your project directory. Here's
how you can use it:

First, make sure you have the `tree-node-cli` package installed globally:

```bash
npm install -g tree-node-cli
```

Then, navigate to your project directory and run the following command:

```bash
tree -I "node_modules|.git|.DS_Store"
```

If you want to save the output to a file instead of printing it to the console, you can use the -o option followed by
the file path:

```bash
tree -I "node_modules|.git|.DS_Store" > project_structure.txt
```

This will save the output to a file named `project_structure.txt`.
53 changes: 53 additions & 0 deletions VERSION_RELEASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Version Releases

## Semantic Versioning (SemVer): `vMAJOR.MINOR.PATCH`

Example:

- v1.0.0
- v1.0.1
- v1.1.1

## Pre-release versions: `vMAJOR.MINOR.PATCH-<BETA/RC/SNAPSHOT>.<number>`

Example:

- v1.0.0-beta.1
- v1.0.0-beta.2
- v1.2.3-rc1
- v1.2.3-SNAPSHOT

## Post-release versions: `vMAJOR.MINOR.PATCH-POST.<number>`

Example:

- v1.2.3-post.1
- v1.2.3-post.2

## Local versions: `vMAJOR.MINOR.PATCH+LOCAL`

Example:

- v1.0.0+local
- v1.1.0+local

## Caret range versions: `^MAJOR.MINOR.PATCH`

Example:

- ^1.2.3 (similar `>=1.2.3 < 2.0.0`)

## Tilde range versions: `~MAJOR.MINOR.PATCH`

Example:

- ~1.2.3 (similar `>=1.2.3 <1.3.0`)

---

Notes:

- `MAJOR`: major version.
- `MINOR`: Minor version, often adding new features.
- `PATCH`: Patch version, typically fixing bugs.
- `SNAPSHOT`: Indicates a version under development or in progress. It is often used to represent the latest state of the codebase and may include ongoing changes and features that are not yet finalized. This allows developers to work with the most recent developments in a project.
8 changes: 8 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format

[versions]
spock-core = "2.2-groovy-3.0"

[libraries]
spock-core = { module = "org.spockframework:spock-core", version.ref = "spock-core" }
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit fe575e7

Please sign in to comment.