Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jinganix committed Jan 27, 2024
1 parent bda2dc9 commit b14bb49
Show file tree
Hide file tree
Showing 921 changed files with 43,733 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/1-bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: "Bug Report"
about: Report a bug
---
<!--
Oh hi there!
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
-->


# Bug Report

### Description
<!-- edit: --> A clear and concise description of the problem...

### Is this a regression?

<!-- Did this behavior use to work in the previous version? -->
<!-- edit: --> Yes, the previous version in which this bug was not present was: ....

## Exception or Error
<pre><code>
<!-- If the issue is accompanied by an exception or an error, please share it below: -->

</code></pre>

## Steps to Reproduce

<!-- Please provide detailed steps for reproducing the issue. -->

1. step 1
2. step 2
3. you get it...

## Context

<!--
Please provide any relevant information about your setup.
This is important in case the issue is not reproducible except for under certain conditions.
-->

* Operating System:
* JDK version:
* Application version:
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/2-feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "Feature Request"
about: Suggest a feature
---
<!--
Oh hi there!
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
-->


# Feature Request

### Description
<!-- edit: --> A clear and concise description of the problem or missing capability...


### Describe the solution you'd like
<!-- edit: --> If you have a solution in mind, please describe it.


### Describe alternatives you've considered
<!-- edit: --> Have you considered any alternative solutions or workarounds?
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
42 changes: 42 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## PR Checklist
Please check if your PR fulfills the following requirements:

- [ ] The commit message follows our guidelines: https://github.com/jinganix/guess/blob/master/CONTRIBUTING.md#commit
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)


## PR Type
What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:


## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A


## What is the new behavior?


## Does this PR introduce a breaking change?

- [ ] Yes
- [ ] No


<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->


## Other information
17 changes: 17 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":semanticCommits"
],
"packageRules": [
{
"matchUpdateTypes": [
"minor",
"patch"
],
"matchCurrentVersion": "!/^0/",
"automerge": true
}
]
}
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches:
- master
schedule:
- cron: '0 10 * * *' # Once per day at 10am UTC

jobs:
commitlint:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
with:
configFile: package.json
failOnWarnings: true
build:
name: Build
needs: [ commitlint ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
jdk: [ 21 ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup JDK ${{ matrix.jdk }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 20
- name: Build with Gradle
run: ./gradlew clean build
40 changes: 40 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PR

on:
pull_request:
branches:
- master

jobs:
commitlint:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
with:
configFile: package.json
failOnWarnings: true
build:
name: Build
needs: [ commitlint ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
jdk: [ 21 ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup JDK ${{ matrix.jdk }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 20
- name: Build with Gradle
run: ./gradlew clean build
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.iml
.DS_Store
.env.local
.gradle
.idea
.run
.tmp
LOG_DIR_IS_UNDEFINED
build
logs
node_modules
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit ""
9 changes: 9 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "master" ]; then
echo "Never commit to [$branch] directly"
exit 1
fi
9 changes: 9 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

branch="$(git rev-parse --abbrev-ref HEAD)"

if [ "$branch" = "master" ]; then
echo "Never push to [$branch] directly"
exit 1
fi
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
java openjdk-21.0.1
nodejs 20.11.0
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing

## Conventional Commits

Check if your commit messages meet the [conventional commit format](https://conventionalcommits.org).

The conventional config extends from [config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional).

## Create a commit

Run `npm install` in root directory, then you will get [Commitizen](https://github.com/commitizen-tools/commitizen) installed.

Use `npm run cz` or `npx cz` to create a commit.

## Workflow validation

Commit message will be validated by workflow. If the validation is fail, amend the commit and rerun validation action.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[![CI](https://github.com/jinganix/guess/actions/workflows/ci.yml/badge.svg)](https://github.com/jinganix/guess/actions/workflows/ci.yml)
[![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)

# Guess

The source code of the 'Guess Who I Am' Wechat miniprogram

## Contributing

If you are interested in reporting/fixing issues and contributing directly to the code base, please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information on what we're looking for and how to get started.
82 changes: 82 additions & 0 deletions aggregation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import utils.Props
import utils.createConfiguration
import utils.extractDependencies

plugins {
id("jacoco.aggregation")
}

repositories {
gradlePluginPortal()
}

val buildSrcDependencies = extractDependencies(file("${rootDir}/buildSrc/build.gradle.kts"))

configurations.implementation.get().dependencies.forEach {
if (it is ModuleDependency) {
it.isTransitive = false
}
}

val incomingClassDirs = createConfiguration("incomingClassDirs", "classDirs") {
extendsFrom(configurations.implementation.get())
isCanBeResolved = true
isCanBeConsumed = false
}

val incomingSourceDirs = createConfiguration("incomingSourceDirs", "sourceDirs") {
extendsFrom(configurations.implementation.get())
isCanBeResolved = true
isCanBeConsumed = false
}

val incomingCoverageData = createConfiguration("incomingCoverageData", "coverageData") {
extendsFrom(configurations.implementation.get())
isCanBeResolved = true
isCanBeConsumed = false
}

fun updateJacocoReport(base: JacocoReportBase) {
base.additionalClassDirs(incomingClassDirs.incoming.artifactView {
lenient(true)
}.files.asFileTree.matching {
})
base.additionalSourceDirs(incomingSourceDirs.incoming.artifactView { lenient(true) }.files)
base.executionData(incomingCoverageData.incoming.artifactView { lenient(true) }.files.filter { it.exists() })
}

val coverageVerification by tasks.registering(JacocoCoverageVerification::class) {
enabled = Props.coverage
updateJacocoReport(this)

violationRules {
rule { limit { minimum = BigDecimal.valueOf(Props.jacocoMinCoverage) } }
}
}

val coverage by tasks.registering(JacocoReport::class) {
enabled = Props.coverage
updateJacocoReport(this)

reports {
xml.required.set(true)
html.required.set(true)
}
}

val configCoveralls by tasks.registering(DefaultTask::class) {
coveralls {
sourceDirs = incomingSourceDirs.incoming.artifactView { lenient(true) }.files.map {
it.absolutePath
}
jacocoReportPath = "build/reports/jacoco/coverage/coverage.xml"
}
}

tasks.coveralls {
dependsOn(configCoveralls)
}

tasks.check {
dependsOn(coverageVerification)
}
Loading

0 comments on commit b14bb49

Please sign in to comment.