Skip to content

Commit

Permalink
Merge branch 'main' into design
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel authored May 23, 2024
2 parents 7a681d0 + 4685789 commit 0683f3d
Show file tree
Hide file tree
Showing 39 changed files with 1,928 additions and 98 deletions.
82 changes: 82 additions & 0 deletions .github/actions/dart_package/action.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
43 changes: 42 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
Expand Down Expand Up @@ -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 != '[]' }}
Expand All @@ -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
Expand Down
56 changes: 14 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion library/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ log-panics = { version = "2", features = ["with-backtrace"] }
oslog = "0.2.0"

[dev-dependencies]
mockall = "0.11.4"
mockall = "0.12.1"
mockito = "1.2.0"
# Gives #[serial] attribute for locking all of our shorebird_init
# tests to a single thread so they don't conflict with each other.
Expand Down
2 changes: 2 additions & 0 deletions library/src/c_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ mod test {
number: 1,
hash: hash.to_owned(),
download_url: "ignored".to_owned(),
signature: None,
}),
})
},
Expand Down Expand Up @@ -582,6 +583,7 @@ mod test {
number: 1,
hash: "ignored".to_owned(),
download_url: "ignored".to_owned(),
signature: None,
}),
})
},
Expand Down
Loading

0 comments on commit 0683f3d

Please sign in to comment.