Skip to content

Commit 87754c3

Browse files
Merge pull request #2 from solid-software/actions
Actions
2 parents 8ba6c29 + 975efba commit 87754c3

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: On PR & Push do code check
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Check file existence
15+
id: check_files
16+
uses: andstor/file-existence-action@v1
17+
with:
18+
files: 'pubspec.yaml, tools/add_imports/pubspec.yaml'
19+
20+
- name: Early exit
21+
if: steps.check_files.outputs.files_exists == 'false'
22+
run: |
23+
gh run cancel ${{ github.run_id }}
24+
gh run watch ${{ github.run_id }}
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Setup dart
29+
uses: dart-lang/setup-dart@v1
30+
31+
- name: Get main dependencies
32+
run: dart pub get
33+
34+
- name: Get add_imports dependencies
35+
run: dart pub get
36+
working-directory: tools/add_imports
37+
38+
- name: Run static code analysis
39+
uses: invertase/github-action-dart-analyzer@v1
40+
with:
41+
fatal-infos: true
42+
43+
- name: Dart Code Metrics
44+
uses: solid-software/dart-code-metrics-action@v5
45+
with:
46+
github_token: ${{ secrets.GITHUB_TOKEN }}
47+
fatal_warnings: true
48+
fatal_style: true
49+
50+
- name: Check formatting
51+
run: dart format . --set-exit-if-changed

tools/add_imports/bin/add_imports.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void main(List<String> arguments) {
1212

1313
final configString = File(configpath).readAsStringSync();
1414
final config = Config.fromYaml(configString);
15-
15+
1616
final sourceFile = File(filename);
1717
final sourceString = sourceFile.readAsStringSync();
1818
final newSource = createNewSource(sourceString, config);

0 commit comments

Comments
 (0)