Skip to content

Commit a1702df

Browse files
authored
Merge pull request #14 from StringCare/develop
Feature: Test mode added
2 parents 1763350 + 1a4cd9f commit a1702df

19 files changed

+708
-147
lines changed
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Push Analyze Check
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
push_check_analyze:
10+
11+
runs-on: self-hosted
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Node.js 18
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '18.x'
20+
21+
- name: Install Landa Messenger CLI
22+
run: npm install @landamessenger/landa-messenger-api -g
23+
24+
- uses: subosito/flutter-action@v1
25+
with:
26+
channel: 'stable'
27+
flutter-version: '3.24.3'
28+
29+
- run: flutter pub get
30+
31+
- run: flutter analyze
32+
33+
- name: Handle job completion
34+
if: always()
35+
run: |
36+
if [ "${{ job.status }}" == "failure" ]; then
37+
landa-messenger-api chat-send \
38+
--id "${{ secrets.CHAT_ID }}" \
39+
--api_key "${{ secrets.CHAT_KEY }}" \
40+
--title "🔴 Analysis Failed" \
41+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
42+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_analyze.yml" \
43+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
44+
--background_color "#55000000" \
45+
--text_color "#FFFFFFFF"
46+
elif [ "${{ job.status }}" == "cancelled" ]; then
47+
landa-messenger-api chat-send \
48+
--id "${{ secrets.CHAT_ID }}" \
49+
--api_key "${{ secrets.CHAT_KEY }}" \
50+
--title "🟠 Analysis Canceled" \
51+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
52+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_analyze.yml" \
53+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
54+
--background_color "#55000000" \
55+
--text_color "#FFFFFFFF"
56+
else
57+
landa-messenger-api chat-send \
58+
--id "${{ secrets.CHAT_ID }}" \
59+
--api_key "${{ secrets.CHAT_KEY }}" \
60+
--title "🟢 Analysis Passed" \
61+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
62+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_analyze.yml" \
63+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
64+
--background_color "#55000000" \
65+
--text_color "#FFFFFFFF"
66+
fi
67+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Push Publish Dry Run Check
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
push_check_publish_dry_run:
10+
11+
runs-on: self-hosted
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Node.js 18
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '18.x'
20+
21+
- name: Install Landa Messenger CLI
22+
run: npm install @landamessenger/landa-messenger-api -g
23+
24+
- uses: subosito/flutter-action@v1
25+
with:
26+
channel: 'stable'
27+
flutter-version: '3.24.3'
28+
29+
- run: flutter pub get
30+
31+
- run: dart pub publish --dry-run
32+
33+
- name: Handle job completion
34+
if: always()
35+
run: |
36+
if [ "${{ job.status }}" == "failure" ]; then
37+
landa-messenger-api chat-send \
38+
--id "${{ secrets.CHAT_ID }}" \
39+
--api_key "${{ secrets.CHAT_KEY }}" \
40+
--title "🔴 Dry Publish Failed" \
41+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
42+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_publish_dry_run.yml" \
43+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
44+
--background_color "#55000000" \
45+
--text_color "#FFFFFFFF"
46+
elif [ "${{ job.status }}" == "cancelled" ]; then
47+
landa-messenger-api chat-send \
48+
--id "${{ secrets.CHAT_ID }}" \
49+
--api_key "${{ secrets.CHAT_KEY }}" \
50+
--title "🟠 Dry Publish Canceled" \
51+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
52+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_publish_dry_run.yml" \
53+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
54+
--background_color "#55000000" \
55+
--text_color "#FFFFFFFF"
56+
else
57+
landa-messenger-api chat-send \
58+
--id "${{ secrets.CHAT_ID }}" \
59+
--api_key "${{ secrets.CHAT_KEY }}" \
60+
--title "🟢 Dry Publish Passed" \
61+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
62+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_publish_dry_run.yml" \
63+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
64+
--background_color "#55000000" \
65+
--text_color "#FFFFFFFF"
66+
fi
67+

