Skip to content

Commit 6389fb8

Browse files
committed
ci: refactor workflows to use centralized commands
Replace direct dart commands with custom commands defined in commands.yaml. This improves maintainability by centralizing command definitions and makes it easier to update test/analysis/format configurations across all workflows. - Add commands.yaml with format, analyze, and tests commands - Update CI workflow to use setup-commands action - Update release workflow to use setup-commands action
1 parent 31dd7c0 commit 6389fb8

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@ jobs:
2121
- name: Get dependencies
2222
run: dart pub get --no-example
2323

24-
- name: Static code analysis
25-
run: dart analyze --fatal-infos
26-
24+
- name: Set up commands
25+
uses: Nikoro/setup-commands@v1
26+
27+
- name: Activate commands
28+
run: commands
29+
2730
- name: Check code formatting
28-
run: dart format --output=none --set-exit-if-changed .
29-
30-
- name: Unit tests
31-
run: dart test --coverage --test-randomize-ordering-seed=random --reporter=expanded
31+
run: format
32+
33+
- name: Static code analysis
34+
run: analyze
35+
36+
- name: Run unit tests
37+
run: tests
3238

3339
- name: Upload coverage reports to Codecov
3440
uses: codecov/codecov-action@v4.1.0

.github/workflows/release.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,20 @@ jobs:
2828
fi
2929
echo "✓ Version validated: $PUBSPEC_VERSION"
3030
31-
- name: Static code analysis
32-
run: dart analyze --fatal-infos
33-
31+
- name: Set up commands
32+
uses: Nikoro/setup-commands@v1
33+
34+
- name: Activate commands
35+
run: commands
36+
3437
- name: Check code formatting
35-
run: dart format --output=none --set-exit-if-changed .
36-
37-
- name: Run tests
38-
run: dart test --test-randomize-ordering-seed=random
38+
run: format
39+
40+
- name: Static code analysis
41+
run: analyze
42+
43+
- name: Run unit tests
44+
run: tests
3945

4046
- name: Dry run publish
4147
run: dart pub publish --dry-run

commands.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
format: ## Check code formatting
2+
script: dart format --output=none --set-exit-if-changed .
3+
analyze: ## Static code analysis
4+
script: dart analyze --fatal-infos
5+
tests: ## Run unit tests
6+
script: dart test --coverage --test-randomize-ordering-seed=random

0 commit comments

Comments
 (0)