Skip to content

Commit

Permalink
Merge 940a211 into ci-optimization-deps_no_smithy
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-astro-wf authored Mar 29, 2024
2 parents ef42ae7 + 940a211 commit 3eae5f3
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 152 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/area_matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: _

on:
workflow_call:
inputs:
sdk:
required: true
type: string

jobs:
setup:
uses: ./.github/workflows/setup.yml
with:
sdk: ${{ inputs.sdk }}
lib:
needs: [ setup ]
if: ${{ needs.setup.outputs.run_dart_checks == 'true' }}
uses: ./.github/workflows/lib_ci.yml
with:
sdk: ${{ inputs.sdk }}
is_tag_build: ${{ needs.setup.outputs.is_tag_build }}
analyzer_plugin:
needs: [ setup ]
if: ${{ needs.setup.outputs.is_tag_build == 'false' && needs.setup.outputs.run_dart_checks == 'true' }}
uses: ./.github/workflows/plugin_ci.yml
with:
sdk: ${{ inputs.sdk }}
156 changes: 5 additions & 151 deletions .github/workflows/dart_ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Dart CI
name: CI

on:
push:
Expand All @@ -10,158 +10,12 @@ on:
- '**'

jobs:
build:
runs-on: ubuntu-latest
dart:
strategy:
fail-fast: false
matrix:
# Can't run on `dev` (Dart 3) until we're fully null-safe.
sdk: [ 2.18.7, 2.19.6 ]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.sdk }}

- name: Print Dart SDK version
run: dart --version

- id: install
name: Install dependencies
run: dart pub get

- name: Validate dependencies
run: dart run dependency_validator
if: always() && steps.install.outcome == 'success'

- name: Verify formatting
run: dart run dart_dev format --check
# Only run on one sdk version in case there are conflicts
if: always() && matrix.sdk != '2.18.7' && steps.install.outcome == 'success'

# Analyze before generated files are created to verify that component boilerplate analysis is "clean" without the need for building
- name: Analyze example source (pre-build)
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
if: always() && steps.install.outcome == 'success'

- id: build
timeout-minutes: 6
name: Build generated files / precompile DDC assets
run: |
dart run build_runner build --delete-conflicting-outputs -o ddc_precompiled
if: always() && steps.install.outcome == 'success'

- name: Verify that generated files are up-to-date
run: |
if [ ${{ matrix.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
if: always() && steps.install.outcome == 'success' && steps.install.build == 'success'

# Analyze again after generated files are created to verify that those generated classes don't cause analysis errors
- name: Analyze project source (post-build)
run: dart analyze
if: always() && steps.install.outcome == 'success' && steps.build.outcome == 'success'

- name: Run tests (VM)
# Can't use build_runner (which dart_dev uses if you depend on it) to run VM tests, since we get the error:
# Unable to spawn isolate: /…/build_runner_testRU6M77/.packages: Error: Problem in packages configuration file: Unexpected character
run: dart test -P vm
if: always() && steps.install.outcome == 'success' && steps.build.outcome == 'success'

- name: Run tests (DDC)
run: dart test --precompiled ddc_precompiled -P dartdevc
if: always() && steps.install.outcome == 'success' && steps.build.outcome == 'success'

- name: Run tests (dart2js)
run: dart run dart_dev test --build-args="-r" -P dart2js
if: always() && steps.install.outcome == 'success' && steps.build.outcome == 'success'

validate_analyzer:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Can't run on `dev` (Dart 3) until we're fully null-safe.
sdk: [ 2.18.7, 2.19.6 ]
analyzer:
# We only have one version currently, but we'll leave this CI step in place
# for the next time we need to support multiple analyzer versions.
- ^5.1.0
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.sdk }}

- name: Print Dart SDK version
run: dart --version

- name: Update analyzer constraint to ${{ matrix.analyzer }} and validate `dart pub get` can resolve
id: resolve
run: |
dart tool/set_analyzer_constraint.dart "${{ matrix.analyzer }}"
# Show the updated version constraint
git diff pubspec.yaml
dart pub get
- name: Analyze package source
run: dart analyze .

- name: Verify builder runs without errors
run: dart run build_runner build --build-filter='**.dart' --delete-conflicting-outputs

- name: Run builder tests
run: dart test -p vm -- test/vm_tests/builder

analyzer_plugin:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/analyzer_plugin
strategy:
fail-fast: false
matrix:
# Can't run on `stable` (Dart 3) until we're fully null-safe.
sdk: [ 2.19.6 ]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/[email protected]
with:
sdk: ${{ matrix.sdk }}

- name: Print Dart SDK version
run: dart --version

- id: link
name: Override over_react dependency with local path
run: cd ../.. && dart pub get && dart tool/travis_link_plugin_deps.dart

- id: install
name: Install dependencies
run: dart pub get
if: always() && steps.link.outcome == 'success'

- name: Validate dependencies
run: dart run dependency_validator
if: always() && steps.install.outcome == 'success'

- name: Analyze
run: dart run dart_dev analyze
if: always() && steps.install.outcome == 'success'

- name: Verify formatting
run: dart run dart_dev format --check
if: always() && matrix.sdk == '2.7.2' && steps.install.outcome == 'success'

- name: Run tests
run: dart run dart_dev test
if: always() && steps.install.outcome == 'success'
uses: ./.github/workflows/dart_ci_matrix.yml
with:
sdk: ${{ matrix.sdk }}
17 changes: 17 additions & 0 deletions .github/workflows/dart_ci_matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Dart

on:
workflow_call:
inputs:
sdk:
required: true
type: string

jobs:
strategy:
fail-fast: false
matrix:
area: [ lib, plugin ]
uses: ./.github/workflows/area_matrix.yml
with:
sdk: ${{ matrix.sdk }}
124 changes: 124 additions & 0 deletions .github/workflows/lib_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Jobs pertaining to the over_react library

on:
workflow_call:
inputs:
sdk:
required: true
type: string
is_tag_build:
required: true
type: string

jobs:
build-ddc:
runs-on: ubuntu-latest
if: ${{ inputs.is_tag_build == 'false' }}
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ inputs.sdk }}