.github/workflows/push_check_test.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Push Test Check
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
push_check_test:
10+
11+
runs-on: self-hosted
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Node.js 18
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '18.x'
20+
21+
- name: Install Landa Messenger CLI
22+
run: npm install @landamessenger/landa-messenger-api -g
23+
24+
- uses: subosito/flutter-action@v1
25+
with:
26+
channel: 'stable'
27+
flutter-version: '3.24.3'
28+
29+
- run: flutter pub get
30+
31+
- run: flutter test --coverage
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v4
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
file: coverage/lcov.info
38+
39+
- name: Handle job completion
40+
if: always()
41+
run: |
42+
if [ "${{ job.status }}" == "failure" ]; then
43+
landa-messenger-api chat-send \
44+
--id "${{ secrets.CHAT_ID }}" \
45+
--api_key "${{ secrets.CHAT_KEY }}" \
46+
--title "🔴 Test Failed" \
47+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
48+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_test.yml" \
49+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
50+
--background_color "#55000000" \
51+
--text_color "#FFFFFFFF"
52+
elif [ "${{ job.status }}" == "cancelled" ]; then
53+
landa-messenger-api chat-send \
54+
--id "${{ secrets.CHAT_ID }}" \
55+
--api_key "${{ secrets.CHAT_KEY }}" \
56+
--title "🟠 Test Canceled" \
57+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
58+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check.yml" \
59+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
60+
--background_color "#55000000" \
61+
--text_color "#FFFFFFFF"
62+
else
63+
landa-messenger-api chat-send \
64+
--id "${{ secrets.CHAT_ID }}" \
65+
--api_key "${{ secrets.CHAT_KEY }}" \
66+
--title "🟢 Test Passed" \
67+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
68+
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check.yml" \
69+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
70+
--background_color "#55000000" \
71+
--text_color "#FFFFFFFF"
72+
fi
73+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Tag Version and Publish on Push to Master
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
tag_version_and_publish:
10+
11+
runs-on: self-hosted
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Read version from pubspec.yml
17+
id: read_version
18+
run: |
19+
VERSION=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2)
20+
echo "VERSION=$VERSION" >> $GITHUB_ENV
21+
22+
- name: Create tag
23+
id: create_tag
24+
run: |
25+
# Checks if the tag already exists in the remote repository
26+
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
27+
echo "Error: Tag v${{ env.VERSION }} already exists."
28+
exit 1
29+
fi
30+
31+
# Check if the version was found
32+
if [ -z "${{ env.VERSION }}" ]; then
33+
echo "Error: No version found in pubspec.yml"
34+
exit 1
35+
fi
36+
37+
git tag "v${{ env.VERSION }}"
38+
git push origin "v${{ env.VERSION }}"
39+
40+
- name: Handle job completion
41+
if: always()
42+
run: |
43+
if [ "${{ job.status }}" == "failure" ]; then
44+
landa-messenger-api chat-send \
45+
--id "${{ secrets.CHAT_ID }}" \
46+
--api_key "${{ secrets.CHAT_KEY }}" \
47+
--title "🔴 Creation Tag Failed" \
48+
--body "${{ github.repository }}: Tag v${{ env.VERSION }}" \
49+
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
50+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
51+
--background_color "#55000000" \
52+
--text_color "#FFFFFFFF"
53+
elif [ "${{ job.status }}" == "cancelled" ]; then
54+
landa-messenger-api chat-send \
55+
--id "${{ secrets.CHAT_ID }}" \
56+
--api_key "${{ secrets.CHAT_KEY }}" \
57+
--title "🟠 Creation Tag Canceled" \
58+
--body "${{ github.repository }}: Tag v${{ env.VERSION }}" \
59+
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
60+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
61+
--background_color "#55000000" \
62+
--text_color "#FFFFFFFF"
63+
else
64+
landa-messenger-api chat-send \
65+
--id "${{ secrets.CHAT_ID }}" \
66+
--api_key "${{ secrets.CHAT_KEY }}" \
67+
--title "🟢 Creation Tag Passed" \
68+
--body "${{ github.repository }}: Tag v${{ env.VERSION }}" \
69+
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
70+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
71+
--background_color "#55000000" \
72+
--text_color "#FFFFFFFF"
73+
fi
74+
75+
- run: flutter pub get
76+
77+
- run: dart pub publish --dry-run
78+
79+
- run: dart pub publish -f
80+
81+
- name: Handle publish job completion
82+
if: always()
83+
run: |
84+
if [ "${{ job.status }}" == "failure" ]; then
85+
landa-messenger-api chat-send \
86+
--id "${{ secrets.CHAT_ID }}" \
87+
--api_key "${{ secrets.CHAT_KEY }}" \
88+
--title "🔴 Pub Publish Failed" \
89+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
90+
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
91+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
92+
--background_color "#55000000" \
93+
--text_color "#FFFFFFFF"
94+
elif [ "${{ job.status }}" == "cancelled" ]; then
95+
landa-messenger-api chat-send \
96+
--id "${{ secrets.CHAT_ID }}" \
97+
--api_key "${{ secrets.CHAT_KEY }}" \
98+
--title "🟠 Pub Publish Canceled" \
99+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
100+
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
101+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
102+
--background_color "#55000000" \
103+
--text_color "#FFFFFFFF"
104+
else
105+
landa-messenger-api chat-send \
106+
--id "${{ secrets.CHAT_ID }}" \
107+
--api_key "${{ secrets.CHAT_KEY }}" \
108+
--title "🟢 Pub Publish Passed" \
109+
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
110+
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
111+
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
112+
--background_color "#55000000" \
113+
--text_color "#FFFFFFFF"
114+
fi
115+
116+

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.0
2+
3+
* Stable version. Added `disableNative` and `useEncrypted` for testing purposes.
4+
15
## 0.1.7
26

37
* Dependencies updated

android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ group 'com.stringcare'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.6.10'
5+
ext.kotlin_version = '1.7.10'
66
repositories {
77
google()
88
jcenter()
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
compileSdkVersion 31
28+
compileSdkVersion 34
2929

3030
sourceSets {
3131
main.java.srcDirs += 'src/main/kotlin'

example/android/app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 33
29+
compileSdkVersion 34
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -39,8 +39,8 @@ android {
3939
defaultConfig {
4040
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4141
applicationId "com.example.stringcare_example"
42-
minSdkVersion 16
43-
targetSdkVersion 33
42+
minSdkVersion flutter.minSdkVersion
43+
targetSdkVersion 34
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName
4646
}

example/android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.6.10'
2+
ext.kotlin_version = '1.7.10'
33
repositories {
44
google()
55
jcenter()
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

0 commit comments

Comments
 (0)