Skip to content

Commit 149b6dc

Browse files
committed
move checkout,fetch test to build-test
1 parent 9ba2f2f commit 149b6dc

File tree

7 files changed

+59
-248
lines changed

7 files changed

+59
-248
lines changed

.github/workflows/build-test.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,10 @@ jobs:
323323

324324
# ci-job-test-dart
325325
test-dart:
326-
runs-on: ubuntu-latest
326+
strategy:
327+
matrix:
328+
os: [ ubuntu-latest, macos-latest, windows-latest ]
329+
runs-on: ${{ matrix.os }}
327330

328331
steps:
329332
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -349,6 +352,16 @@ jobs:
349352
# Actual job
350353
- name: Run `cargo make ci-job-test-dart`
351354
run: cargo make ci-job-test-dart
355+
356+
- name: Run `cargo make ci-job-test-dart` in fetch mode
357+
# Only run if not PR, or if PR and skip_fetch is false
358+
# TODO: Uncomment this after releasing artifacts.
359+
# if: github.event_name != 'pull_request' || needs.check_skip_fetch.outputs.skip_fetch == 'false'
360+
if: false
361+
run: |
362+
yq -i ".hooks.user_defines.icu4x.buildMode = \"fetch\"" ffi/dart/pubspec.yaml
363+
yq -i ".hooks.user_defines.icu4x.buildMode = \"fetch\"" examples/dart/pubspec.yaml
364+
cargo make ci-job-test-dart
352365
353366

354367
# ci-job-nostd

.github/workflows/dart.yml

Lines changed: 0 additions & 226 deletions
Original file line numberDiff line numberDiff line change
@@ -51,226 +51,6 @@ jobs:
5151
REPO_NAME: ${{ github.event.repository.name }}
5252
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
5353

