-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/ruby-3-3-0
- Loading branch information
Showing
43 changed files
with
2,134 additions
and
193 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This GitHub workflow has been disabled and is no longer used. | ||
# Website deploys are now done through Cloud Build. | ||
# See https://github.com/dart-lang/site-www/pull/5447 | ||
name: deploy | ||
|
||
on: | ||
# Run on pushes to the default branch. | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
# Declare default permissions as read only. | ||
permissions: read-all | ||
|
||
env: | ||
# Keep for Dart SDK reporting | ||
PUB_ENVIRONMENT: bot.github | ||
# LTS | ||
NODE_VERSION: '20' | ||
# Tool location | ||
BASE_DIR: ${{ github.workspace }} | ||
TOOL_DIR: ${{ github.workspace }}/tool | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy production site to Firebase hosting | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
if: ${{ github.event_name == 'push' && | ||
github.ref == 'refs/heads/main' && | ||
github.repository == 'dart-lang/site-www' }} | ||
runs-on: ubuntu-latest | ||
env: | ||
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | ||
FIREBASE_PROJECT: default | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
with: | ||
submodules: recursive | ||
- run: make build | ||
- run: make write-prod-robots | ||
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- run: npm install -g [email protected] | ||
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d | ||
with: | ||
sdk: stable | ||
- uses: FirebaseExtended/action-hosting-deploy@120e124148ab7016bec2374e5050f15051255ba2 | ||
with: # TODO(khanhnwin/drewroen): Migrate deploy to Cloud Build | ||
repoToken: '${{ secrets.GITHUB_TOKEN }}' | ||
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DART_DEV }}' | ||
projectId: dart-dev | ||
channelId: live |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: test | ||
|
||
on: | ||
# Run on PRs and pushes to the default branch. | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
# Declare default permissions as read only. | ||
permissions: read-all | ||
|
||
env: | ||
# Keep for Dart SDK reporting | ||
PUB_ENVIRONMENT: bot.github | ||
# LTS | ||
NODE_VERSION: '20' | ||
# Tool location | ||
BASE_DIR: ${{ github.workspace }} | ||
TOOL_DIR: ${{ github.workspace }}/tool | ||
|
||
jobs: | ||
test: | ||
name: Check excerpts and run tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- sdk: beta | ||
experimental: false | ||
- sdk: stable | ||
experimental: false | ||
continue-on-error: ${{ matrix.experimental }} | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
with: | ||
submodules: recursive | ||
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d | ||
with: | ||
sdk: ${{ matrix.sdk }} | ||
- run: dart pub get | ||
- run: tool/test.sh | ||
env: | ||
DART_CHANNEL: ${{ matrix.sdk }} | ||
|
||
linkcheck: | ||
name: Build site and check links | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
with: | ||
submodules: recursive | ||
- run: make build | ||
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- run: npm install -g [email protected] | ||
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d | ||
with: | ||
sdk: stable | ||
- run: tool/check-links.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
steps: | ||
- name: gcr.io/cloud-builders/git | ||
args: ['submodule', 'update', '--init', '--recursive'] | ||
- name: gcr.io/cloud-builders/docker | ||
entrypoint: '/bin/bash' | ||
args: | ||
- '-c' | ||
- |- | ||
set -e | ||
echo "Building the website using a makefile..." | ||
make build | ||
make write-prod-robots | ||
- name: gcr.io/flutter-dev-230821/firebase-ghcli | ||
entrypoint: '/bin/bash' | ||
args: | ||
- '-c' | ||
- |- | ||
firebase deploy --project=dart-dev --only=hosting | ||
options: | ||
logging: CLOUD_LOGGING_ONLY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
examples/concurrency/lib/basic_ports_example/complete.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import 'dart:async'; | ||
import 'dart:convert'; | ||
import 'dart:isolate'; | ||
|
||
void main() async { | ||
final worker = Worker(); | ||
await worker.spawn(); | ||
await worker.parseJson('{"key":"value"}'); | ||
} | ||
|
||
// #docregion handleResponses parseJson | ||
class Worker { | ||
late SendPort _sendPort; | ||
final Completer<void> _isolateReady = Completer.sync(); | ||
// #enddocregion handleResponses parseJson | ||
|
||
// #docregion spawn | ||
Future<void> spawn() async { | ||
final receivePort = ReceivePort(); | ||
receivePort.listen(_handleResponsesFromIsolate); | ||
await Isolate.spawn(_startRemoteIsolate, receivePort.sendPort); | ||
} | ||
// #enddocregion spawn | ||
|
||
// #docregion handleResponses | ||
void _handleResponsesFromIsolate(dynamic message) { | ||
if (message is SendPort) { | ||
_sendPort = message; | ||
_isolateReady.complete(); | ||
} else if (message is Map<String, dynamic>) { | ||
print(message); | ||
} | ||
} | ||
// #enddocregion handleResponses | ||
|
||
// #docregion startRemoteIsolate | ||
static void _startRemoteIsolate(SendPort port) { | ||
final receivePort = ReceivePort(); | ||
port.send(receivePort.sendPort); | ||
|
||
receivePort.listen((dynamic message) async { | ||
if (message is String) { | ||
final transformed = jsonDecode(message); | ||
port.send(transformed); | ||
} | ||
}); | ||
} | ||
// #enddocregion startRemoteIsolate | ||
|
||
// #docregion parseJson | ||
Future<void> parseJson(String message) async { | ||
await _isolateReady.future; | ||
_sendPort.send(message); | ||
} | ||
// #enddocregion parseJson | ||
} |
44 changes: 44 additions & 0 deletions
44
examples/concurrency/lib/basic_ports_example/handle_response_from_isolate.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// ignore_for_file: unused_field | ||
|
||
import 'dart:async'; | ||
import 'dart:convert'; | ||
import 'dart:isolate'; | ||
|
||
// #docregion | ||
class Worker { | ||
late SendPort _sendPort; | ||
|
||
// spawn method | ||
|
||
void _handleResponsesFromIsolate(dynamic message) { | ||
if (message is SendPort) { | ||
_sendPort = message; | ||
} else if (message is Map<String, dynamic>) { | ||
print(message); | ||
} | ||
} | ||
|
||
// rest of class.. | ||
// #enddocregion | ||
|
||
Future<void> spawn() async { | ||
final receivePort = ReceivePort(); | ||
receivePort.listen(_handleResponsesFromIsolate); | ||
await Isolate.spawn(_startRemoteIsolate, receivePort.sendPort); | ||
} | ||
|
||
static void _startRemoteIsolate(SendPort port) { | ||
final receivePort = ReceivePort(); | ||
port.send(receivePort.sendPort); | ||
|
||
receivePort.listen((dynamic message) async { | ||
final decoded = jsonDecode(message as String); | ||
port.send(decoded); | ||
}); | ||
} | ||
|
||
Future<void> parseJson(String message) async { | ||
// TODO: Define a public method that can | ||
// be used to send messages to the worker isolate. | ||
} | ||
} |
Oops, something went wrong.