Skip to content

Commit fd96567

Browse files
committed
Update workflows
1 parent 155623c commit fd96567

3 files changed

Lines changed: 138 additions & 48 deletions

File tree

.github/workflows/release-test.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Test for Release
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: dart-lang/setup-dart@v1
13+
14+
- name: Cache dependencies
15+
uses: actions/cache@v4
16+
with:
17+
path: |
18+
~/.pub-cache
19+
.dart_tool/package_config.json
20+
key: ${{ runner.os }}-test-${{ hashFiles('**/pubspec.lock') }}
21+
22+
- name: Install dependencies
23+
run: dart pub get
24+
25+
- name: Verify formatting
26+
run: dart format --output=none --set-exit-if-changed .
27+
28+
- name: Analyze project source
29+
run: dart analyze --fatal-infos
30+
31+
test:
32+
needs: lint
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
os: [ubuntu-latest, macos-latest, windows-latest]
37+
sdk: ['stable', '2.19', 'beta']
38+
platform: ['vm', 'node']
39+
exclude:
40+
# skip test for beta
41+
- sdk: 'beta'
42+
os: macos-latest
43+
- sdk: 'beta'
44+
os: windows-latest
45+
- sdk: 'beta'
46+
platform: 'node'
47+
# Skip node platform
48+
- platform: 'node'
49+
sdk: '2.19'
50+
os: macos-latest
51+
- platform: 'node'
52+
sdk: '2.19'
53+
os: windows-latest
54+
runs-on: ${{ matrix.os }}
55+
steps:
56+
- uses: actions/checkout@v4
57+
- uses: dart-lang/setup-dart@v1
58+
with:
59+
sdk: ${{ matrix.sdk }}
60+
61+
- name: Cache dependencies
62+
uses: actions/cache@v4
63+
with:
64+
path: |
65+
~/.pub-cache
66+
.dart_tool/package_config.json
67+
key: ${{ runner.os }}-test-${{ hashFiles('**/pubspec.lock') }}
68+
69+
- name: Install dependencies
70+
run: dart pub get
71+
72+
- name: Run tests
73+
run: dart test -p ${{ matrix.platform }}
74+
75+
integration:
76+
needs: lint
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
os: [ubuntu-latest, macos-latest, windows-latest]
81+
sdk: ['stable', '2.19', 'beta']
82+
exclude:
83+
# skip test on macOS/Windows for beta
84+
- sdk: 'beta'
85+
os: macos-latest
86+
- sdk: 'beta'
87+
os: windows-latest
88+
runs-on: ${{ matrix.os }}
89+
steps:
90+
- uses: actions/checkout@v4
91+
- uses: dart-lang/setup-dart@v1
92+
with:
93+
sdk: ${{ matrix.sdk }}
94+
95+
- name: Cache dependencies
96+
uses: actions/cache@v4
97+
with:
98+
path: |
99+
~/.pub-cache
100+
.dart_tool/package_config.json
101+
key: ${{ runner.os }}-test-${{ hashFiles('**/pubspec.lock') }}
102+
103+
- name: Run tests
104+
run: |
105+
cd test_integration
106+
dart pub get
107+
dart run main.dart
108+
109+
pana:
110+
if: github.repository == 'bitanon/hashlib_codecs'
111+
runs-on: ubuntu-latest
112+
steps:
113+
- uses: actions/checkout@v4
114+
- uses: dart-lang/setup-dart@v1
115+
116+
- name: Install pana
117+
run: dart pub global activate pana
118+
119+
- name: Verify with pana
120+
run: pana --exit-code-threshold 0

.github/workflows/release.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ on:
66
- 'v[0-9]+.[0-9]+.[0-9]+*'
77

88
jobs:
9+
version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Check tag version matches pubspec.yaml
14+
run: |
15+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
16+
PUBSPEC_VERSION=$(grep '^version:' pubspec.yaml | awk '{ print $2 }' | tr -d '[:space:]')
17+
if [ "$TAG_VERSION" != "$PUBSPEC_VERSION" ]; then
18+
echo "Tag version ($TAG_VERSION) does not match pubspec.yaml version ($PUBSPEC_VERSION)"
19+
exit 1
20+
fi
21+
922
test:
10-
uses: ./.github/workflows/test.yml
23+
needs: version
24+
uses: ./.github/workflows/release-test.yml
1125

1226
publish:
1327
if: github.repository == 'bitanon/hashlib_codecs'
@@ -22,15 +36,6 @@ jobs:
2236
- name: Install dependencies
2337
run: dart pub get
2438

25-
- name: Check tag version matches pubspec.yaml
26-
run: |
27-
TAG_VERSION=${GITHUB_REF#refs/tags/v}
28-
PUBSPEC_VERSION=$(grep '^version:' pubspec.yaml | awk '{ print $2 }')
29-
if [ "$TAG_VERSION" != "$PUBSPEC_VERSION" ]; then
30-
echo "Tag version ($TAG_VERSION) does not match pubspec.yaml version ($PUBSPEC_VERSION)"
31-
exit 1
32-
fi
33-
3439
- name: Publish - dry run
3540
run: dart pub publish --dry-run
3641

.github/workflows/test.yml

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Test
22

33
on:
4-
workflow_call:
54
workflow_dispatch:
65
push:
76
branches: [master]
@@ -58,23 +57,8 @@ jobs:
5857
fail-fast: false
5958
matrix:
6059
os: [ubuntu-latest, macos-latest, windows-latest]
61-
sdk: ['stable', '2.19', 'beta']
62-
platform: ['vm', 'node']
63-
exclude:
64-
# skip test for beta
65-
- sdk: 'beta'
66-
os: macos-latest
67-
- sdk: 'beta'
68-
os: windows-latest
69-
- sdk: 'beta'
70-
platform: 'node'
71-
# Skip node platform
72-
- platform: 'node'
73-
sdk: '2.19'
74-
os: macos-latest
75-
- platform: 'node'
76-
sdk: '2.19'
77-
os: windows-latest
60+
sdk: ['stable', '2.19']
61+
platform: ['vm']
7862
runs-on: ${{ matrix.os }}
7963
steps:
8064
- uses: actions/checkout@v4
@@ -102,13 +86,7 @@ jobs:
10286
fail-fast: false
10387
matrix:
10488
os: [ubuntu-latest, macos-latest, windows-latest]
105-
sdk: ['stable', '2.19', 'beta']
106-
exclude:
107-
# skip test on macOS/Windows for beta
108-
- sdk: 'beta'
109-
os: macos-latest
110-
- sdk: 'beta'
111-
os: windows-latest
89+
sdk: ['stable', '2.19']
11290
runs-on: ${{ matrix.os }}
11391
steps:
11492
- uses: actions/checkout@v4
@@ -130,19 +108,6 @@ jobs:
130108
dart pub get
131109
dart run main.dart
132110
133-
pana:
134-
if: github.repository == 'bitanon/hashlib_codecs'
135-
runs-on: ubuntu-latest
136-
steps:
137-
- uses: actions/checkout@v4
138-
- uses: dart-lang/setup-dart@v1
139-
140-
- name: Install pana
141-
run: dart pub global activate pana
142-
143-
- name: Verify with pana
144-
run: pana --exit-code-threshold 0
145-
146111
coverage:
147112
if: github.repository == 'bitanon/hashlib_codecs'
148113
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)