Skip to content

Commit

Permalink
Merge pull request #14 from StringCare/develop
Browse files Browse the repository at this point in the history
Feature: Test mode added
  • Loading branch information
efraespada authored Oct 6, 2024
2 parents 1763350 + 1a4cd9f commit a1702df
Show file tree
Hide file tree
Showing 19 changed files with 708 additions and 147 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/push_check_analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Push Analyze Check

on:
push:
branches:
- '**'

jobs:
push_check_analyze:

runs-on: self-hosted

steps:
- uses: actions/checkout@v4

- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install Landa Messenger CLI
run: npm install @landamessenger/landa-messenger-api -g

- uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: '3.24.3'

- run: flutter pub get

- run: flutter analyze

- name: Handle job completion
if: always()
run: |
if [ "${{ job.status }}" == "failure" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🔴 Analysis Failed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_analyze.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
elif [ "${{ job.status }}" == "cancelled" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟠 Analysis Canceled" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_analyze.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
else
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟢 Analysis Passed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_analyze.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
fi
67 changes: 67 additions & 0 deletions .github/workflows/push_check_publish_dry_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Push Publish Dry Run Check

on:
push:
branches:
- '**'

jobs:
push_check_publish_dry_run:

runs-on: self-hosted

steps:
- uses: actions/checkout@v4

- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install Landa Messenger CLI
run: npm install @landamessenger/landa-messenger-api -g

- uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: '3.24.3'

- run: flutter pub get

- run: dart pub publish --dry-run

- name: Handle job completion
if: always()
run: |
if [ "${{ job.status }}" == "failure" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🔴 Dry Publish Failed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_publish_dry_run.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
elif [ "${{ job.status }}" == "cancelled" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟠 Dry Publish Canceled" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_publish_dry_run.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
else
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟢 Dry Publish Passed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_publish_dry_run.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
fi
73 changes: 73 additions & 0 deletions .github/workflows/push_check_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Push Test Check

on:
push:
branches:
- '**'

jobs:
push_check_test:

runs-on: self-hosted

steps:
- uses: actions/checkout@v4

- name: Set up Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18.x'

- name: Install Landa Messenger CLI
run: npm install @landamessenger/landa-messenger-api -g

- uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: '3.24.3'

- run: flutter pub get

- run: flutter test --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage/lcov.info

- name: Handle job completion
if: always()
run: |
if [ "${{ job.status }}" == "failure" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🔴 Test Failed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check_test.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
elif [ "${{ job.status }}" == "cancelled" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟠 Test Canceled" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
else
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟢 Test Passed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/push_check.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
fi
116 changes: 116 additions & 0 deletions .github/workflows/tag_version_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Tag Version and Publish on Push to Master

on:
push:
branches:
- master

jobs:
tag_version_and_publish:

runs-on: self-hosted

steps:
- uses: actions/checkout@v4

- name: Read version from pubspec.yml
id: read_version
run: |
VERSION=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create tag
id: create_tag
run: |
# Checks if the tag already exists in the remote repository
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
echo "Error: Tag v${{ env.VERSION }} already exists."
exit 1
fi
# Check if the version was found
if [ -z "${{ env.VERSION }}" ]; then
echo "Error: No version found in pubspec.yml"
exit 1
fi
git tag "v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"
- name: Handle job completion
if: always()
run: |
if [ "${{ job.status }}" == "failure" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🔴 Creation Tag Failed" \
--body "${{ github.repository }}: Tag v${{ env.VERSION }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
elif [ "${{ job.status }}" == "cancelled" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟠 Creation Tag Canceled" \
--body "${{ github.repository }}: Tag v${{ env.VERSION }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
else
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟢 Creation Tag Passed" \
--body "${{ github.repository }}: Tag v${{ env.VERSION }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
fi
- run: flutter pub get

- run: dart pub publish --dry-run

- run: dart pub publish -f

- name: Handle publish job completion
if: always()
run: |
if [ "${{ job.status }}" == "failure" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🔴 Pub Publish Failed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
elif [ "${{ job.status }}" == "cancelled" ]; then
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟠 Pub Publish Canceled" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
else
landa-messenger-api chat-send \
--id "${{ secrets.CHAT_ID }}" \
--api_key "${{ secrets.CHAT_KEY }}" \
--title "🟢 Pub Publish Passed" \
--body "${{ github.repository }}: ${{ github.event.head_commit.message }}" \
--url "https://github.com/stringcare/stringcare/actions/workflows/tag_version_and_publish.yml" \
--image "https://avatars.githubusercontent.com/u/63705403?s=200&v=4" \
--background_color "#55000000" \
--text_color "#FFFFFFFF"
fi

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0

* Stable version. Added `disableNative` and `useEncrypted` for testing purposes.

## 0.1.7

* Dependencies updated
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group 'com.stringcare'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
Expand All @@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
6 changes: 3 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -39,8 +39,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.stringcare_example"
minSdkVersion 16
targetSdkVersion 33
minSdkVersion flutter.minSdkVersion
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Loading

0 comments on commit a1702df

Please sign in to comment.