54-
build_checkout:
55-
runs-on: ${{ matrix.os }}
56-
57-
defaults:
58-
run:
59-
working-directory: ffi/dart
60-
strategy:
61-
matrix:
62-
os: [ubuntu-latest, macos-latest, windows-latest]
63-
steps:
64-
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
65-
with:
66-
submodules: true
67-
68-
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
69-
with:
70-
sdk: main
71-
72-
- name: Install Rust toolchains
73-
run: |
74-
rustup toolchain install stable
75-
rustup toolchain install nightly
76-
77-
- name: Show the selected Rust toolchain
78-
run: rustup show
79-
80-
- name: Set up toolchain for Linux
81-
if: matrix.os == 'ubuntu-latest'
82-
run: |
83-
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
84-
85-
- name: Set up toolchain for Mac
86-
if: matrix.os == 'macos-latest'
87-
run: |
88-
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
89-
90-
- name: Set up toolchain for Windows
91-
if: matrix.os == 'windows-latest'
92-
run: |
93-
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc
94-
95-
- run: dart pub get
96-
97-
- run: |
98-
yq -i ".hooks.user_defines.icu4x.buildMode = \"checkout\"" pubspec.yaml
99-
yq -i ".hooks.user_defines.icu4x.checkoutPath = \"file://$(realpath ${{ github.workspace }})/\"" pubspec.yaml
100-
cat pubspec.yaml
101-
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
102-
103-
- run: |
104-
choco install yq
105-
yq -i ".hooks.user_defines.icu4x.buildMode = \"checkout\"" pubspec.yaml
106-
yq -i ".hooks.user_defines.icu4x.checkoutPath = \"file://$((Get-Item ${{ github.workspace }}).FullName -replace '/', '\')\"" pubspec.yaml
107-
if: matrix.os == 'windows-latest'
108-
109-
- run: dart analyze --fatal-infos
110-
111-
- run: dart format --output=none --set-exit-if-changed .
112-
113-
- run: dart test
114-
115-
- run: dart pub get
116-
working-directory: examples/dart
117-
118-
- run: |
119-
yq -i ".hooks.user_defines.icu4x.buildMode = \"checkout\"" ../../examples/dart/pubspec.yaml
120-
yq -i ".hooks.user_defines.icu4x.checkoutPath = \"$(realpath ${{ github.workspace }})/\"" ../../examples/dart/pubspec.yaml
121-
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
122-
123-
- run: |
124-
yq -i ".hooks.user_defines.icu4x.buildMode = \"checkout\"" pubspec.yaml
125-
yq -i ".hooks.user_defines.icu4x.checkoutPath = \"$((Get-Item ${{ github.workspace }}).FullName -replace '/', '\')/\"" ../../examples/dart/pubspec.yaml
126-
127-
- run: dart --enable-experiment=record-use build cli bin/example.dart
128-
working-directory: examples/dart
129-
130-
- run: tree . -a
131-
if: matrix.os == 'ubuntu-latest'
132-
133-
- name: Run example (Linux)
134-
working-directory: examples/dart
135-
if: matrix.os == 'ubuntu-latest'
136-
run: ./build/cli/linux_x64/bundle/bin/example
137-
138-
- name: Print file size and check limit for example (Linux)
139-
working-directory: examples/dart
140-
if: matrix.os == 'ubuntu-latest'
141-
run: |
142-
FILE_PATH="build/cli/linux_x64/bundle/lib/libicu4x.so"
143-
FILE_SIZE=$(stat -c %s "$FILE_PATH")
144-
echo "Linux executable size: $FILE_SIZE bytes"
145-
if [ "$FILE_SIZE" -gt 10485760 ]; then
146-
echo "Error: Linux executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)."
147-
exit 1
148-
fi
149-
150-
- name: Run example (Mac)
151-
working-directory: examples/dart
152-
if: matrix.os == 'macos-latest'
153-
run: ./build/cli/macos_arm64/bundle/bin/example
154-
- name: Print file size and check limit for example (Mac)
155-
working-directory: examples/dart
156-
# skip until https://github.com/dart-lang/i18n/issues/989 issue is resolved
157-
if: matrix.os == 'macos-latest' && false
158-
run: |
159-
FILE_PATH="build/cli/macos_arm64/bundle/lib/libicu4x.dylib"
160-
FILE_SIZE=$(stat -f %z "$FILE_PATH")
161-
echo "macOS executable size: $FILE_SIZE bytes"
162-
if [ "$FILE_SIZE" -gt 10485760 ]; then
163-
echo "Error: macOS executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)."
164-
exit 1
165-
fi
166-
167-
- name: Run example (Windows)
168-
working-directory: examples/dart
169-
if: matrix.os == 'windows-latest'
170-
run: .\build\cli\windows_x64\bundle\bin\example.exe
171-
- name: Print file size and check limit for example (Windows)
172-
working-directory: examples/dart
173-
if: matrix.os == 'windows-latest'
174-
run: |
175-
$filePath = ".\build\cli\windows_x64\bundle\lib\icu4x.dll"
176-
$fileSize = (Get-Item $filePath).Length
177-
Write-Host "Windows executable size: $fileSize bytes"
178-
if ($fileSize -gt 10485760) {
179-
Write-Host "Error: Windows executable size ($fileSize bytes) exceeds 10MB limit (10485760 bytes)."
180-
exit 1
181-
}
182-
183-
build_fetch:
184-
runs-on: ${{ matrix.os }}
185-
needs: [check_skip_fetch]
186-
# Only run if not PR, or if PR and skip_fetch is false
187-
# TODO: Uncomment this after releasing artifacts.
188-
# if: github.event_name != 'pull_request' || needs.check_skip_fetch.outputs.skip_fetch == 'false'
189-
if: false
190-
191-
strategy:
192-
matrix:
193-
os: [ubuntu-latest, macos-latest, windows-latest]
194-
195-
defaults:
196-
run:
197-
working-directory: ffi/dart
198-
199-
steps:
200-
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
201-
with:
202-
submodules: true
203-
204-
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
205-
with:
206-
sdk: main
207-
208-
- run: dart pub get
209-
210-
- run: |
211-
yq -i ".hooks.user_defines.icu4x.buildMode = \"fetch\"" pubspec.yaml
212-
yq -i ".hooks.user_defines.icu4x.buildMode = \"fetch\"" ../../examples/dart/pubspec.yaml
213-
214-
- run: dart test
215-
216-
- run: dart pub get
217-
working-directory: examples/dart
218-
219-
- run: dart --enable-experiment=record-use build cli bin/example.dart
220-
working-directory: examples/dart
221-
222-
- name: Run example (Linux)
223-
working-directory: examples/dart
224-
if: matrix.os == 'ubuntu-latest'
225-
run: ./build/cli/linux_x64/bundle/bin/example
226-
227-
- name: Print file size and check limit for example (Linux)
228-
working-directory: examples/dart
229-
if: matrix.os == 'ubuntu-latest'
230-
run: |
231-
FILE_PATH="build/cli/linux_x64/bundle/lib/libicu4x.so"
232-
FILE_SIZE=$(stat -c %s "$FILE_PATH")
233-
echo "Linux executable size: $FILE_SIZE bytes"
234-
if [ "$FILE_SIZE" -gt 10485760 ]; then
235-
echo "Error: Linux executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)."
236-
exit 1
237-
fi
238-
239-
- name: Run example (Mac)
240-
working-directory: examples/dart
241-
if: matrix.os == 'macos-latest'
242-
run: ./build/cli/macos_arm64/bundle/bin/example
243-
244-
- name: Print file size and check limit for example (Mac)
245-
working-directory: examples/dart
246-
# skip until https://github.com/dart-lang/i18n/issues/989 issue is resolved
247-
if: matrix.os == 'macos-latest' && false
248-
run: |
249-
FILE_PATH="build/cli/macos_arm64/bundle/lib/example"
250-
FILE_SIZE=$(stat -f %z "$FILE_PATH")
251-
echo "macOS executable size: $FILE_SIZE bytes"
252-
if [ "$FILE_SIZE" -gt 10485760 ]; then
253-
echo "Error: macOS executable size ($FILE_SIZE bytes) exceeds 10MB limit (10485760 bytes)."
254-
exit 1
255-
fi
256-
257-
- name: Run example (Windows)
258-
working-directory: examples/dart
259-
if: matrix.os == 'windows-latest'
260-
run: .\build\cli\windows_x64\bundle\bin\example.exe
261-
262-
- name: Print file size and check limit for example (Windows)
263-
working-directory: examples/dart
264-
if: matrix.os == 'windows-latest'
265-
run: |
266-
$filePath = ".\build\cli\windows_x64\bundle\lib\icu4x.dll"
267-
$fileSize = (Get-Item $filePath).Length
268-
Write-Host "Windows executable size: $fileSize bytes"
269-
if ($fileSize -gt 10485760) {
270-
Write-Host "Error: Windows executable size ($fileSize bytes) exceeds 10MB limit (10485760 bytes)."
271-
exit 1
272-
}
273-
27454
build_local:
27555
strategy:
27656
fail-fast: false
@@ -302,22 +82,16 @@ jobs:
30282
- name: Build Linux
30383
if: matrix.os == 'ubuntu-latest'
30484
run: |
305-
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
306-
30785
dart ffi/dart/lib/src/hook_helpers/build_libs.dart --working_directory . --file bin/linux_x64 --os linux --architecture x64 --compile_type dynamic --cargo_features collator,datetime,list,decimal,plurals,casemap,experimental,default,compiled_data
30886
30987
- name: Build Mac
31088
if: matrix.os == 'macos-latest'
31189
run: |
312-
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
313-
31490
dart ffi/dart/lib/src/hook_helpers/build_libs.dart --working_directory . --file bin/macos_arm64 --os macos --architecture arm64 --compile_type dynamic --cargo_features collator,datetime,list,decimal,plurals,casemap,experimental,default,compiled_data
31591
31692
- name: Build Windows
31793
if: matrix.os == 'windows-latest'
31894
run: |
319-
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc
320-
32195
dart ffi/dart/lib/src/hook_helpers/build_libs.dart --working_directory . --file bin/windows_x64 --os windows --architecture x64 --compile_type dynamic --cargo_features collator,datetime,list,decimal,plurals,casemap,experimental,default,compiled_data
32296
32397
- name: Run `dart pub get`

