Skip to content

Commit 519ebf3

Browse files
committed
Fix analysis warnings and improve CI pipeline
1 parent 4ba46dc commit 519ebf3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+332
-123
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/dart.yml

Lines changed: 179 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,190 @@
11
name: Dart CI
22

3-
on: [push, pull_request]
3+
env:
4+
PANA_SCORE_THRESHOLD: 40
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
pull_request:
11+
schedule:
12+
- cron: '0 0 1 * *' # Monthly run on the first day of the month at 00:00 UTC
413

514
jobs:
6-
test:
7-
runs-on: ${{ matrix.os }}
15+
16+
#
17+
# Dart packages: format and analyze
18+
#
19+
dart_analyze:
20+
name: "Analyze"
21+
runs-on: ubuntu-slim
822
strategy:
23+
fail-fast: false
924
matrix:
10-
os: [ubuntu-latest]
11-
sdk: [stable, beta, dev]
25+
package:
26+
- cryptography
27+
- jwk
28+
sdk:
29+
# The oldest supported Dart SDK at the moment.
30+
# Feel free to bump it up whenever needed.
31+
- 3.3.0
32+
33+
# We want to support the latest beta SDK as well.
34+
- beta
1235
steps:
13-
- uses: actions/checkout@v3
1436
- uses: dart-lang/setup-dart@v1
1537
with:
1638
sdk: ${{ matrix.sdk }}
17-
- name: Run tests (cryptography)
18-
run: dart test --platform vm
19-
working-directory: ./cryptography
20-
- name: Run tests (cryptography_test)
21-
run: dart test --platform vm
22-
working-directory: ./cryptography_test
23-
- name: Run tests (jwk)
24-
run: dart test --platform vm
25-
working-directory: ./jwk
26-
- name: Analyze (cryptography)
27-
run: dart analyze
28-
working-directory: ./cryptography
29-
- name: Analyze (jwk)
39+
- uses: actions/checkout@v3
40+
- name: Get dependencies
41+
run: dart pub get
42+
working-directory: ./${{ matrix.package }}
43+
- name: Verify that code is formatted
44+
continue-on-error: true
45+
run: dart format --set-exit-if-changed .
46+
working-directory: "./${{ matrix.package }}"
47+
- name: Analyze
3048
run: dart analyze
31-
working-directory: ./jwk
49+
working-directory: ./${{ matrix.package }}
50+
51+
#
52+
# Dart packages: test
53+
#
54+
dart_test:
55+
name: "Test"
56+
needs: dart_analyze
57+
runs-on: ubuntu-latest
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
package:
62+
- cryptography
63+
- jwk
64+
compiler:
65+
- vm
66+
- dart2js
67+
steps:
68+
- uses: browser-actions/setup-chrome@v2
69+
if: ${{ matrix.compiler != 'vm' }}
70+
- uses: dart-lang/setup-dart@v1
71+
with:
72+
sdk: beta
73+
- uses: actions/checkout@v3
74+
- name: Get dependencies
75+
run: dart pub get
76+
working-directory: ./${{ matrix.package }}
77+
- name: "Test: VM build"
78+
if: ${{ matrix.compiler == 'vm' }}
79+
run: dart test --platform vm
80+
working-directory: ./${{ matrix.package }}
81+
- name: "Test: JS build"
82+
if: ${{ matrix.compiler == 'vm' }}
83+
run: dart test --platform chrome --compiler dart2js
84+
working-directory: ./${{ matrix.package }}
85+
86+
#
87+
# Dart packages: PANA score
88+
#
89+
dart_package_health:
90+
name: "PANA"
91+
needs: dart_analyze
92+
runs-on: ubuntu-slim
93+
strategy:
94+
fail-fast: false
95+
matrix:
96+
package:
97+
- cryptography
98+
- jwk
99+
steps:
100+
- uses: dart-lang/setup-dart@v1
101+
- uses: actions/checkout@v3
102+
- name: Get dependencies
103+
run: dart pub get
104+
working-directory: ./${{ matrix.package }}
105+
- name: Print outdated dependencies
106+
continue-on-error: true
107+
run: dart pub outdated
108+
working-directory: ./${{ matrix.package }}
109+
- name: Install package analyzer
110+
run: dart pub global activate pana
111+
- name: Run package analyzer
112+
continue-on-error: true
113+
run: dart pub global run pana --exit-code-threshold $PANA_SCORE_THRESHOLD .
114+
working-directory: ./${{ matrix.package }}
115+
#
116+
# Flutter packages: format and analyze
117+
#
118+
flutter_analyze:
119+
name: "Analyze"
120+
runs-on: ubuntu-latest
121+
strategy:
122+
fail-fast: false
123+
matrix:
124+
package:
125+
- cryptography_flutter
126+
- cryptography_flutter_integration_test
127+
sdk:
128+
# The oldest supported Dart SDK at the moment.
129+
# Feel free to bump it up whenever needed.
130+
- 3.35.0
131+
132+
# We want to support the latest beta SDK as well.
133+
- beta
134+
steps:
135+
- name: Install Flutter
136+
run: |
137+
cd $HOME
138+
git clone https://github.com/flutter/flutter.git --depth 1 -b ${{ matrix.sdk }} _flutter
139+
echo "$HOME/_flutter/bin" >> $GITHUB_PATH
140+
cd $GITHUB_WORKSPACE
141+
- uses: actions/checkout@v3
142+
- name: Get dependencies
143+
run: flutter pub get
144+
working-directory: ./${{ matrix.package }}
145+
- name: Verify that code is formatted
146+
continue-on-error: true
147+
run: dart format --set-exit-if-changed .
148+
working-directory: ./${{ matrix.package }}
149+
- name: Analyze
150+
run: flutter analyze
151+
working-directory: ./${{ matrix.package }}
152+
153+
#
154+
# Unfortunately we don't have Flutter integration tests in Github Actions yet. :(
155+
#
156+
157+
#
158+
# Flutter packages: PANA score
159+
#
160+
flutter_package_health:
161+
name: "PANA"
162+
needs: flutter_analyze
163+
strategy:
164+
fail-fast: false
165+
matrix:
166+
package:
167+
- cryptography_flutter
168+
runs-on: ubuntu-latest
169+
steps:
170+
- name: Install Flutter
171+
run: |
172+
cd $HOME
173+
git clone https://github.com/flutter/flutter.git --depth 1 -b beta _flutter
174+
echo "$HOME/_flutter/bin" >> $GITHUB_PATH
175+
cd $GITHUB_WORKSPACE
176+
- uses: actions/checkout@v3
177+
- name: Get dependencies
178+
run: flutter pub get
179+
working-directory: ./${{ matrix.package }}
180+
- name: Print outdated dependencies
181+
continue-on-error: true
182+
run: flutter pub outdated
183+
working-directory: ./${{ matrix.package }}
184+
- name: Install package analyzer
185+
run: flutter pub global activate pana
186+
working-directory: ./${{ matrix.package }}
187+
- name: Run package analyzer
188+
continue-on-error: true
189+
run: flutter pub global run pana --exit-code-threshold $PANA_SCORE_THRESHOLD .
190+
working-directory: ./${{ matrix.package }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Publish to pub.dev
2+
3+
on:
4+
push:
5+
tags:
6+
- 'cryptography-v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
publish:
10+
permissions:
11+
id-token: write
12+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@daef289245bc5d4ab7864e0788a58108a9be6c99
13+
with:
14+
environment: pub.dev
15+
working-directory: ./cryptography
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Publish to pub.dev
2+
3+
on:
4+
push:
5+
tags:
6+
- 'cryptography_flutter-v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
publish:
10+
permissions:
11+
id-token: write
12+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@daef289245bc5d4ab7864e0788a58108a9be6c99
13+
with:
14+
environment: pub.dev
15+
working-directory: ./cryptography_flutter

.github/workflows/publish_jwk.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Publish to pub.dev
2+
3+
on:
4+
push:
5+
tags:
6+
- 'jwk-v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
publish:
10+
permissions:
11+
id-token: write
12+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@daef289245bc5d4ab7864e0788a58108a9be6c99
13+
with:
14+
environment: pub.dev
15+
working-directory: ./jwk

cryptography/dart_test.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
platforms: [ vm, chrome ]
1+
platforms:
2+
- vm
3+
- chrome
4+
compilers:
5+
- dart2js

cryptography/lib/browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'This library will be removed in a future major version.'
1818
' You can find `BrowserCryptography` class in "package:cryptography/cryptography.dart".',
1919
)
20-
library cryptography.browser;
20+
library;
2121

2222
export 'src/browser/browser_cryptography_when_not_browser.dart'
2323
if (dart.library.html) 'src/browser/browser_cryptography.dart';

cryptography/lib/cryptography.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
///
2525
/// ## Factory methods
2626
/// [Cryptography] contains factory methods for cryptographic algorithms.
27-
library cryptography;
27+
library;
2828

2929
import 'package:cryptography/cryptography.dart';
3030

cryptography/lib/dart.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/// Cryptographic algorithms implemented in pure Dart.
1616
///
1717
/// See [DartCryptography].
18-
library cryptography.dart;
18+
library;
1919

2020
import 'package:cryptography/dart.dart';
2121

cryptography/lib/helpers.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
/// Various helpers for cryptography.
16-
library cryptography.helpers;
16+
library;
1717

1818
export 'src/helpers/constant_time_equality.dart';
1919
export 'src/helpers/delegating_classes.dart';

0 commit comments

Comments
 (0)