- id: build
timeout-minutes: 6
name: Build generated files / precompile DDC assets
run: |
dart run build_runner build --delete-conflicting-outputs -o ddc_precompiled
- name: Store precompiled DDC assets
uses: actions/upload-artifact@v4
with:
name: ddc_precompiled@${{ inputs.sdk }}
path: ddc_precompiled

- name: Verify that generated files are up-to-date
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
if: steps.build.outcome == 'success'

# Analyze again after generated files are created to verify that those generated classes don't cause analysis errors
- name: Analyze project source (post-build)
run: dart analyze
if: steps.build.outcome == 'success'

test-ddc:
runs-on: ubuntu-latest
needs: [ build-ddc ]
if: ${{ inputs.is_tag_build == 'false' }}
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ inputs.sdk }}

- name: Get precompiled DDC assets
uses: actions/download-artifact@v4
with:
path: ddc_precompiled
name: ddc_precompiled@${{ inputs.sdk }}

- name: Run tests (DDC)
run: dart test --precompiled ddc_precompiled -P dartdevc

test-dart2js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ inputs.sdk }}

- name: Run tests (dart2js)
run: dart run dart_dev test --build-args="-r" -P dart2js

test-vm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ inputs.sdk }}

- name: Run tests (VM)
# Can't use build_runner (which dart_dev uses if you depend on it) to run VM tests, since we get the error:
# Unable to spawn isolate: /…/build_runner_testRU6M77/.packages: Error: Problem in packages configuration file: Unexpected character
run: dart test -P vm

validate_analyzer:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
analyzer:
# We only have one version currently, but we'll leave this CI step in place
# for the next time we need to support multiple analyzer versions.
- ^5.1.0
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ inputs.sdk }}

- name: Update analyzer constraint to ${{ matrix.analyzer }} and validate `dart pub get` can resolve
id: resolve
run: |
dart tool/set_analyzer_constraint.dart "${{ matrix.analyzer }}"
# Show the updated version constraint
git diff pubspec.yaml
dart pub get
- name: Analyze package source
run: dart analyze .

- name: Verify builder runs without errors
run: dart run build_runner build --build-filter='**.dart' --delete-conflicting-outputs

- name: Run builder tests
run: dart test -p vm -- test/vm_tests/builder
55 changes: 55 additions & 0 deletions .github/workflows/plugin_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Jobs pertaining to the analyzer plugin

on:
workflow_call:
inputs:
sdk:
required: true
type: string

jobs:
install:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/analyzer_plugin
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ inputs.sdk }}

- id: link
name: Override over_react dependency with local path
run: cd ../.. && dart pub get && dart tool/travis_link_plugin_deps.dart

- id: install
name: Install dependencies
run: dart pub get
if: steps.link.outcome == 'success'

- name: Validate dependencies
run: dart run dependency_validator
if: steps.install.outcome == 'success'

format:
if: ${{ inputs.sdk != '2.19.6' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/analyzer_plugin
needs: [ install ]
steps:
- name: Verify formatting
run: dart run dart_dev format --check

test:
if: ${{ inputs.sdk == '2.19.6' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/analyzer_plugin
needs: [ install ]
steps:
- name: Run tests
run: dart run dart_dev test
Loading

0 comments on commit 3eae5f3

Please sign in to comment.