Skip to content

Commit 9e77a30

Browse files
committed
ci: align workflows with screen_retriever
- Merge lint, build, test into single ci.yml matching screen_retriever - Switch from bluefireteam/melos-action to manual melos setup - Upgrade actions/checkout from v3 to v4 - Add cache to Flutter setup - Add needs: [lint] dependency for build jobs - Add publish.yml for pub.dev publishing with OIDC - Remove old build.yml, lint.yml, test.yml
1 parent 6af5871 commit 9e77a30

5 files changed

Lines changed: 217 additions & 115 deletions

File tree

.github/workflows/build.yml

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

.github/workflows/ci.yml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Lint & Analyze
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Flutter
19+
uses: subosito/flutter-action@v2
20+
with:
21+
flutter-version: '3.44.1'
22+
channel: 'stable'
23+
cache: true
24+
25+
- name: Install melos
26+
run: dart pub global activate melos
27+
28+
- name: Add melos to PATH
29+
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
30+
31+
- name: Verify melos installation
32+
run: dart pub global run melos --version
33+
34+
- name: Bootstrap melos
35+
run: dart pub global run melos bootstrap
36+
37+
- name: Check code formatting
38+
run: dart pub global run melos run format-check
39+
40+
- name: Analyze code
41+
run: dart pub global run melos run analyze
42+
43+
test:
44+
name: Test (${{ matrix.os }})
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
os: [ubuntu-latest, macos-latest, windows-latest]
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Setup Flutter
56+
uses: subosito/flutter-action@v2
57+
with:
58+
flutter-version: '3.44.1'
59+
channel: 'stable'
60+
cache: true
61+
62+
- name: Install melos
63+
run: dart pub global activate melos
64+
65+
- name: Add melos to PATH
66+
shell: bash
67+
run: |
68+
if [[ "$RUNNER_OS" == "Windows" ]]; then
69+
echo "$USERPROFILE/.pub-cache/bin" >> $GITHUB_PATH
70+
else
71+
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
72+
fi
73+
74+
- name: Verify melos installation
75+
run: dart pub global run melos --version
76+
77+
- name: Bootstrap melos
78+
run: dart pub global run melos bootstrap
79+
80+
- name: Run tests
81+
run: dart pub global run melos run test
82+
83+
# Linux build
84+
build-linux:
85+
name: Build Linux
86+
runs-on: ubuntu-latest
87+
needs: [lint]
88+
89+
steps:
90+
- name: Checkout repository
91+
uses: actions/checkout@v4
92+
93+
- name: Setup Flutter
94+
uses: subosito/flutter-action@v2
95+
with:
96+
flutter-version: '3.44.1'
97+
channel: 'stable'
98+
cache: true
99+
100+
- name: Install melos
101+
run: dart pub global activate melos
102+
103+
- name: Add melos to PATH
104+
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
105+
106+
- name: Bootstrap melos
107+
run: dart pub global run melos bootstrap
108+
109+
- name: Install Linux dependencies
110+
run: |
111+
sudo apt-get update
112+
sudo apt-get install -y \
113+
clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev \
114+
keybinder-3.0 libayatana-appindicator3-dev
115+
116+
- name: Build tray_manager example Linux
117+
run: |
118+
cd packages/tray_manager/example
119+
flutter build linux --release
120+
121+
# macOS build
122+
build-macos:
123+
name: Build macOS
124+
runs-on: macos-latest
125+
needs: [lint]
126+
127+
steps:
128+
- name: Checkout repository
129+
uses: actions/checkout@v4
130+
131+
- name: Setup Flutter
132+
uses: subosito/flutter-action@v2
133+
with:
134+
flutter-version: '3.44.1'
135+
channel: 'stable'
136+
cache: true
137+
138+
- name: Install melos
139+
run: dart pub global activate melos
140+
141+
- name: Add melos to PATH
142+
run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
143+
144+
- name: Bootstrap melos
145+
run: dart pub global run melos bootstrap
146+
147+
- name: Build tray_manager example macOS
148+
run: |
149+
cd packages/tray_manager/example
150+
flutter build macos --release
151+
152+
# Windows build
153+
build-windows:
154+
name: Build Windows
155+
runs-on: windows-latest
156+
needs: [lint]
157+
158+
steps:
159+
- name: Checkout repository
160+
uses: actions/checkout@v4
161+
162+
- name: Setup Flutter
163+
uses: subosito/flutter-action@v2
164+
with:
165+
flutter-version: '3.44.1'
166+
channel: 'stable'
167+
cache: true
168+
169+
- name: Install melos
170+
run: dart pub global activate melos
171+
172+
- name: Add melos to PATH
173+
shell: bash
174+
run: echo "$USERPROFILE/.pub-cache/bin" >> $GITHUB_PATH
175+
176+
- name: Bootstrap melos
177+
run: dart pub global run melos bootstrap
178+
179+
- name: Build tray_manager example Windows
180+
run: |
181+
cd packages/tray_manager/example
182+
flutter build windows --release

.github/workflows/lint.yml

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

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to pub.dev
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+*"
7+
8+
jobs:
9+
publish:
10+
name: Publish to pub.dev
11+
permissions:
12+
id-token: write # Required for requesting the JWT
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
# Set up the Dart SDK and provision the OIDC token used for publishing.
19+
- uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260
20+
21+
# Download Flutter SDK - needed for publishing Flutter packages.
22+
- uses: flutter-actions/setup-flutter@18c66a64fb6f6d3338c63cabbc5cd6da395e7f1d
23+
24+
# Publish tray_manager
25+
- name: Install dependencies (tray_manager)
26+
run: dart pub get
27+
working-directory: packages/tray_manager
28+
29+
- name: Publish - dry run (tray_manager)
30+
run: dart pub publish --dry-run
31+
working-directory: packages/tray_manager
32+
33+
- name: Publish tray_manager
34+
run: dart pub publish -f
35+
working-directory: packages/tray_manager

.github/workflows/test.yml

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

0 commit comments

Comments
 (0)