.github/workflows/icu4x_artifacts.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ jobs:
7272
- name: Build Linux
7373
if: matrix.os == 'ubuntu-latest'
7474
run: |
75-
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
7675
(cd ffi/dart && dart pub get)
7776
7877
dart ffi/dart/lib/src/hook_helpers/build_libs.dart --working_directory . --file bin/android_arm_${{ matrix.compiletype }}${{ env.FILENAME_SUFFIX }} --os android --architecture arm --compile_type ${{ matrix.compiletype }} --cargo_features ${{ env.FEATURES }}
@@ -105,8 +104,6 @@ jobs:
105104
- name: Build Mac
106105
if: matrix.os == 'macos-latest'
107106
run: |
108-
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
109-
110107
(cd ffi/dart && dart pub get)
111108
112109
dart ffi/dart/lib/src/hook_helpers/build_libs.dart --working_directory . --file bin/ios_arm64_${{ matrix.compiletype }}${{ env.FILENAME_SUFFIX }} --os ios --architecture arm64 --compile_type ${{ matrix.compiletype }} --cargo_features ${{ env.FEATURES }}
@@ -130,8 +127,6 @@ jobs:
130127
- name: Build Windows
131128
if: matrix.os == 'windows-latest'
132129
run: |
133-
rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc
134-
135130
pushd ffi/dart
136131
dart pub get
137132
popd

