Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and integration test #3

Merged
merged 29 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2e08fa0
Merge branch 'master' of https://github.com/landamessenger/catalog in…
efraespada Oct 2, 2024
c412ee4
feature: removed not needed configs, added unit tests and github actions
efraespada Oct 2, 2024
21b225d
feature: removed not needed configs, added unit tests and github actions
efraespada Oct 2, 2024
4c66901
feature: removed not needed configs, added unit tests and github actions
efraespada Oct 2, 2024
c087eaf
feature: linter warnings and dart fix command
efraespada Oct 3, 2024
03df2e8
feature: fix formating
efraespada Oct 3, 2024
6d20cf0
Delete lib/src/.DS_Store
efraespada Oct 3, 2024
b51e160
Delete lib/.DS_Store
efraespada Oct 3, 2024
62fe6d4
feature: removed DS_Store
efraespada Oct 3, 2024
771fb6c
feature: navigation over real locations working :rocket:
efraespada Oct 4, 2024
cd43854
feature: added internal preview class
efraespada Oct 4, 2024
0682c18
feature: removed prints and unused code
efraespada Oct 4, 2024
afeb849
feature: testing tests from catalog
efraespada Oct 4, 2024
dbfd0be
feature: testing tests
efraespada Oct 4, 2024
0313331
feature: test builder
efraespada Oct 5, 2024
fdde738
feature: adding instrumented test
efraespada Oct 5, 2024
c3d1513
feature: integration tests
efraespada Oct 5, 2024
78d44d0
feature: building tests
efraespada Oct 5, 2024
8db8fce
feature: working on tests (stringcare lock)
efraespada Oct 5, 2024
afa2434
feature: test new widget
efraespada Oct 5, 2024
180c198
feature: test new widget
efraespada Oct 5, 2024
392f6b4
feature: new tasks, stringcare on dynamic test mode
efraespada Oct 6, 2024
d3831c1
feature: updated CHANGELOG.md
efraespada Oct 6, 2024
6bc09b4
feature: removed not needed files
efraespada Oct 6, 2024
797ec1d
feature: added sample
efraespada Oct 6, 2024
aa90e2c
feature: removing process.dart
efraespada Oct 6, 2024
d5e03cc
feature: updated version and dependencies
efraespada Oct 6, 2024
57dc95e
feature: added publish workflow
efraespada Oct 6, 2024
873e7af
feature: added tests
efraespada Oct 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading