Skip to content

Commit

Permalink
Add initial package layout
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Dec 8, 2024
1 parent e1f33fc commit d1cd601
Show file tree
Hide file tree
Showing 26 changed files with 1,452 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: plugfox
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ['https://www.buymeacoffee.com/plugfox', 'https://boosty.to/plugfox']
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Questions & Help
url: https://t.me/ru_dart
about: Ask a question about Spinify
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
65 changes: 65 additions & 0 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Setup
description: Sets up the Flutter environment

inputs:
flutter-version:
description: 'The version of Flutter to use'
required: false
default: '3.24.5'
pub-cache:
description: 'The name of the pub cache variable'
required: false
default: app

runs:
using: composite
steps:
- name: 📦 Checkout the repo
uses: actions/checkout@v4

- name: 🔢 Set up version from tags
id: set-version
if: startsWith(github.ref, 'refs/tags')
shell: bash
run: |
BASE_VERSION="${GITHUB_REF#refs/tags/v}"
UNIXTIME=$(date +%s)
VERSION="${BASE_VERSION}+${UNIXTIME}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
sed -i "s/^version: .*/version: ${VERSION}/" pubspec.yaml
echo "Version set to $VERSION"
- name: 🚂 Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: '${{ inputs.flutter-version }}'

- name: 📤 Restore Pub modules
id: cache-pub-restore
uses: actions/cache/restore@v4
with:
path: |
/home/runner/.pub-cache
key: ${{ runner.os }}-pub-${{ inputs.pub-cache }}-${{ hashFiles('pubspec.lock') }}

- name: 👷 Install Dependencies
shell: bash
run: |
echo /home/runner/.pub-cache/bin >> $GITHUB_PATH
flutter config --no-cli-animations --no-analytics
flutter pub get
#- name: ⏲️ Run build runner
# shell: bash
# run: |
# dart run build_runner build --delete-conflicting-outputs --release

- name: 📥 Save Pub modules
id: cache-pub-save
if: steps.cache-pub-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
/home/runner/.pub-cache
key: ${{ steps.cache-pub-restore.outputs.cache-primary-key }}
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
enable-beta-ecosystems: true
updates:
- directory: "/"
open-pull-requests-limit: 5
package-ecosystem: "pub"
rebase-strategy: auto
schedule:
interval: "monthly"
timezone: "Etc/GMT"
116 changes: 116 additions & 0 deletions .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Checkout

on:
workflow_dispatch:
push:
branches:
- "main"
- "master"
#- "dev"
#- "develop"
#- "feature/**"
#- "bugfix/**"
#- "hotfix/**"
#- "support/**"
# paths:
# - "pubspec.yaml"
# - "pubspec.lock"
# - ".github/**.yaml"
# - ".github/**.yml"
# - "lib/**.dart"
# - "test/**.dart"
# - "packages/**"
# - "example/**.dart"
pull_request:
branches:
- "main"
- "master"
- "dev"
- "develop"
- "feature/**"
- "bugfix/**"
- "hotfix/**"
- "support/**"
paths:
- "pubspec.yaml"
- ".github/**.yaml"
- ".github/**.yml"
- "lib/**.dart"
- "test/**.dart"
- "example/**.dart"

permissions:
contents: read
actions: read
checks: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
checkout:
name: "🧪 Check code with analysis, format, and tests"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
timeout-minutes: 10
steps:
- name: 📦 Get the .github actions
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
- name: 🚂 Setup Flutter and dependencies
uses: ./.github/actions/setup
with:
flutter-version: 3.24.3

- name: 👷 Install Dependencies
timeout-minutes: 1
run: |
flutter pub get
- name: 🚦 Check code format
id: check-format
timeout-minutes: 1
run: |
find lib test -name "*.dart" ! -name "*.*.dart" -print0 | xargs -0 dart format --set-exit-if-changed --line-length 80 -o none lib/ test/
- name: 📈 Check analyzer
id: check-analyzer
timeout-minutes: 1
run: flutter analyze --fatal-infos --fatal-warnings lib/ test/

- name: 👀 Verify versions
id: verify-versions
timeout-minutes: 1
run: |
test -f pubspec.yaml && test -f CHANGELOG.md
version_pubspec=$(grep '^version:' pubspec.yaml | awk '{print $2}' | sed 's/[^[:print:]]//g')
test -n "$version_pubspec"
echo "Version from pubspec.yaml: '$version_pubspec'"
echo "$version_pubspec" > /tmp/version_pubspec
grep -q "# $version_pubspec" CHANGELOG.md || (echo "Version not found in CHANGELOG.md" >&2; exit 1)
- name: 🧪 Unit & Widget tests
timeout-minutes: 20
run: |
flutter test --coverage --concurrency=40 test/unit_test.dart test/widget_test.dart
#- name: 📥 Upload coverage report
# timeout-minutes: 5
# if: ${{ github.actor != 'dependabot[bot]' }}
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage/lcov.info

- name: 📥 Upload test report
uses: actions/upload-artifact@v4
if: (success() || failure()) && ${{ github.actor != 'dependabot[bot]' }}
with:
name: test-results
path: reports/tests.json
27 changes: 27 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Test Report"

on:
workflow_run:
workflows: ["Checkout"] # runs after "Checkout" workflow
types:
- completed

permissions:
contents: read
actions: read
checks: write

jobs:
report:
name: "🚛 Test report"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Test report
uses: dorny/test-reporter@v1
with:
artifact: test-results
name: Test Report
path: "**/tests.json"
reporter: flutter-json
fail-on-error: false
87 changes: 87 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Don’t commit the following directories created by pub.
.buildlog
.dart_tool/
.pub/
build/
packages
*.packages
.idea/
doc

# Or the files created by dart2js.
*.dart.js
*.js_
*.js.deps
*.js.map

# Include when developing application packages.
pubspec.lock
coverage*

# Codegen
*.g.dart
!pubspec.yaml.g.dart

# Logs
l/

# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

# Pana
log.pana.json

# Test
coverage/
.coverage/
/test/**/*.json
/test/.test_coverage.dart
reports/
.reports/

# Binaries for programs and plugins
*.exe
*.exe~

pubspec.lock
Loading

0 comments on commit d1cd601

Please sign in to comment.