examples/dart/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# https://dart.dev/guides/libraries/private-files
22
# Created by `dart pub`
33
.dart_tool/
4+
bin/example/

examples/dart/pubspec.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ packages:
2121
dependency: transitive
2222
description:
2323
name: code_assets
24-
sha256: dd7ed641b7f642092092969f2dcd5845ab31c9f3efead0c06ca437bf9ce8a8b2
24+
sha256: "7f42899e7b22f7810ea8c2b281c979add25555fbe391dde539621069e20b90b4"
2525
url: "https://pub.dev"
2626
source: hosted
27-
version: "0.19.4"
27+
version: "0.19.5"
2828
collection:
2929
dependency: transitive
3030
description:
@@ -69,17 +69,17 @@ packages:
6969
dependency: transitive
7070
description:
7171
name: hooks
72-
sha256: "75363eae6c0c2db051c4f6b3b1fcdea8a09c4a596cc83bfff847661da6e80dfc"
72+
sha256: "2bd640e4625fdfe5788ef33d825a8639797d44bce05695ab13543cde0ff9a078"
7373
url: "https://pub.dev"
7474
source: hosted
75-
version: "0.19.5"
75+
version: "0.20.0"
7676
icu4x:
7777
dependency: "direct main"
7878
description:
7979
path: "../../ffi/dart"
8080
relative: true
8181
source: path
82-
version: "0.1.0-dev"
82+
version: "2.0.0-dev.0"
8383
logging:
8484
dependency: transitive
8585
description:
@@ -100,10 +100,10 @@ packages:
100100
dependency: transitive
101101
description:
102102
name: native_toolchain_c
103-
sha256: "74a0c80d877c519bc6bde2c4e27b6b01c1f93c9b480f65ceae8bedd3aba3c086"
103+
sha256: "7e8358a4f6ec69a4f2d366bb971af298aca50d6c2e8a07be7c12d7f6d40460aa"
104104
url: "https://pub.dev"
105105
source: hosted
106-
version: "0.16.8"
106+
version: "0.17.1"
107107
path:
108108
dependency: transitive
109109
description:

ffi/dart/lib/src/hook_helpers/build_libs.dart

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,25 @@ Future<File> buildLib(
7979

8080
final isNoStd = _isNoStdTarget((targetOS, targetArchitecture));
8181
final target = _asRustTarget(targetOS, targetArchitecture, isSimulator);
82-
if (!isNoStd) {
83-
final rustArguments = ['target', 'add', target];
84-
await runProcess(
85-
'rustup',
86-
rustArguments,
87-
workingDirectory: workingDirectory,
88-
);
82+
83+
if (buildStatic || isNoStd) {
84+
await runProcess('rustup', [
85+
'toolchain',
86+
'install',
87+
'--no-self-update',
88+
'nightly',
89+
'--component',
90+
'rust-src',
91+
], workingDirectory: workingDirectory);
8992
}
9093

94+
await runProcess('rustup', [
95+
'target',
96+
'add',
97+
target,
98+
if (buildStatic || isNoStd) ...['--toolchain', 'nightly'],
99+
], workingDirectory: workingDirectory);
100+
91101
final additionalFeatures = isNoStd
92102
? ['libc_alloc', 'looping_panic_handler']
93103
: ['simple_logger'];

0 commit comments

Comments
 (0)