From 1716c0a4a648277405b34771ceeae19dd06e9ecc Mon Sep 17 00:00:00 2001 From: "unicoderbot[bot]" <269805761+unicoderbot[bot]@users.noreply.github.com> Date: Mon, 28 Sep 2026 11:58:45 +0000 Subject: [PATCH] feat: add jaspr site reusable workflow Closes #517 Co-authored-by: marcossevilla --- .github/cspell.json | 1 + .github/dependabot.yaml | 13 + .github/workflows/ci.yml | 10 + .github/workflows/jaspr_site.yml | 100 ++++ README.md | 3 + examples/jaspr_site/.gitignore | 30 + examples/jaspr_site/README.md | 12 + examples/jaspr_site/analysis_options.yaml | 1 + examples/jaspr_site/lib/app.dart | 36 ++ examples/jaspr_site/lib/main.client.dart | 16 + .../jaspr_site/lib/main.client.options.dart | 29 + examples/jaspr_site/lib/main.server.dart | 31 + .../jaspr_site/lib/main.server.options.dart | 30 + examples/jaspr_site/pubspec.lock | 541 ++++++++++++++++++ examples/jaspr_site/pubspec.yaml | 19 + examples/jaspr_site/web/favicon.ico | Bin 0 -> 1558 bytes examples/jaspr_site/web/images/logo.svg | 16 + site/docs/overview.md | 3 + site/docs/workflows/jaspr_site.md | 113 ++++ test/workflows.test.js | 2 + 20 files changed, 1006 insertions(+) create mode 100644 .github/workflows/jaspr_site.yml create mode 100644 examples/jaspr_site/.gitignore create mode 100644 examples/jaspr_site/README.md create mode 100644 examples/jaspr_site/analysis_options.yaml create mode 100644 examples/jaspr_site/lib/app.dart create mode 100644 examples/jaspr_site/lib/main.client.dart create mode 100644 examples/jaspr_site/lib/main.client.options.dart create mode 100644 examples/jaspr_site/lib/main.server.dart create mode 100644 examples/jaspr_site/lib/main.server.options.dart create mode 100644 examples/jaspr_site/pubspec.lock create mode 100644 examples/jaspr_site/pubspec.yaml create mode 100644 examples/jaspr_site/web/favicon.ico create mode 100644 examples/jaspr_site/web/images/logo.svg create mode 100644 site/docs/workflows/jaspr_site.md diff --git a/.github/cspell.json b/.github/cspell.json index b011c3d7..9ce88d20 100644 --- a/.github/cspell.json +++ b/.github/cspell.json @@ -26,6 +26,7 @@ "Contador", "endtemplate", "Infima", + "jaspr", "linecap", "localizable", "mostrado", diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index a348b3a9..304f59a3 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -39,6 +39,19 @@ updates: - "minor" - "patch" + # Jaspr example site used to exercise the reusable workflows. + - package-ecosystem: "pub" + directory: "/examples/jaspr_site" + schedule: + interval: "weekly" + commit-message: + prefix: "chore" + groups: + jaspr-site: + update-types: + - "minor" + - "patch" + # Documentation site (Docusaurus). - package-ecosystem: "npm" directory: "/site" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 928af832..56d9484c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,14 @@ jobs: run_bloc_lint: false working_directory: examples/flutter_package + verify-jaspr: + uses: ./.github/workflows/jaspr_site.yml + with: + dart_sdk: "3.13.2" + jaspr_cli_version: "0.23.5" + setup: dart --version + working_directory: examples/jaspr_site + verify-pana-dart: uses: ./.github/workflows/pana.yml with: @@ -114,6 +122,7 @@ jobs: dart_package deps flutter_package + jaspr_site pana semantic_pull_request skills_lint @@ -190,6 +199,7 @@ jobs: verify-flutter-version-file, verify-flutter-version-file-windows, verify-artifacts, + verify-jaspr, verify-pana-dart, verify-pana-flutter, verify-skills-lint, diff --git a/.github/workflows/jaspr_site.yml b/.github/workflows/jaspr_site.yml new file mode 100644 index 00000000..9090f5c1 --- /dev/null +++ b/.github/workflows/jaspr_site.yml @@ -0,0 +1,100 @@ +name: Jaspr Site Workflow + +on: + workflow_call: + inputs: + analyze_directories: + required: false + type: string + default: "." + build: + required: false + type: boolean + default: true + description: "Whether to build the site with the Jaspr CLI." + build_args: + required: false + type: string + default: "" + description: "Extra arguments passed to `jaspr build` (e.g. '--no-ssr --sitemap-domain https://example.com')." + dart_sdk: + required: false + type: string + default: "stable" + format_directories: + required: false + type: string + default: "." + format_line_length: + required: false + type: string + jaspr_cli_version: + required: false + type: string + default: "" + description: "The version of jaspr_cli to activate (e.g. '0.23.5'). Empty installs the latest version." + runs_on: + required: false + type: string + default: "ubuntu-latest" + timeout_minutes: + required: false + type: number + default: 360 + description: "Maximum minutes before GitHub cancels the job." + setup: + required: false + type: string + default: "" + working_directory: + required: false + type: string + default: "." + secrets: + ssh_key: + required: false + +jobs: + build: + defaults: + run: + working-directory: ${{inputs.working_directory}} + + runs-on: ${{inputs.runs_on}} + timeout-minutes: ${{inputs.timeout_minutes}} + + steps: + - name: 📚 Git Checkout + uses: actions/checkout@v7 + + - name: 🎯 Setup Dart + uses: dart-lang/setup-dart@v1.8.1 + with: + sdk: ${{inputs.dart_sdk}} + + - name: 🤫 Set SSH Key + env: + ssh_key: ${{secrets.ssh_key}} + if: env.ssh_key != null + uses: webfactory/ssh-agent@v0.10.0 + with: + ssh-private-key: ${{secrets.ssh_key}} + + - name: 📦 Install Dependencies + run: dart pub get + + - name: ⚙️ Run Setup + if: "${{inputs.setup != ''}}" + run: ${{inputs.setup}} + + - name: ✨ Check Formatting + run: dart format ${{inputs.format_line_length && format('--line-length {0}', inputs.format_line_length) || ''}} --set-exit-if-changed ${{inputs.format_directories}} + + - name: 🕵️ Analyze + run: dart analyze --fatal-infos --fatal-warnings ${{inputs.analyze_directories}} + + - name: 🏗️ Build + if: ${{inputs.build}} + run: | + dart pub global activate jaspr_cli ${{inputs.jaspr_cli_version}} + jaspr build ${{inputs.build_args}} diff --git a/README.md b/README.md index aa24deb5..c9bab265 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@ # A reusable workflow for Flutter packages uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1 +# A reusable workflow for Jaspr sites +uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/jaspr_site.yml@v1 + # A reusable workflow for ensuring commits are semantic uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1 diff --git a/examples/jaspr_site/.gitignore b/examples/jaspr_site/.gitignore new file mode 100644 index 00000000..b7ea95fd --- /dev/null +++ b/examples/jaspr_site/.gitignore @@ -0,0 +1,30 @@ +# Files and directories created by pub. +**/doc/api/ +.dart_tool/ +.packages + +# Conventional directory for build output. +/build/ + +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ diff --git a/examples/jaspr_site/README.md b/examples/jaspr_site/README.md new file mode 100644 index 00000000..f9605d23 --- /dev/null +++ b/examples/jaspr_site/README.md @@ -0,0 +1,12 @@ +# jaspr_site + +[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link] +[![License: MIT][license_badge]][license_link] + +An example [Jaspr][jaspr_link] site used to exercise the Jaspr workflow. + +[jaspr_link]: https://docs.jaspr.site +[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg +[license_link]: https://opensource.org/licenses/MIT +[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg +[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis diff --git a/examples/jaspr_site/analysis_options.yaml b/examples/jaspr_site/analysis_options.yaml new file mode 100644 index 00000000..9df80aa4 --- /dev/null +++ b/examples/jaspr_site/analysis_options.yaml @@ -0,0 +1 @@ +include: package:very_good_analysis/analysis_options.yaml diff --git a/examples/jaspr_site/lib/app.dart b/examples/jaspr_site/lib/app.dart new file mode 100644 index 00000000..731b3c80 --- /dev/null +++ b/examples/jaspr_site/lib/app.dart @@ -0,0 +1,36 @@ +import 'package:jaspr/dom.dart'; +import 'package:jaspr/jaspr.dart'; + +/// The main component of the application. +/// +/// By using the `@client` annotation this component is automatically compiled +/// to JavaScript and mounted on the client. +@client +class App extends StatelessComponent { + /// Creates the main [App] component. + // The lint's fix rewrites this to `const new(...)`, which requires the + // experimental `primary-constructors` feature that `jaspr build` does not + // enable, so it is suppressed here. + // ignore: unnecessary_type_name_in_constructor + const App({super.key}); + + @override + Component build(BuildContext context) { + return const section([ + h1([Component.text('Welcome')]), + p([Component.text('You successfully created a new Jaspr site.')]), + ]); + } + + /// Defines the CSS styles for this component. + @css + static List get styles => [ + css('section').styles( + display: Display.flex, + height: 100.vh, + flexDirection: FlexDirection.column, + justifyContent: JustifyContent.center, + alignItems: AlignItems.center, + ), + ]; +} diff --git a/examples/jaspr_site/lib/main.client.dart b/examples/jaspr_site/lib/main.client.dart new file mode 100644 index 00000000..d45e3737 --- /dev/null +++ b/examples/jaspr_site/lib/main.client.dart @@ -0,0 +1,16 @@ +/// The entrypoint for the **client** environment. +/// +/// The [main] method will only be executed on the client when loading the page. +/// To run code on the server during pre-rendering, check `main.server.dart`. +library; + +import 'package:jaspr/client.dart'; +import 'package:jaspr_site/main.client.options.dart'; + +void main() { + // Initializes the client environment with the generated default options. + Jaspr.initializeApp(options: defaultClientOptions); + + // Loads and renders all components annotated with `@client`. + runApp(const ClientApp()); +} diff --git a/examples/jaspr_site/lib/main.client.options.dart b/examples/jaspr_site/lib/main.client.options.dart new file mode 100644 index 00000000..38379e91 --- /dev/null +++ b/examples/jaspr_site/lib/main.client.options.dart @@ -0,0 +1,29 @@ +// dart format off +// ignore_for_file: type=lint + +// GENERATED FILE, DO NOT MODIFY +// Generated with jaspr_builder + +import 'package:jaspr/client.dart'; + +import 'package:jaspr_site/app.dart' deferred as _app; + +/// Default [ClientOptions] for use with your Jaspr project. +/// +/// Use this to initialize Jaspr **before** calling [runApp]. +/// +/// Example: +/// ```dart +/// import 'main.client.options.dart'; +/// +/// void main() { +/// Jaspr.initializeApp( +/// options: defaultClientOptions, +/// ); +/// +/// runApp(...); +/// } +/// ``` +ClientOptions get defaultClientOptions => ClientOptions( + clients: {'app': ClientLoader((p) => _app.App(), loader: _app.loadLibrary)}, +); diff --git a/examples/jaspr_site/lib/main.server.dart b/examples/jaspr_site/lib/main.server.dart new file mode 100644 index 00000000..9d4ceea2 --- /dev/null +++ b/examples/jaspr_site/lib/main.server.dart @@ -0,0 +1,31 @@ +/// The entrypoint for the **server** environment. +/// +/// The [main] method will only be executed on the server during pre-rendering. +/// To run code on the client, check the `main.client.dart` file. +library; + +import 'package:jaspr/dom.dart'; +import 'package:jaspr/server.dart'; +import 'package:jaspr_site/app.dart'; +import 'package:jaspr_site/main.server.options.dart'; + +void main() { + // Initializes the server environment with the generated default options. + Jaspr.initializeApp(options: defaultServerOptions); + + // Starts the app by rendering the root document structure. + runApp( + Document( + title: 'jaspr_site', + styles: [ + css('html, body').styles( + width: 100.percent, + minHeight: 100.vh, + padding: Padding.zero, + margin: Margin.zero, + ), + ], + body: const App(), + ), + ); +} diff --git a/examples/jaspr_site/lib/main.server.options.dart b/examples/jaspr_site/lib/main.server.options.dart new file mode 100644 index 00000000..1dcb0855 --- /dev/null +++ b/examples/jaspr_site/lib/main.server.options.dart @@ -0,0 +1,30 @@ +// dart format off +// ignore_for_file: type=lint + +// GENERATED FILE, DO NOT MODIFY +// Generated with jaspr_builder + +import 'package:jaspr/server.dart'; +import 'package:jaspr_site/app.dart' as _app; + +/// Default [ServerOptions] for use with your Jaspr project. +/// +/// Use this to initialize Jaspr **before** calling [runApp]. +/// +/// Example: +/// ```dart +/// import 'main.server.options.dart'; +/// +/// void main() { +/// Jaspr.initializeApp( +/// options: defaultServerOptions, +/// ); +/// +/// runApp(...); +/// } +/// ``` +ServerOptions get defaultServerOptions => ServerOptions( + clientId: 'main.client.dart.js', + clients: {_app.App: ClientTarget<_app.App>('app')}, + styles: () => [..._app.App.styles], +); diff --git a/examples/jaspr_site/pubspec.lock b/examples/jaspr_site/pubspec.lock new file mode 100644 index 00000000..2ad27e8f --- /dev/null +++ b/examples/jaspr_site/pubspec.lock @@ -0,0 +1,541 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: a49d6cf99e8d8e7a8e93668d09ced0bbdb954d0b4fccc2f5f9241c6b87fad95c + url: "https://pub.dev" + source: hosted + version: "99.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "663efa951fb8a45e06f491223a604c93820598f20e6a99c25617a1576065e8b7" + url: "https://pub.dev" + source: hosted + version: "12.1.0" + archive: + dependency: transitive + description: + name: archive + sha256: "6c5bcd986e06b94e3c40244af471750840a3d2341d1f9763a1100a14add517b4" + url: "https://pub.dev" + source: hosted + version: "4.3.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + bazel_worker: + dependency: transitive + description: + name: bazel_worker + sha256: "87cae9150fcf9942b8057e5f51c4848a3efde1289e97411e1c8f01e350120999" + url: "https://pub.dev" + source: hosted + version: "1.1.5" + build: + dependency: transitive + description: + name: build + sha256: "45d14a0fb23e018d8287c32fc98d726ce466b231928ed9b9200f29bd3ccd39ae" + url: "https://pub.dev" + source: hosted + version: "4.0.7" + build_config: + dependency: transitive + description: + name: build_config + sha256: d466ed2dc9c6cd1d169948879b84ee061eb5e22c64a7c6089879c6296d272a8d + url: "https://pub.dev" + source: hosted + version: "1.3.3" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: e1d40ef3f7934986d5da2271b1ba07794921ce263e44d622fb6c406d76589e33 + url: "https://pub.dev" + source: hosted + version: "4.1.6" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "5367e521935b102bdf1e735d2aab461e36b2edca6517662d088dd04cc39f8d16" + url: "https://pub.dev" + source: hosted + version: "2.15.1" + build_web_compilers: + dependency: "direct dev" + description: + name: build_web_compilers + sha256: ef4bc35e0e335f8520692a333b872446697adce0618cf23c3084715ace641721 + url: "https://pub.dev" + source: hosted + version: "4.8.5" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "44922ecebd8e3d0cef743dadd3b54df4e87e2a4c52a29465a1872aa9e192caa8" + url: "https://pub.dev" + source: hosted + version: "5.1.2" + built_value: + dependency: transitive + description: + name: built_value + sha256: f87ea98192116f7093cb214551ce1929caae0681fdba282b3d8b4462adee7bb7 + url: "https://pub.dev" + source: hosted + version: "8.13.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: a4c1ccfee44c7e75ed80484071a5c142a385345e658fd8bd7c4b5c97e7198f98 + url: "https://pub.dev" + source: hosted + version: "3.1.8" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + glob: + dependency: transitive + description: + name: glob + sha256: "218aeb56050c714f62a3182775320dfa04602b55074873e24e31bbd39bda96fb" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + hotreloader: + dependency: transitive + description: + name: hotreloader + sha256: "66871df468fc24eee81f1a0a7cb98acc104716f9b7376d355437b48d633c4ebf" + url: "https://pub.dev" + source: hosted + version: "4.4.0" + html: + dependency: transitive + description: + name: html + sha256: "43b67b8f43321ab066817dfac5619596c98bb1b61624e77203bb4351785f9699" + url: "https://pub.dev" + source: hosted + version: "0.15.7" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + io: + dependency: transitive + description: + name: io + sha256: "2635216ca6a737e60de577ffa1a48a0bec76ca8a62917cfc1bb88c14c570646f" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + jaspr: + dependency: "direct main" + description: + name: jaspr + sha256: c4e7459389fadb3f48ed7c2d5165b000ad93f4aaa08f86a490eaf5d3b652bb3e + url: "https://pub.dev" + source: hosted + version: "0.23.5" + jaspr_builder: + dependency: "direct dev" + description: + name: jaspr_builder + sha256: "15f62fcd3a678dbf0cf68b38fa19b6258d4708b61bff2b8b1f0d6e8302770d41" + url: "https://pub.dev" + source: hosted + version: "0.23.5" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" + url: "https://pub.dev" + source: hosted + version: "4.12.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + meta: + dependency: transitive + description: + name: meta + sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9" + url: "https://pub.dev" + source: hosted + version: "1.19.0" + mime: + dependency: transitive + description: + name: mime + sha256: bd47de35f07e27267e69c8c8b22edf9473bfee170a60d60fcc93730c5144b7f6 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + pool: + dependency: transitive + description: + name: pool + sha256: "4177f68c237ea2128d1bee66ac17b2ce05ba3dbaafcbdd54c5d40a39d0b6b11c" + url: "https://pub.dev" + source: hosted + version: "1.5.3" + posix: + dependency: transitive + description: + name: posix + sha256: bc1bad54ad2b735816e31f8d4600cfde6c7839975085ddfbca48b6c9f7c4044e + url: "https://pub.dev" + source: hosted + version: "6.5.2" + protobuf: + dependency: transitive + description: + name: protobuf + sha256: "13b6717366aa7ec3792dd62c19c7d33a785708224365f2db23c5ca01f1c1a0f2" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "261236774e8b1d69cfc6b9eabbc96c40f25e7a2d6b171f3385d4f65d5734fb24" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c38b81cbf34450b67e0265d73433569d12e34782e30ed769c9cc99c9d5f2e796 + url: "https://pub.dev" + source: hosted + version: "1.6.0" + scratch_space: + dependency: transitive + description: + name: scratch_space + sha256: "55f141cf286eca871f739518b689af61cb994d671f3fd8efabd63aba7578c309" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_gzip: + dependency: transitive + description: + name: shelf_gzip + sha256: "4f4b793c0f969f348aece1ab4cc05fceba9fea431c1ce76b1bc0fa369cecfc15" + url: "https://pub.dev" + source: hosted + version: "4.1.0" + shelf_proxy: + dependency: transitive + description: + name: shelf_proxy + sha256: "0c3a7b2b4c111cae8a6d9077701e0622c6013d38a780373ac359d6d45b3aa10b" + url: "https://pub.dev" + source: hosted + version: "1.0.5" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: a603f1fb984a7391ae5978d1b92bfaaa08b350dca5c825256f925818f7943bf5 + url: "https://pub.dev" + source: hosted + version: "4.2.4" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "14c2945847669b44089bb1222f66873d7ff7103c58911917f2a63c5a62327898" + url: "https://pub.dev" + source: hosted + version: "0.10.14" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "277654b3034d17ac6f9f1cb5595db011b1d5d41e8806866db28e0abaa101c490" + url: "https://pub.dev" + source: hosted + version: "1.12.2" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: a00e5f18bffc764f923e7dec1038527f7fe7a1791361a7117f0358193f13d53a + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + universal_web: + dependency: transitive + description: + name: universal_web + sha256: "618a9d8659e9429875f69d4da0fb9c0c143d3d4cdab28b4545502088aa50ed62" + url: "https://pub.dev" + source: hosted + version: "1.1.1+1" + uuid: + dependency: transitive + description: + name: uuid + sha256: "9b129329f58692f6e6578329498a8fe9fbe98f090beb764ffbb8ee2eadd01dcd" + url: "https://pub.dev" + source: hosted + version: "4.6.0" + very_good_analysis: + dependency: "direct dev" + description: + name: very_good_analysis + sha256: "0bd5eb8d6be76aa0d71e70cbdae6cac8f784f761170568e3c2214a6948c7f6d3" + url: "https://pub.dev" + source: hosted + version: "11.0.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "5f37239c4851efcef929cea7824e76df7f2f0970aef85d66bbc430afa40e72f0" + url: "https://pub.dev" + source: hosted + version: "15.3.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + yaml: + dependency: transitive + description: + name: yaml + sha256: f67cdd8e07d3c6329146aaef1ba043542b3134c12489f553ca9a7435d1068aea + url: "https://pub.dev" + source: hosted + version: "3.1.4" +sdks: + dart: ">=3.13.0 <3.14.0-z" diff --git a/examples/jaspr_site/pubspec.yaml b/examples/jaspr_site/pubspec.yaml new file mode 100644 index 00000000..0c317b8c --- /dev/null +++ b/examples/jaspr_site/pubspec.yaml @@ -0,0 +1,19 @@ +name: jaspr_site +description: An example Jaspr site used to exercise the Jaspr workflow. +version: 1.0.0+1 +publish_to: none + +environment: + sdk: ^3.13.0 + +dependencies: + jaspr: ^0.23.5 + +dev_dependencies: + build_runner: ^2.15.1 + build_web_compilers: ^4.8.5 + jaspr_builder: ^0.23.5 + very_good_analysis: ^11.0.0 + +jaspr: + mode: static diff --git a/examples/jaspr_site/web/favicon.ico b/examples/jaspr_site/web/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..d5383e91ef1486b1a384a61f74343f6a0f9eee5a GIT binary patch literal 1558 zcmV+x2I={UP)FbGtqEo!`Iq^gymi%RXPVaclb0|mnmC`4U!QB?)0 z5@l290#%|Fb%g{Gpb8`kQAEIy#EnU?r^av3`1YRbcu4GV;;`Y9Mss~1bH4Mw23|8* zGn-n2;Ze@`;WFT79C{h-WPU0ft=;DtIdK}CPcVi%jPpqoYQ%0|(*(5O*W(PzmjEBF zIi)L131zN_@6-yn5fFB1%A_6%>rE3NjmxZjnsWrIa}JLN@4*1fTpmleq}-@Dd~W44 z{TzIpM%{--VCHj3%|=m3STds=O32O{bp$-`ocs#RJX8JMKH$gBv5(&LDLY&Ot`x`(DUIa+6H$?q6=64v`FNpPVL&5K=Alu@$%ES|L{jbqoB1mFFv+# zB?80igW=l=t~%uW+o1!9-km{aDFG#wgfqT?7H=2!9Q^{RhfzGba8d4aL)oR*SV2KO z{8IBl{~FlKtDVUvJly>x6!U+zi1A(z1+;6mr^*2%2J&a5;g_$4EOV_Oj8v-mU z>@rEr7q8v0X33O>@W1&+XWfa1x9`(A^bA)lOsDYiwWc z#;FN#c4=Oin>5eH7OR1WvbLp;Ksu30Dp2`gO` zL@DCQjAlMBr%L4aRe|SlIpy0ZmN5U|F}%G#Ypu1b9j30}7sQ{YuW+P?q!7!G`LND3q5GdcMlJouKJ-|FA7Vh-gn8o*&UX@Z}qj=9Sv zg02r{d)JyhRbg7IM`})PXzgs5#PoPVt}V~SWtuT&PNG=?S}^Pvo*t!fZMw0tA(W|% z^~L9y`sFIkBA?F603=Hcy|)*Ov-9%Fr*qJR%XqP*HzJ_cG3q&Vgn=C)e;eC-MR6&? z^=tvEo(9# zBg+k|K>`C~BesI8Fhu513KOV2iw@agx6d{RmGld^(hp<+zKU?d@Uf$KA&Qwx2&W<@ zEMOZ4%6cEE6;7xX9{c+rOVibGcXr6`nT`D`J7XD21U9I%02h}H#@VkT7@{4sL_uUu21+gqHMvB-*Ewe)G=RMeL?BYSDIyD2g9=S8s`a00h1$}JzIXS7 zdAGsn^2&xJOxhugp>K|W04o;Yp1CKqF|0XOm&~iZ?z{FB|%zUsd1vKa)uAk01Yg_&e0u? z?tG5rMQfIX=<(;G%+9UVLXcS938^noJXGYfNzvjz#byX(Z-g&VFpAVUtNxb+D-~oP zsMdFCGL1k4%}g53*i*>MjkpUox)BpptOH{{5_Rqz4Ji4{kaPYC3PQNc=fksTO!#@L z@O}N|oY^?V-OEl@~-@9OH$eUri;4%Bd8V^(?jx^g&S-S^MvQ`#sEb zwrSynrv94MLJJ-bi-Ypgq74sY=(CS8^TSWbF2pw_{FMn*NQC_iT>R_cemTLJE+T&4 zW`q+qbU`DC0M%OuL+4DBQ*#I!Wo4vzGdzvg0q4PR0I!Ju0R+B>bTX= + + + + + + + + + + + + + + + diff --git a/site/docs/overview.md b/site/docs/overview.md index 66a7238a..9b845be2 100644 --- a/site/docs/overview.md +++ b/site/docs/overview.md @@ -19,6 +19,9 @@ uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@ # A reusable workflow for Flutter packages uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1 +# A reusable workflow for Jaspr sites +uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/jaspr_site.yml@v1 + # A reusable workflow for ensuring commits are semantic uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1 diff --git a/site/docs/workflows/jaspr_site.md b/site/docs/workflows/jaspr_site.md new file mode 100644 index 00000000..51cf8d6c --- /dev/null +++ b/site/docs/workflows/jaspr_site.md @@ -0,0 +1,113 @@ +--- +sidebar_position: 11 +--- + +# Jaspr Site + +This workflow runs helpful checks on a [Jaspr][jaspr_link] site according to the steps below. As with any workflow, it can be customized. + +## Steps + +The Jaspr site workflow consists of the following steps: + +1. Setup Dart +2. Set SSH Key (if provided) +3. Install dependencies +4. Run Setup (if provided) +5. Format +6. Analyze +7. Build (if enabled) + +## Inputs + +### `analyze_directories` + +**Optional** A space-separated list of folders that should be analyzed. + +**Default** `"."` + +### `build` + +**Optional** Whether to build the site with the [Jaspr CLI][jaspr_cli_link] (`jaspr build`). The build is the primary validation that the site compiles, since Jaspr sites frequently ship without tests. + +**Default** `true` + +### `build_args` + +**Optional** Extra arguments passed to `jaspr build` (e.g. `--no-ssr --sitemap-domain https://example.com`). The rendering mode is read from `pubspec.yaml`, so it is not configured here. + +**Default** `""` + +### `dart_sdk` + +**Optional** Which Dart SDK version to use. It can be a version (e.g. `3.13.2`) or a channel (e.g. `stable`). + +**Default** `"stable"` + +### `format_directories` + +**Optional** A space-separated list of folders that should be formatted. + +**Default** `"."` + +### `format_line_length` + +**Optional** The preferred line length used when running the `dart format` command. Be aware that this does not change the behavior of the analysis step and longer lines could still make the workflow fail if the rule `lines_longer_than_80_chars` is used. + +### `jaspr_cli_version` + +**Optional** The version of [`jaspr_cli`][jaspr_cli_link] to activate (e.g. `0.23.5`). An empty value installs the latest version. Only relevant when [`build`](#build) is enabled. + +**Default** `""` + +### `runs_on` + +**Optional** The operating system on which to run the workflow. + +**Default** `"ubuntu-latest"` + +### `timeout_minutes` + +**Optional** The maximum number of minutes to let the job run before GitHub automatically cancels it. + +**Default** `360` + +### `setup` + +**Optional** A command that should be executed immediately after dependencies are installed. It can also be used to export environment variables for later steps. + +**Default** `""` + +### `working_directory` + +**Optional** The path to the root of the Jaspr site. + +**Default** `"."` + +## Secrets + +### `ssh_key` + +**Optional** An SSH key used to access private repositories when installing dependencies. + +## Example Usage + +```yaml +name: My Jaspr Workflow + +on: pull_request + +jobs: + build: + uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/jaspr_site.yml@v1 + with: + dart_sdk: 'stable' + jaspr_cli_version: '0.23.5' + timeout_minutes: 10 + working_directory: 'examples/my_jaspr_site' + secrets: + ssh_key: ${{secrets.EXAMPLE_KEY}} +``` + +[jaspr_link]: https://docs.jaspr.site +[jaspr_cli_link]: https://pub.dev/packages/jaspr_cli diff --git a/test/workflows.test.js b/test/workflows.test.js index cd4c9bb2..346edd11 100644 --- a/test/workflows.test.js +++ b/test/workflows.test.js @@ -29,6 +29,7 @@ const EXPECTED_TEMPLATES = [ 'dart_pub_publish.yml', 'flutter_package.yml', 'flutter_pub_publish.yml', + 'jaspr_site.yml', 'license_check.yml', 'mason_publish.yml', 'pana.yml', @@ -500,6 +501,7 @@ describe('inputs are wired into the steps that consume them', () => { 'dart_package.yml', 'dart_pub_publish.yml', 'flutter_pub_publish.yml', + 'jaspr_site.yml', 'license_check.yml', 'mason_publish.yml', 'skills_lint.yml',