Skip to content

Commit 4826483

Browse files
Merge pull request #422 from Workiva/setup-gha-dart-oss
FED-4060 Set up gha-dart-oss
2 parents f6ae8c1 + 4b5450e commit 4826483

File tree

5 files changed

+60
-23
lines changed

5 files changed

+60
-23
lines changed

.github/workflows/dart_ci.yml renamed to .github/workflows/ci.yml

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,45 @@ on:
1212
jobs:
1313
# Run as a separate job outside the Dart SDK matrix below,
1414
# since we can only emit a single SBOM.
15-
create-sbom-release-asset:
16-
name: Create SBOM Release Asset
15+
build:
16+
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]
17+
18+
checks:
19+
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]
20+
with:
21+
additional-checks: |
22+
no_entrypoint_imports
23+
24+
# Run Dart 3 analysis as a separate job outside checks above in order to pre-run the
25+
# Dart-2-only file removal script. Consolidate this job with checks above once checks.yaml
26+
# supports a pre-run option or we upgrade to Dart 3 and remove the files.
27+
stable-analyze:
1728
runs-on: ubuntu-latest
1829
steps:
1930
- uses: actions/checkout@v4
2031
- uses: dart-lang/setup-dart@v1
2132
with:
22-
sdk: 2.19.6 # This version doesn't matter so long as it resolves.
33+
sdk: stable
34+
35+
- name: Print Dart SDK version
36+
run: dart --version
2337
- run: dart pub get
24-
- name: Publish SBOM to Release Assets
25-
uses: anchore/sbom-action@v0
26-
with:
27-
path: ./
28-
format: cyclonedx-json
2938

30-
build:
39+
- name: Delete Dart-2-only files when running on Dart 3
40+
run: ./tool/delete_dart_2_only_files.sh
41+
42+
- name: Analyze project source
43+
run: dart analyze
44+
45+
test:
3146
runs-on: ubuntu-latest
3247
strategy:
3348
fail-fast: false
3449
matrix:
3550
react: [17, 18]
3651
sdk: [2.19.6, stable]
3752
steps:
38-
- uses: actions/checkout@v2
53+
- uses: actions/checkout@v4
3954
- id: setup-dart
4055
uses: dart-lang/setup-dart@v1
4156
with:
@@ -50,6 +65,7 @@ jobs:
5065
if [[ "$DART_VERSION" =~ ^3 ]]; then
5166
./tool/delete_dart_2_only_files.sh
5267
fi
68+
5369
- name: Switch to React 17 Test HTML
5470
if: ${{ matrix.react == 17 }}
5571
run: |
@@ -60,18 +76,6 @@ jobs:
6076
name: Install dependencies
6177
run: dart pub get
6278

63-
- name: Validate dependencies
64-
run: dart run dependency_validator
65-
if: always() && steps.install.outcome == 'success'
66-
67-
- name: Verify formatting
68-
run: dart run dart_dev format --check
69-
if: ${{ matrix.sdk == '2.19.6' }}
70-
71-
- name: Analyze project source
72-
run: dart analyze
73-
if: always() && steps.install.outcome == 'success'
74-
7579
- name: Run tests (DDC)
7680
run: |
7781
dart run build_runner test --delete-conflicting-outputs -- --preset dartdevc --preset=react${{ matrix.react }}
@@ -83,3 +87,16 @@ jobs:
8387
dart run build_runner test --delete-conflicting-outputs --release -- --preset dart2js --preset=react${{ matrix.react }}
8488
if: always() && steps.install.outcome == 'success'
8589
timeout-minutes: 8
90+
91+
testing-and-checks-complete:
92+
name: Testing and Checks Completed
93+
needs: [ build, checks, test ]
94+
if: ${{ !cancelled() && github.event_name == 'pull_request' || github.ref_type == 'tag' }}
95+
runs-on: ubuntu-latest
96+
steps:
97+
- run: |
98+
if [ "${{ needs.checks.result }}" == "failure" ]; then
99+
echo "Some checks have failed. Please fix the issues and try again."
100+
exit 1
101+
fi
102+
echo 'All Testing and checks have completed.'

.github/workflows/publish.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
pull-requests: write
12+
13+
jobs:
14+
publish:
15+
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Unreleased
2+
- Set up gha-dart-oss
3+
- Fix no_entrypoint_imports warnings
4+
15
## 7.3.0
26
- Add new, opt-in React 18 JS files (see [README](https://github.com/Workiva/react-dart#html) for more info)
37
- The preexisting JS files that use React 17 are now deprecated, and will be removed in the next major version, 8.0.0.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dev_dependencies:
1212
build_runner: ^2.1.2
1313
build_test: ^2.1.3
1414
build_web_compilers: '>=3.0.0 <5.0.0'
15-
dart_dev: ^4.0.0
15+
dart_dev: ^4.2.4
1616
dependency_validator: ^3.2.2
1717
glob: ^2.0.0
1818
matcher: ^0.12.11

tool/dart_dev/config.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ final config = {
2222
// Don't format generated mockito files.
2323
Glob('test/mockito.mocks.dart'),
2424
],
25+
'analyze': AnalyzeTool(),
2526
};

0 commit comments

Comments
 (0)