feat: add updater_tools library (#162)

* feat: add patch_packager library

* remove .github folder

* add patch_packager to ci

* update name to updater_tools

* delete unused file
This commit is contained in:
Bryan Oltman
2024-05-15 09:37:37 -04:00
committed by GitHub
parent d30931771b
commit 5707bd8168
9 changed files with 175 additions and 1 deletions
+82
View File
@@ -0,0 +1,82 @@
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
# Per https://stackoverflow.com/questions/73402042/github-action-expressions-split-string
- name: Split package name
env:
PACKAGE_PATH: ${{ inputs.working_directory}}
id: split
shell: ${{ inputs.shell }}
run: echo "package_name=${PACKAGE_PATH##*/}" >> $GITHUB_OUTPUT
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
flags: ${{ steps.split.outputs.package_name }}
token: ${{ inputs.codecov_token }}
+42 -1
View File
@@ -18,6 +18,7 @@ jobs:
pull-requests: read
outputs:
needs_dart_build: ${{ steps.needs_dart_build.outputs.changes }}
needs_flutter_build: ${{ steps.needs_flutter_build.outputs.changes }}
needs_rust_build: ${{ steps.needs_rust_build.outputs.changes }}
@@ -27,6 +28,16 @@ jobs:
- name: 📚 Git Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
name: Build Detection
id: needs_dart_build
with:
filters: |
updater_tools:
- ./.github/workflows/main.yaml
- ./.github/actions/flutter_package/action.yaml
- updater_tools/**
- uses: dorny/paths-filter@v3
name: Build Detection
id: needs_flutter_build
@@ -71,6 +82,30 @@ 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@v4
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 }}
build_flutter_packages:
needs: changes
if: ${{ needs.changes.outputs.needs_flutter_build != '[]' }}
@@ -97,7 +132,13 @@ jobs:
working_directory: ${{ matrix.package }}
ci:
needs: [semantic_pull_request, build_flutter_packages, build_rust_crates]
needs:
[
semantic_pull_request,
build_dart_packages,
build_flutter_packages,
build_rust_crates,
]
if: ${{ always() }}
runs-on: ubuntu-latest