diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index cd2148e..fe00bba 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -1,254 +1,34 @@ -# Created with package:mono_repo v6.6.3 -name: Dart CI +name: Dart + on: push: - branches: - - main + branches: [ main ] pull_request: + branches: [ main ] schedule: - cron: "0 0 * * 0" -defaults: - run: - shell: bash + env: PUB_ENVIRONMENT: bot.github permissions: read-all jobs: - job_001: - name: mono_repo self validate - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c - with: - sdk: stable - - id: checkout - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - - name: mono_repo self validate - run: dart pub global activate mono_repo 6.6.3 - - name: mono_repo self validate - run: dart pub global run mono_repo generate --validate - job_002: - name: "analyzer_and_format; Dart 3.9.0; PKGS: pkgs/analysis_defaults, pkgs/dash_design, pkgs/excerpter, pkgs/inject_dartpad; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.9.0;packages:pkgs/analysis_defaults-pkgs/dash_design-pkgs/excerpter-pkgs/inject_dartpad;commands:format-analyze" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.9.0;packages:pkgs/analysis_defaults-pkgs/dash_design-pkgs/excerpter-pkgs/inject_dartpad - os:ubuntu-latest;pub-cache-hosted;sdk:3.9.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c - with: - sdk: "3.9.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - - id: pkgs_analysis_defaults_pub_upgrade - name: pkgs/analysis_defaults; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/analysis_defaults - - name: "pkgs/analysis_defaults; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_analysis_defaults_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/analysis_defaults - - name: "pkgs/analysis_defaults; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_analysis_defaults_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/analysis_defaults - - id: pkgs_dash_design_pub_upgrade - name: pkgs/dash_design; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/dash_design - - name: "pkgs/dash_design; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_dash_design_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/dash_design - - name: "pkgs/dash_design; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_dash_design_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/dash_design - - id: pkgs_excerpter_pub_upgrade - name: pkgs/excerpter; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/excerpter - - name: "pkgs/excerpter; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_excerpter_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/excerpter - - name: "pkgs/excerpter; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_excerpter_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/excerpter - - id: pkgs_inject_dartpad_pub_upgrade - name: pkgs/inject_dartpad; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/inject_dartpad - - name: "pkgs/inject_dartpad; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_inject_dartpad_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/inject_dartpad - - name: "pkgs/inject_dartpad; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_inject_dartpad_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/inject_dartpad - job_003: - name: "analyzer_and_format; Dart dev; PKGS: pkgs/analysis_defaults, pkgs/dash_design, pkgs/excerpter, pkgs/inject_dartpad; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" + verify: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sdk: [ stable, beta ] steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/analysis_defaults-pkgs/dash_design-pkgs/excerpter-pkgs/inject_dartpad;commands:format-analyze" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/analysis_defaults-pkgs/dash_design-pkgs/excerpter-pkgs/inject_dartpad - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - - id: pkgs_analysis_defaults_pub_upgrade - name: pkgs/analysis_defaults; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/analysis_defaults - - name: "pkgs/analysis_defaults; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_analysis_defaults_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/analysis_defaults - - name: "pkgs/analysis_defaults; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_analysis_defaults_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/analysis_defaults - - id: pkgs_dash_design_pub_upgrade - name: pkgs/dash_design; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/dash_design - - name: "pkgs/dash_design; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_dash_design_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/dash_design - - name: "pkgs/dash_design; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_dash_design_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/dash_design - - id: pkgs_excerpter_pub_upgrade - name: pkgs/excerpter; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/excerpter - - name: "pkgs/excerpter; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_excerpter_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/excerpter - - name: "pkgs/excerpter; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_excerpter_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/excerpter - - id: pkgs_inject_dartpad_pub_upgrade - name: pkgs/inject_dartpad; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/inject_dartpad - - name: "pkgs/inject_dartpad; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_inject_dartpad_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/inject_dartpad - - name: "pkgs/inject_dartpad; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.pkgs_inject_dartpad_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/inject_dartpad - job_004: - name: "unit_test; Dart 3.9.0; PKG: pkgs/excerpter; `dart test`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.9.0;packages:pkgs/excerpter;commands:test" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.9.0;packages:pkgs/excerpter - os:ubuntu-latest;pub-cache-hosted;sdk:3.9.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c - with: - sdk: "3.9.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - - id: pkgs_excerpter_pub_upgrade - name: pkgs/excerpter; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/excerpter - - name: pkgs/excerpter; dart test - run: dart test - if: "always() && steps.pkgs_excerpter_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/excerpter - needs: - - job_001 - - job_002 - - job_003 - job_005: - name: "unit_test; Dart dev; PKG: pkgs/excerpter; `dart test`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/excerpter;commands:test" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/excerpter - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 - - id: pkgs_excerpter_pub_upgrade - name: pkgs/excerpter; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/excerpter - - name: pkgs/excerpter; dart test - run: dart test - if: "always() && steps.pkgs_excerpter_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/excerpter - needs: - - job_001 - - job_002 - - job_003 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 + - uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c + with: + sdk: ${{ matrix.sdk }} + - name: Install dependencies + run: dart pub get + - name: Check formatting + run: dart run melos exec "dart format --output=none --set-exit-if-changed ." + - name: Analyze Dart code + run: dart run melos exec "dart analyze --fatal-infos ." + - name: Run tests on VM + run: dart run melos exec --dir-exists=test "dart test --reporter=github --test-randomize-ordering-seed=random" diff --git a/cloud_build/firebase-ghcli/Dockerfile b/cloud_build/firebase-ghcli/Dockerfile index 69aa4e4..f7e174d 100644 --- a/cloud_build/firebase-ghcli/Dockerfile +++ b/cloud_build/firebase-ghcli/Dockerfile @@ -1,4 +1,4 @@ -FROM dart:3.10.0-290.2.beta +FROM dart:3.10.0-290.4.beta # Install prerequisite dependencies. RUN apt-get update && apt-get install -y curl gpg diff --git a/mono_repo.yaml b/mono_repo.yaml deleted file mode 100644 index 190d853..0000000 --- a/mono_repo.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Reference https://pub.dev/packages/mono_repo for help with this file. -self_validate: analyzer_and_format - -github: - on: - push: - branches: - - main - pull_request: - schedule: - - cron: "0 0 * * 0" - -merge_stages: - - analyzer_and_format - - unit_test diff --git a/pkgs/analysis_defaults/mono_pkg.yaml b/pkgs/analysis_defaults/mono_pkg.yaml deleted file mode 100644 index 424d75f..0000000 --- a/pkgs/analysis_defaults/mono_pkg.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# Reference https://pub.dev/packages/mono_repo for help with this file. -sdk: - - pubspec - - dev - -stages: - - analyzer_and_format: - - group: - - format - - analyze: --fatal-infos . diff --git a/pkgs/analysis_defaults/pubspec.yaml b/pkgs/analysis_defaults/pubspec.yaml index 640a4a5..639fc4b 100644 --- a/pkgs/analysis_defaults/pubspec.yaml +++ b/pkgs/analysis_defaults/pubspec.yaml @@ -2,6 +2,7 @@ name: analysis_defaults description: Analysis defaults for Dart/Flutter site tools. publish_to: none +resolution: workspace environment: sdk: ^3.9.0 diff --git a/pkgs/dash_design/mono_pkg.yaml b/pkgs/dash_design/mono_pkg.yaml deleted file mode 100644 index 66984e0..0000000 --- a/pkgs/dash_design/mono_pkg.yaml +++ /dev/null @@ -1,9 +0,0 @@ -sdk: -- pubspec -- dev - -stages: -- analyzer_and_format: - - group: - - format - - analyze: --fatal-infos . diff --git a/pkgs/dash_design/pubspec.yaml b/pkgs/dash_design/pubspec.yaml index 1143a68..0e0a23b 100644 --- a/pkgs/dash_design/pubspec.yaml +++ b/pkgs/dash_design/pubspec.yaml @@ -4,6 +4,7 @@ version: 0.0.1-wip publish_to: none repository: https://github.com/dart-lang/site-shared/tree/main/pkgs/dash_design +resolution: workspace environment: sdk: ^3.9.0 diff --git a/pkgs/dash_design/test/style_test.dart b/pkgs/dash_design/test/style_test.dart index f5bd2e5..c4707fc 100644 --- a/pkgs/dash_design/test/style_test.dart +++ b/pkgs/dash_design/test/style_test.dart @@ -12,9 +12,11 @@ void main() { test('Can build styles.scss file', () { final compileResult = sass.compileToResult( _stylesPath!, - fatalDeprecations: sass.Deprecation.values.where((d) => !d.isFuture), + fatalDeprecations: sass.Deprecation.values.where( + (d) => !d.isFuture && d.obsoleteIn == null, + ), ); - expect(compileResult.css, contains('--dash-default-font-family')); + expect(compileResult.css, contains('--dash-default-fontFamily')); }); } diff --git a/pkgs/excerpter/mono_pkg.yaml b/pkgs/excerpter/mono_pkg.yaml deleted file mode 100644 index 89187bb..0000000 --- a/pkgs/excerpter/mono_pkg.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# Reference https://pub.dev/packages/mono_repo for help with this file. -sdk: -- pubspec -- dev - -stages: -- analyzer_and_format: - - group: - - format - - analyze: --fatal-infos . -- unit_test: - - test: diff --git a/pkgs/excerpter/pubspec.yaml b/pkgs/excerpter/pubspec.yaml index 50b6022..530cd80 100644 --- a/pkgs/excerpter/pubspec.yaml +++ b/pkgs/excerpter/pubspec.yaml @@ -4,6 +4,7 @@ version: 0.1.0 publish_to: none repository: https://github.com/dart-lang/site-shared/tree/main/pkgs/excerpter +resolution: workspace environment: sdk: ^3.9.0 diff --git a/pkgs/inject_dartpad/mono_pkg.yaml b/pkgs/inject_dartpad/mono_pkg.yaml deleted file mode 100644 index ccb958a..0000000 --- a/pkgs/inject_dartpad/mono_pkg.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# Reference https://pub.dev/packages/mono_repo for help with this file. -sdk: - - pubspec - - dev - -stages: - - analyzer_and_format: - - group: - - format - - analyze: --fatal-infos . diff --git a/pkgs/inject_dartpad/pubspec.yaml b/pkgs/inject_dartpad/pubspec.yaml index c845127..34f14be 100644 --- a/pkgs/inject_dartpad/pubspec.yaml +++ b/pkgs/inject_dartpad/pubspec.yaml @@ -1,6 +1,7 @@ name: inject_dartpad publish_to: none +resolution: workspace environment: sdk: ^3.9.0 diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..1485453 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,17 @@ +name: site_shared +publish_to: none +repository: https://github.com/dart-lang/site-shared +description: >- + Workspace for packages used by the Dart and Flutter documentation sites. + +environment: + sdk: ^3.9.0 + +workspace: + - pkgs/analysis_defaults + - pkgs/dash_design + - pkgs/excerpter + - pkgs/inject_dartpad + +dev_dependencies: + melos: ^7.3.0 diff --git a/tool/ci.sh b/tool/ci.sh deleted file mode 100755 index f6fe5e4..0000000 --- a/tool/ci.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash -# Created with package:mono_repo v6.6.3 - -# Support built in commands on windows out of the box. - -# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") -# then "flutter pub" is called instead of "dart pub". -# This assumes that the Flutter SDK has been installed in a previous step. -function pub() { - if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then - command flutter pub "$@" - else - command dart pub "$@" - fi -} - -function format() { - command dart format "$@" -} - -# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") -# then "flutter analyze" is called instead of "dart analyze". -# This assumes that the Flutter SDK has been installed in a previous step. -function analyze() { - if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then - command flutter analyze "$@" - else - command dart analyze "$@" - fi -} - -if [[ -z ${PKGS} ]]; then - echo -e '\033[31mPKGS environment variable must be set! - TERMINATING JOB\033[0m' - exit 64 -fi - -if [[ "$#" == "0" ]]; then - echo -e '\033[31mAt least one task argument must be provided! - TERMINATING JOB\033[0m' - exit 64 -fi - -SUCCESS_COUNT=0 -declare -a FAILURES - -for PKG in ${PKGS}; do - echo -e "\033[1mPKG: ${PKG}\033[22m" - EXIT_CODE=0 - pushd "${PKG}" >/dev/null || EXIT_CODE=$? - - if [[ ${EXIT_CODE} -ne 0 ]]; then - echo -e "\033[31mPKG: '${PKG}' does not exist - TERMINATING JOB\033[0m" - exit 64 - fi - - dart pub upgrade || EXIT_CODE=$? - - if [[ ${EXIT_CODE} -ne 0 ]]; then - echo -e "\033[31mPKG: ${PKG}; 'dart pub upgrade' - FAILED (${EXIT_CODE})\033[0m" - FAILURES+=("${PKG}; 'dart pub upgrade'") - else - for TASK in "$@"; do - EXIT_CODE=0 - echo - echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m" - case ${TASK} in - analyze) - echo 'dart analyze --fatal-infos .' - dart analyze --fatal-infos . || EXIT_CODE=$? - ;; - format) - echo 'dart format --output=none --set-exit-if-changed .' - dart format --output=none --set-exit-if-changed . || EXIT_CODE=$? - ;; - test) - echo 'dart test' - dart test || EXIT_CODE=$? - ;; - *) - echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m" - exit 64 - ;; - esac - - if [[ ${EXIT_CODE} -ne 0 ]]; then - echo -e "\033[31mPKG: ${PKG}; TASK: ${TASK} - FAILED (${EXIT_CODE})\033[0m" - FAILURES+=("${PKG}; TASK: ${TASK}") - else - echo -e "\033[32mPKG: ${PKG}; TASK: ${TASK} - SUCCEEDED\033[0m" - SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) - fi - - done - fi - - echo - echo -e "\033[32mSUCCESS COUNT: ${SUCCESS_COUNT}\033[0m" - - if [ ${#FAILURES[@]} -ne 0 ]; then - echo -e "\033[31mFAILURES: ${#FAILURES[@]}\033[0m" - for i in "${FAILURES[@]}"; do - echo -e "\033[31m $i\033[0m" - done - fi - - popd >/dev/null || exit 70 - echo -done - -if [ ${#FAILURES[@]} -ne 0 ]; then - exit 1 -fi