Skip to content

Commit

Permalink
Merge pull request #3 from landamessenger/develop
Browse files Browse the repository at this point in the history
Test and integration test
  • Loading branch information
efraespada authored Oct 6, 2024
2 parents 8e380ea + 873e7af commit 609a1ed
Show file tree
Hide file tree
Showing 113 changed files with 3,238 additions and 3,380 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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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/landamessenger/catalog/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: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
*.lock
.dart_tool
.DS_Store
.idea/
.idea/

/build
7 changes: 6 additions & 1 deletion .pubignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ widget_preview.iml
*.lock
.dart_tool
.DS_Store
.idea/
.idea/

/lib/.DS_Store
/lib/src/.DS_Store
/example/lib/.DS_Store
/example/lib/src/.DS_Store
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 1.0.6
## 2.0.0

* Dependencies updated.
* Added `test` and `integration_test` generation.

## 1.0.5

Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ This package allows you to create a widget catalog and all kinds of screenshots.

[- What are dummies?](https://github.com/landamessenger/catalog/wiki/Dummies#what-are-dummies)

[- Complex page catalog](https://github.com/landamessenger/catalog/wiki/Dummies#complex-page-catalog)

[- Prepare dummies](https://github.com/landamessenger/catalog/wiki/Dummies#prepare-dummies)

### [Test](https://github.com/landamessenger/catalog/wiki/Test)

[- Tests](https://github.com/landamessenger/catalog/wiki/Test#tests)

[- Integration Tests](https://github.com/landamessenger/catalog/wiki/Test#integration-tests)

[- Sample](https://github.com/landamessenger/catalog/wiki/Test#sample)

### [Build & Run](https://github.com/landamessenger/catalog/wiki/Build-&-Run)

[- Building your catalog](https://github.com/landamessenger/catalog/wiki/Build-&-Run#building-your-catalog)
Expand All @@ -52,4 +58,3 @@ This package allows you to create a widget catalog and all kinds of screenshots.
[- Samples](https://github.com/landamessenger/catalog/wiki/Screenshots#samples)

### [Catalog Sample](https://landamessenger.com/catalog)

4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
analyzer:
errors:
dangling_library_doc_comments: ignore

include: package:flutter_lints/flutter.yaml

linter:
Expand Down
Loading

0 comments on commit 609a1ed

Please sign in to comment.