Skip to content

FED-4060 Set up gha-dart-oss #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
48 changes: 26 additions & 22 deletions .github/workflows/dart_ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,45 @@ on:
jobs:
# Run as a separate job outside the Dart SDK matrix below,
# since we can only emit a single SBOM.
create-sbom-release-asset:
name: Create SBOM Release Asset
build:
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]

checks:
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]
with:
additional-checks: |
no_entrypoint_imports

# Run Dart 3 analysis as a separate job outside checks above in order to pre-run the
# Dart-2-only file removal script. Consolidate this job with checks above once checks.yaml
# supports a pre-run option or we upgrade to Dart 3 and remove the files.
stable-analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: 2.19.6 # This version doesn't matter so long as it resolves.
sdk: stable

- name: Print Dart SDK version
run: dart --version
- run: dart pub get
- name: Publish SBOM to Release Assets
uses: anchore/sbom-action@v0
with:
path: ./
format: cyclonedx-json

build:
- name: Delete Dart-2-only files when running on Dart 3
run: ./tool/delete_dart_2_only_files.sh

- name: Analyze project source
run: dart analyze

test:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I changed this from "build" to "test" - I'll update Rosie to check for the new-named CI checks before this merges

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use the shared unit-test from gha-dart-oss yet because we can't run other commands beforehand - see slack thread

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
react: [17, 18]
sdk: [2.19.6, stable]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- id: setup-dart
uses: dart-lang/setup-dart@v1
with:
Expand All @@ -50,6 +65,7 @@ jobs:
if [[ "$DART_VERSION" =~ ^3 ]]; then
./tool/delete_dart_2_only_files.sh
fi

- name: Switch to React 17 Test HTML
if: ${{ matrix.react == 17 }}
run: |
Expand All @@ -60,18 +76,6 @@ jobs:
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
if: ${{ matrix.sdk == '2.19.6' }}

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

- name: Run tests (DDC)
run: |
dart run build_runner test --delete-conflicting-outputs -- --preset dartdevc --preset=react${{ matrix.react }}
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
publish:
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 7.3.1
- Set up gha-dart-oss
- Fix no_entrypoint_imports warnings

## 7.3.0
- Add new, opt-in React 18 JS files (see [README](https://github.com/Workiva/react-dart#html) for more info)
- The preexisting JS files that use React 17 are now deprecated, and will be removed in the next major version, 8.0.0.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dev_dependencies:
build_runner: ^2.1.2
build_test: ^2.1.3
build_web_compilers: '>=3.0.0 <5.0.0'
dart_dev: ^4.0.0
dart_dev: ^4.2.4
dependency_validator: ^3.2.2
glob: ^2.0.0
matcher: ^0.12.11
Expand Down
1 change: 1 addition & 0 deletions tool/dart_dev/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ final config = {
// Don't format generated mockito files.
Glob('test/mockito.mocks.dart'),
],
'analyze': AnalyzeTool(),
};