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
|
||||
|
||||
Reference in New Issue
Block a user