Skip to content

Commit a6f11ae

Browse files
Make a shared workflow
1 parent 51c6970 commit a6f11ae

File tree

2 files changed

+69
-67
lines changed

2 files changed

+69
-67
lines changed

.github/workflows/actions/test.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Test Workflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
sdk:
7+
required: true
8+
type: string
9+
default: 2.19.6
10+
11+
jobs:
12+
pre:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Delete Dart-2-only files when running on Dart 3
17+
if: ${{ inputs.sdk != '2.19.6' }}
18+
run: |
19+
./tool/delete_dart_2_only_files.sh
20+
21+
checks:
22+
needs: pre
23+
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]
24+
with:
25+
additional-checks: |
26+
no_entrypoint_imports
27+
sdk: ${{ inputs.sdk }}
28+
format-check: ${{ inputs.sdk == '2.19.6' }}
29+
30+
test:
31+
runs-on: ubuntu-latest
32+
needs: pre
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
react: [ 17, 18 ]
37+
steps:
38+
- uses: actions/checkout@v2
39+
- id: setup-dart
40+
uses: dart-lang/setup-dart@v1
41+
with:
42+
sdk: ${{ inputs.sdk }}
43+
44+
- name: Print Dart SDK version
45+
run: dart --version
46+
47+
- name: Switch to React 17 Test HTML
48+
if: ${{ matrix.react == 17 }}
49+
run: |
50+
mv test/templates/html_template.html test/templates/html_template-old.html
51+
mv test/templates/html_template-react17.html test/templates/html_template.html
52+
53+
- id: install
54+
name: Install dependencies
55+
run: dart pub get
56+
57+
- name: Run tests (DDC)
58+
run: |
59+
dart run build_runner test --delete-conflicting-outputs -- --preset dartdevc --preset=react${{ matrix.react }}
60+
if: always() && steps.install.outcome == 'success'
61+
timeout-minutes: 8
62+
63+
- name: Run tests (dart2js)
64+
run: |
65+
dart run build_runner test --delete-conflicting-outputs --release -- --preset dart2js --preset=react${{ matrix.react }}
66+
if: always() && steps.install.outcome == 'success'
67+
timeout-minutes: 8

.github/workflows/ci.yml

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,82 +10,17 @@ on:
1010
- '**'
1111

1212
jobs:
13-
pre:
14-
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
sdk: [ 2.19.6, stable ]
18-
outputs:
19-
sdk: ${{ matrix.sdk }}
20-
steps:
21-
- uses: actions/checkout@v2
22-
- name: Delete Dart-2-only files when running on Dart 3
23-
if: ${{ matrix.sdk != '2.19.6' }}
24-
run: |
25-
./tool/delete_dart_2_only_files.sh
26-
2713
checks:
28-
needs: pre
2914
strategy:
3015
matrix:
31-
sdk: ${{ needs.pre.outputs.sdk }}
32-
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]
16+
sdk: [ 2.19.6, stable ]
17+
uses: ./.github/workflows/actions/test.yml
3318
with:
34-
additional-checks: |
35-
no_entrypoint_imports
3619
sdk: ${{ matrix.sdk }}
37-
format-check: ${{ matrix.sdk == '2.19.6' }}
3820

3921
# Run as a separate job outside the Dart SDK matrix below,
4022
# since we can only emit a single SBOM.
4123
build:
4224
uses: Workiva/gha-dart-oss/.github/workflows/[email protected]
4325
with:
4426
sdk: 2.19.6 # This version doesn't matter so long as it resolves.
45-
46-
test:
47-
runs-on: ubuntu-latest
48-
needs: pre
49-
strategy:
50-
fail-fast: false
51-
matrix:
52-
react: [ 17, 18 ]
53-
sdk: ${{ needs.pre.outputs.sdk }}
54-
steps:
55-
- uses: actions/checkout@v2
56-
- id: setup-dart
57-
uses: dart-lang/setup-dart@v1
58-
with:
59-
sdk: ${{ matrix.sdk }}
60-
61-
- name: Print Dart SDK version
62-
run: dart --version
63-
64-
- name: Delete Dart-2-only files when running on Dart 3
65-
run: |
66-
DART_VERSION="${{ steps.setup-dart.outputs.dart-version }}"
67-
if [[ "$DART_VERSION" =~ ^3 ]]; then
68-
./tool/delete_dart_2_only_files.sh
69-
fi
70-
71-
- name: Switch to React 17 Test HTML
72-
if: ${{ matrix.react == 17 }}
73-
run: |
74-
mv test/templates/html_template.html test/templates/html_template-old.html
75-
mv test/templates/html_template-react17.html test/templates/html_template.html
76-
77-
- id: install
78-
name: Install dependencies
79-
run: dart pub get
80-
81-
- name: Run tests (DDC)
82-
run: |
83-
dart run build_runner test --delete-conflicting-outputs -- --preset dartdevc --preset=react${{ matrix.react }}
84-
if: always() && steps.install.outcome == 'success'
85-
timeout-minutes: 8
86-
87-
- name: Run tests (dart2js)
88-
run: |
89-
dart run build_runner test --delete-conflicting-outputs --release -- --preset dart2js --preset=react${{ matrix.react }}
90-
if: always() && steps.install.outcome == 'success'
91-
timeout-minutes: 8

0 commit comments

Comments
 (0)