Skip to content

Commit c6ec972

Browse files
authored
feat(build,style,test): use kt-mpp, improve style, and tests
* wip: fixing kt-mpp * chore(build,ci): use kt-mpp and semantic-release * chore(style): auto-format with ktLint * chore(style): add detekt configuration * chore(test,style): improve formatting and fix tests * chore(build): disable detekt * chore: add package-lock.json * chore(ci): fix secrets in ci * chore(ci): use DanySK/build-check-deploy-gradle-action version 2.2.6 * chore(ci): disable fail fast * chore: use explicit maven username in ci * chore(build): use kt-mpp v. 2.0.3
1 parent a5d469b commit c6ec972

50 files changed

Lines changed: 15022 additions & 1693 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.detekt.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
comments:
2+
UndocumentedPublicClass:
3+
active: false
4+
UndocumentedPublicFunction:
5+
active: false
6+
UndocumentedPublicProperty:
7+
active: false
8+
9+
style: {}

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.{kt,kts}]
2+
ktlint_disabled_rules=import-ordering
3+
max_line_length=120

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* text=auto eol=lf
2+
*.[cC][mM][dD] text eol=crlf
3+
*.[bB][aA][tT] text eol=crlf
4+
*.[pP][sS]1 text eol=crlf
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: CI/CD Process
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
6+
jobs:
7+
check-secrets:
8+
runs-on: ubuntu-22.04
9+
outputs:
10+
run-with-secrets: ${{ steps.require-secrets.outputs.run-with-secrets }}
11+
steps:
12+
- name: Find if secrets are available
13+
id: detect-secrets
14+
uses: DanySK/are-secrets-available@1.0.0
15+
with:
16+
secrets: ${{ toJson(secrets) }}
17+
- name: Set condition
18+
id: require-secrets
19+
run: |
20+
echo "run-with-secrets=${{ steps.detect-secrets.outputs.has-secrets == 'true' && !github.event.repository.fork }}" >> $GITHUB_OUTPUT
21+
22+
staging-repo:
23+
runs-on: ubuntu-22.04
24+
needs:
25+
- check-secrets
26+
concurrency:
27+
group: staging-repo-${{ github.workflow }}-${{ github.event.number || github.ref }}
28+
if: needs.check-secrets.outputs.run-with-secrets == 'true'
29+
outputs:
30+
maven-central-repo-id: ${{ steps.staging-repo.outputs.MavenCentral }}
31+
next-version: ${{ steps.compute-next-version.outputs.next-version }}
32+
will-release: ${{ steps.compute-next-version.outputs.will-release }}
33+
steps:
34+
- name: Checkout the repo
35+
uses: actions/checkout@v3.5.2
36+
with:
37+
fetch-depth: 0
38+
- name: Compute next release version
39+
id: compute-next-version
40+
uses: nicolasfara/precompute-semantic-release-version-action@1.0.2
41+
with:
42+
github-token: ${{ github.token }}
43+
- uses: DanySK/build-check-deploy-gradle-action@2.2.6
44+
with:
45+
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
46+
maven-central-username: gciatto
47+
should-run-codecov: false
48+
should-deploy: true
49+
build-command: true
50+
check-command: true
51+
deploy-command: |
52+
if [[ "${{ steps.compute-next-version.outputs.will-release }}" == "true" ]]; then
53+
./gradlew -PforceVersion="${{ steps.compute-next-version.outputs.next-version }}" createStagingRepositoryOnMavenCentral --parallel
54+
else
55+
./gradlew createStagingRepositoryOnMavenCentral --parallel
56+
fi
57+
- name: Save staging repository ID
58+
id: staging-repo
59+
run: |
60+
[[ -f build/staging-repo-ids.properties ]] || (
61+
echo "Staging repositories ID file not found" &&
62+
exit 1
63+
)
64+
REPO_IDS=$(cat build/staging-repo-ids.properties)
65+
echo "Staging repositories IDs:\n$REPO_IDS"
66+
echo $REPO_IDS >> $GITHUB_OUTPUT
67+
68+
build:
69+
needs:
70+
- check-secrets
71+
- staging-repo
72+
if: always() && !contains(needs.staging-repo.result, 'failure')
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
os: [ windows-2022, macos-12, ubuntu-22.04 ]
77+
runs-on: ${{ matrix.os }}
78+
concurrency:
79+
group: build-${{ github.workflow }}-${{ matrix.os }}-${{ github.event.number || github.ref }}
80+
cancel-in-progress: true
81+
steps:
82+
- name: Checkout
83+
uses: DanySK/action-checkout@0.2.9
84+
- uses: DanySK/build-check-deploy-gradle-action@2.2.6
85+
with:
86+
# Dry-deployment
87+
deploy-command: |
88+
NEXT_VERSION="${{ needs.staging-repo.outputs.next-version }}"
89+
OVERRIDE_VERSION=$([[ "$NEXT_VERSION" != "" ]] && echo "-PforceVersion=$(echo $NEXT_VERSION)" || echo "")
90+
./gradlew $OVERRIDE_VERSION -PstagingRepositoryId=${{ needs.staging-repo.outputs.maven-central-repo-id }} uploadProject --parallel
91+
should-run-codecov: ${{ runner.os == 'Linux' }}
92+
should-deploy: ${{ contains(needs.staging-repo.result, 'success') }}
93+
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
94+
maven-central-username: gciatto
95+
signing-key: ${{ secrets.SIGNING_KEY }}
96+
signing-password: ${{ secrets.SIGNING_PASSWORD }}
97+
close-staging-repos:
98+
needs:
99+
- staging-repo
100+
- build
101+
runs-on: ubuntu-22.04
102+
if: needs.check-secrets.outputs.run-with-secrets == 'true'
103+
steps:
104+
- name: Checkout the repo
105+
uses: actions/checkout@v3.5.2
106+
- uses: DanySK/build-check-deploy-gradle-action@2.2.6
107+
with:
108+
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
109+
maven-central-username: gciatto
110+
should-run-codecov: false
111+
should-deploy: true
112+
build-command: true
113+
check-command: true
114+
deploy-command: |
115+
./gradlew -PstagingRepositoryId=${{ needs.staging-repo.outputs.maven-central-repo-id }} close --parallel
116+
if [[ "${{ needs.staging-repo.outputs.will-release }}" == "false" ]]; then
117+
./gradlew -PstagingRepositoryId=${{ needs.staging-repo.outputs.maven-central-repo-id }} drop
118+
fi
119+
120+
release:
121+
concurrency:
122+
# Only one release job at a time per branch, as only master releases.
123+
# Strictly sequential.
124+
group: release-${{ github.event.number || github.ref }}
125+
needs:
126+
- check-secrets
127+
- staging-repo
128+
- build
129+
- close-staging-repos
130+
runs-on: ubuntu-22.04
131+
if: needs.check-secrets.outputs.run-with-secrets == 'true'
132+
steps:
133+
- name: Checkout
134+
uses: actions/checkout@v3.5.2
135+
with:
136+
token: ${{ secrets.DEPLOYMENT_TOKEN }}
137+
- name: Find the version of Node from package.json
138+
id: node-version
139+
run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT
140+
- name: Install Node
141+
uses: actions/setup-node@v3.6.0
142+
with:
143+
node-version: ${{ steps.node-version.outputs.version }}
144+
- uses: DanySK/build-check-deploy-gradle-action@2.2.6
145+
env:
146+
STAGING_REPO_ID: ${{ needs.staging-repo.outputs.maven-central-repo-id }}
147+
with:
148+
build-command: true
149+
check-command: true
150+
deploy-command: |
151+
npm install
152+
npx semantic-release
153+
should-run-codecov: false
154+
should-deploy: true
155+
github-token: ${{ github.token }}
156+
maven-central-password: ${{ secrets.MAVEN_PASSWORD }}
157+
maven-central-username: gciatto
158+
npm-token: ${{ secrets.NPM_TOKEN }}
159+
signing-key: ${{ secrets.SIGNING_KEY }}
160+
signing-password: ${{ secrets.SIGNING_PASSWORD }}
161+
success:
162+
runs-on: ubuntu-22.04
163+
needs:
164+
- check-secrets
165+
- staging-repo
166+
- close-staging-repos
167+
- release
168+
- build
169+
if: >-
170+
always() && (
171+
contains(join(needs.*.result, ','), 'failure')
172+
|| !contains(join(needs.*.result, ','), 'cancelled')
173+
)
174+
steps:
175+
- name: Verify that there were no failures
176+
run: ${{ !contains(join(needs.*.result, ','), 'failure') }}

.github/workflows/check.yml

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)