-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d5f538
commit 0165f7f
Showing
4 changed files
with
213 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: setup | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sdk: | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
install: | ||
uses: ./install.yml | ||
with: | ||
sdk: ${{ inputs.sdk }} | ||
secrets: inherit | ||
|
||
build: | ||
needs: [install] | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Analyze before generated files are created to verify that component boilerplate analysis is "clean" without the need for building | ||
- name: Analyze source (pre-build) | ||
id: analyze-prebuild | ||
run: | | ||
# Analyze lib to ensure public APIs don't depend on build-to-cache files, | ||
# which could cause analysis issues for consumers who haven't run a build yet. | ||
dart analyze lib | ||
dart analyze example/boilerplate_versions | ||
- name: Restore pub cache | ||
id: cache-restore | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: .dart_tool | ||
key: ${{ needs.install.outputs.hash }} | ||
|
||
- name: Precompile DDC | ||
id: precompile | ||
timeout-minutes: 6 | ||
if: steps.cache-restore.outputs.cache-hit != 'true' | ||
run: dart run build_runner build --delete-conflicting-outputs -o ddc_precompiled | ||
|
||
- name: Save pub cache | ||
id: cache-save | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: .dart_tool | ||
key: ${{ needs.install.outputs.hash }} | ||
|
||
- name: Verify that generated files are up-to-date | ||
if: steps.precompile.outcome == 'success' || steps.precompile.outcome == 'skipped' | ||
run: | | ||
if [ ${{ inputs.sdk }} = '2.18.7' ]; then | ||
git diff --exit-code | ||
else | ||
# Don't check these generated files for other SDKs, since they may generate differently | ||
# due to different resolved dependencies. | ||
git diff --exit-code -- ":(exclude)test/mockito.mocks.dart" ":(exclude)test/over_react/component_declaration/redux_component_test/test_reducer.g.dart" | ||
fi | ||
# Analyze again after generated files are created to verify that those generated classes don't cause analysis errors | ||
- name: Analyze source (post-build) | ||
if: steps.precompile.outcome == 'success' || steps.precompile.outcome == 'skipped' | ||
run: dart analyze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: test | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sdk: | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
ddc: | ||
runs-on: ubuntu-latest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: install | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sdk: | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
hash: ${{ steps.hash.outputs.result }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/setup-dart@v1 | ||
with: | ||
sdk: ${{ inputs.sdk }} | ||
- name: Print Dart SDK version | ||
run: dart --version | ||
- name: Produce hash | ||
id: hash | ||
shell: bash | ||
run: echo "result=${{ runner.os }};${{ hashFiles('**/pubspec.yaml','**/pubspec.lock') || 'none' }}@${{ inputs.sdk }}" >> $GITHUB_OUTPUT | ||
|
||
- uses: actions/cache@v4 | ||
name: Pub Cache | ||
id: cache | ||
with: | ||
path: .dart_tool | ||
key: ${{ steps.hash.outputs.result }} | ||
|
||
- name: Install Dependencies | ||
id: install | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: dart pub get | ||
|
||
check: | ||
needs: [install] | ||
steps: | ||
- name: Validate Dependencies | ||
run: dart run dependency_validator | ||
- name: Verify formatting | ||
# Only run on one sdk version in case there are conflicts | ||
if: inputs.sdk != '2.18.7' | ||
run: dart run dart_dev format --check |