feat: add shorebird_code_push package (#30)
* feat: add shorebird_code_push package * remove example and extra code * update github workflow * fix gha
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
name: Dart Package Workflow
|
||||
description: Build and test your Dart packages.
|
||||
|
||||
inputs:
|
||||
codecov_token:
|
||||
required: true
|
||||
description: The Codecov token used to upload coverage
|
||||
concurrency:
|
||||
required: false
|
||||
default: "4"
|
||||
description: The value of the concurrency flag (-j) used when running tests
|
||||
coverage_excludes:
|
||||
required: false
|
||||
default: ""
|
||||
description: Globs to exclude from coverage
|
||||
dart_sdk:
|
||||
required: false
|
||||
default: "stable"
|
||||
description: "The dart sdk version to use"
|
||||
working_directory:
|
||||
required: false
|
||||
default: "."
|
||||
description: The working directory for this workflow
|
||||
min_coverage:
|
||||
required: false
|
||||
default: "100"
|
||||
description: The minimum coverage percentage value
|
||||
analyze_directories:
|
||||
required: false
|
||||
default: "lib test"
|
||||
description: Directories to analyze
|
||||
report_on:
|
||||
required: false
|
||||
default: "lib"
|
||||
description: Directories to report on when collecting coverage
|
||||
platform:
|
||||
required: false
|
||||
default: "vm"
|
||||
description: Platform to use when running tests
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: dart-lang/setup-dart@v1
|
||||
with:
|
||||
sdk: ${{inputs.dart_sdk}}
|
||||
|
||||
- name: Install Dependencies
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
shell: ${{ inputs.shell }}
|
||||
run: dart pub get
|
||||
|
||||
- name: Format
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
shell: ${{ inputs.shell }}
|
||||
run: dart format --set-exit-if-changed .
|
||||
|
||||
- name: Analyze
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
shell: ${{ inputs.shell }}
|
||||
run: dart analyze --fatal-warnings ${{inputs.analyze_directories}}
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{ inputs.working_directory }}
|
||||
shell: ${{ inputs.shell }}
|
||||
run: |
|
||||
dart pub global activate coverage
|
||||
dart test -j ${{inputs.concurrency}} --coverage=coverage --platform=${{inputs.platform}} && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=${{inputs.report_on}} --check-ignore
|
||||
|
||||
- name: Upload Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
token: ${{ inputs.codecov_token }}
|
||||
|
||||
- uses: VeryGoodOpenSource/very_good_coverage@v2
|
||||
with:
|
||||
path: ${{inputs.working_directory}}/coverage/lcov.info
|
||||
exclude: ${{inputs.coverage_excludes}}
|
||||
min_coverage: ${{inputs.min_coverage}}
|
||||
@@ -18,6 +18,7 @@ jobs:
|
||||
pull-requests: read
|
||||
|
||||
outputs:
|
||||
needs_dart_build: ${{ steps.needs_dart_build.outputs.changes }}
|
||||
needs_rust_build: ${{ steps.needs_rust_build.outputs.changes }}
|
||||
|
||||
name: 👀 Detect Changes
|
||||
@@ -26,6 +27,16 @@ jobs:
|
||||
- name: 📚 Git Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: dorny/paths-filter@v2
|
||||
name: Build Detection
|
||||
id: needs_dart_build
|
||||
with:
|
||||
filters: |
|
||||
shorebird_code_push:
|
||||
- ./.github/workflows/main.yaml
|
||||
- ./.github/actions/dart_package/action.yaml
|
||||
- shorebird_code_push/**
|
||||
|
||||
- uses: dorny/paths-filter@v2
|
||||
name: Build Detection
|
||||
id: needs_rust_build
|
||||
@@ -60,8 +71,33 @@ jobs:
|
||||
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
||||
working_directory: ${{ matrix.crate }}
|
||||
|
||||
build_dart_packages:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.needs_dart_build != '[]' }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
package: ${{ fromJSON(needs.changes.outputs.needs_dart_build) }}
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: 🎯 Build ${{ matrix.package }}
|
||||
|
||||
steps:
|
||||
- name: 📚 Git Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: 🎯 Build ${{ matrix.package }}
|
||||
uses: ./.github/actions/dart_package
|
||||
with:
|
||||
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
||||
coverage_excludes: "**/*.g.dart"
|
||||
working_directory: ${{ matrix.package }}
|
||||
|
||||
ci:
|
||||
needs: [semantic_pull_request, build_rust_crates]
|
||||
needs: [semantic_pull_request, build_dart_packages, build_rust_crates]
|
||||
if: ${{ always() }}
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# See https://www.dartlang.org/guides/libraries/private-files
|
||||
|
||||
# Files and directories created by pub
|
||||
.dart_tool/
|
||||
.packages
|
||||
build/
|
||||
pubspec.lock
|
||||
@@ -0,0 +1,9 @@
|
||||
# Shorebird Code Push
|
||||
|
||||
[![License: MIT][license_badge]][license_link]
|
||||
|
||||
A Dart library that allows Flutter apps to get information about code push updates.
|
||||
|
||||
[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
[license_link]: https://opensource.org/licenses/MIT
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
include: package:very_good_analysis/analysis_options.5.0.0.yaml
|
||||
@@ -0,0 +1,20 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="102" height="20">
|
||||
<linearGradient id="b" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
|
||||
<stop offset="1" stop-opacity=".1" />
|
||||
</linearGradient>
|
||||
<clipPath id="a">
|
||||
<rect width="102" height="20" rx="3" fill="#fff" />
|
||||
</clipPath>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="#555" d="M0 0h59v20H0z" />
|
||||
<path fill="#44cc11" d="M59 0h43v20H59z" />
|
||||
<path fill="url(#b)" d="M0 0h102v20H0z" />
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
<text x="305" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="490">coverage</text>
|
||||
<text x="305" y="140" transform="scale(.1)" textLength="490">coverage</text>
|
||||
<text x="795" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">100%</text>
|
||||
<text x="795" y="140" transform="scale(.1)" textLength="330">100%</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,4 @@
|
||||
/// Get info about your Shorebird code push app
|
||||
library shorebird_code_push;
|
||||
|
||||
export 'src/shorebird_code_push.dart';
|
||||
@@ -0,0 +1,7 @@
|
||||
/// {@template shorebird_code_push}
|
||||
/// Get info about your Shorebird code push app
|
||||
/// {@endtemplate}
|
||||
class ShorebirdCodePush {
|
||||
/// {@macro shorebird_code_push}
|
||||
const ShorebirdCodePush();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
name: shorebird_code_push
|
||||
description: Get info about your Shorebird code push app
|
||||
version: 0.1.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
||||
dev_dependencies:
|
||||
ffigen: ^8.0.2
|
||||
mocktail: ^0.3.0
|
||||
test: ^1.19.2
|
||||
very_good_analysis: ^5.0.0
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
import 'package:test/test.dart';
|
||||
import 'package:shorebird_code_push/shorebird_code_push.dart';
|
||||
|
||||
void main() {
|
||||
group('ShorebirdCodePush', () {
|
||||
test('can be instantiated', () {
|
||||
expect(ShorebirdCodePush(), isNotNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user