Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ jobs:

- name: Run Benchmark
id: run-benchmark
working-directory: packages/benchmark
run: |
dart compile exe benchmark/benchmark.dart
./benchmark/benchmark.exe run --store-in-git-notes --verbose
dart compile exe bin/benchmark.dart
./bin/benchmark.exe run --store-in-git-notes --verbose

- name: Push Benchmark Data
# This step runs only if the pull request is NOT from a fork.
Expand Down
83 changes: 62 additions & 21 deletions .github/workflows/dart-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ on:

env:
PUB_CACHE_PATH: ~/.pub-cache
LOWEST_DART_SDK: "3.7.0"
LOWEST_DART_SDK: "3.8.1"

jobs:
build:
name: Verify Build
analyze:
name: Analyze
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
dart_sdk:
# ${{ env.LOWEST_DART_SDK }} won't work at job level as env context not available for strategy ¯\_(ツ)_/¯
# (see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#context-availability)
- "3.7.0"
- "3.8.1"
- stable
steps:
- name: Checkout Code
Expand All @@ -41,18 +41,12 @@ jobs:
key: ${{ runner.os }}-pub-cache-${{ matrix.dart_sdk }}
restore-keys: ${{ runner.os }}-pub-cache-

- name: Install Dependencies
run: dart pub get

- name: Verify Formatting
# Disable formatting check on stable for now.
# Dart stable (3.7.2 as of 2025-03-14) has radically different formatting
if: ${{ matrix.dart_sdk == env.LOWEST_DART_SDK }}
run: dart format --output=none --set-exit-if-changed .

- name: Check Dependency Bounds
run: >-
dart pub downgrade --tighten &&
dart pub upgrade --major-versions &&
git diff-files --quiet

- name: Analyze (downgraded)
run: >-
dart pub downgrade &&
Expand All @@ -65,29 +59,63 @@ jobs:
dart pub get &&
dart analyze ${{ matrix.dart_sdk == env.LOWEST_DART_SDK && '--fatal-infos' || '--fatal-warnings' }}

verify_packages:
name: Verify Package (${{ matrix.package }})
runs-on: ubuntu-latest
strategy:
matrix:
package: [relic_core, relic_io, relic]
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable

- name: Cache Dart Dependencies
uses: actions/cache@v4
with:
path: ${{ env.PUB_CACHE_PATH }}
key: ${{ runner.os }}-pub-cache-stable
restore-keys: ${{ runner.os }}-pub-cache-

- name: Install Dependencies
run: dart pub get

- name: Check Dependency Bounds
working-directory: packages/${{ matrix.package }}
run: >-
dart pub downgrade --tighten &&
dart pub upgrade --major-versions &&
git diff-files --quiet -- .

- name: Doc Dry Run
working-directory: packages/${{ matrix.package }}
run: dart doc --dry-run

- name: Check Pana Score
if: ${{ matrix.dart_sdk == 'stable' }}
# temporary workaround until https://github.com/dart-lang/pana/issues/1499 is resolved
continue-on-error: true
working-directory: packages/${{ matrix.package }}
run: >-
dart pub global activate pana &&
dart pub global run pana --no-warning --exit-code-threshold=0 --json

- name: Publish Dry Run
working-directory: packages/${{ matrix.package }}
run: dart pub publish --dry-run

unit_tests:
name: Run Unit Tests
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.dart_sdk != '3.7.0' }} # env context not available for continue-on-error
continue-on-error: ${{ matrix.dart_sdk != '3.8.1' }} # env context not available for continue-on-error
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
dart_sdk: ["3.7.0", stable, beta] # env context not available for strategy
dart_sdk: ["3.8.1", stable, beta] # env context not available for strategy
deps: [downgrade, upgrade]
steps:
- name: Checkout Code
Expand All @@ -110,21 +138,34 @@ jobs:
dart pub ${{ matrix.deps }} &&
dart pub get

- name: Activate Melos
run: dart pub global activate melos

- name: Hot-reload Test
working-directory: packages/relic
run: >-
dart --enable-vm-service test test/router/relic_app_test.dart -t hot-reload -c source

- name: Run Tests
run: melos run test --no-select -- --reporter=failures-only

- name: Run Tests With Coverage
run: >-
dart pub global activate coverage &&
dart pub global run coverage:test_with_coverage --branch-coverage -- --reporter=failures-only
if: ${{ matrix.os == 'ubuntu-latest' && matrix.dart_sdk == '3.8.1' && matrix.deps == 'upgrade' }}
run: |
dart pub global activate coverage
for package in packages/relic_core packages/relic_io packages/relic; do
if [ -d "$package/test" ]; then
echo "Running coverage for $package"
(cd "$package" && dart pub global run coverage:test_with_coverage --branch-coverage -- --reporter=failures-only)
fi
done

- name: Upload Coverage
uses: codecov/codecov-action@v5
if: ${{ !cancelled() }} # upload coverage irrespective of test results
if: ${{ matrix.os == 'ubuntu-latest' && matrix.dart_sdk == '3.8.1' && matrix.deps == 'upgrade' && !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
files: packages/relic_core/coverage/lcov.info,packages/relic_io/coverage/lcov.info,packages/relic/coverage/lcov.info

docs-markdown-lint:
name: Markdown lint for docs
Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
name: Publish Relic
name: Publish Relic

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*' # Matches tags like v1.2.3 and v1.2.3-pre.1
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*" # Matches tags like v1.2.3 and v1.2.3-pre.1

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
publish-core:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
working-directory: packages/relic_core

publish-io:
needs: publish-core
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
working-directory: packages/relic_io

publish-relic:
needs: publish-io
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
working-directory: packages/relic
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pubspec.lock
.idea/
.vscode/
.vscode-test/
*.iml

# Local build artifacts
*.exe
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2025-12-10

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`relic` - `v0.13.2`](#relic---v0132)
- [`relic_core` - `v0.13.2`](#relic_core---v0132)
- [`relic_io` - `v0.13.2`](#relic_io---v0132)

---

#### `relic` - `v0.13.2`

- **FEAT**: Extract relic_io package.
- **FEAT**: Extract relic_core package.

#### `relic_core` - `v0.13.2`

- **FEAT**: Extract relic_core package.

#### `relic_io` - `v0.13.2`

- **FEAT**: Extract relic_io package.

## 0.13.1
- fix: Close connection, if request too large ([#303](https://github.com/serverpod/relic/pull/303))

Expand Down
3 changes: 1 addition & 2 deletions doc/site/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Extract version from command line (e.g., "make version 1.2.3")
# Filter out known targets to get the version argument
VERSION := $(filter-out install start version,$(MAKECMDGOALS))
EXAMPLE_SOURCE_DIR := $(abspath $(CURDIR)/../../example)
EXAMPLE_SOURCE_DIR := $(abspath $(CURDIR)/../../packages/examples)
VERSIONED_EXAMPLE_DIR := versioned_docs/version-$(VERSION)/_example

install:
Expand Down Expand Up @@ -35,4 +35,3 @@ validate-version:
# Create dummy targets for version arguments to prevent Make errors
%:
@:

2 changes: 1 addition & 1 deletion doc/site/docs/_example
3 changes: 0 additions & 3 deletions lib/io_adapter.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'package:relic/relic.dart';
import 'package:routingkit/routingkit.dart' as routingkit;
import 'package:spanner/spanner.dart' as spanner;

import 'completion_script_carapace.dart';
import 'package:benchmark/src/completion_script_carapace.dart';

late final List<int> indexes;
late final List<String> staticRoutesToLookup;
Expand Down
18 changes: 18 additions & 0 deletions packages/benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: benchmark
description: Benchmarks for Relic router.
publish_to: none

environment:
sdk: ^3.7.0

resolution: workspace

dependencies:
benchmark_harness: ^2.3.1
cli_tools: ^0.9.0
config: ^0.8.3
git: ^2.2.1
path: ^1.8.3
relic: ^0.13.2
routingkit: ^5.1.2
spanner: ^1.0.5
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:developer';
import 'dart:io';
import 'dart:isolate';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

void main() async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:io';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// Demonstrates using RelicServer with a router converted to a handler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:developer';
import 'dart:io';
import 'dart:typed_data';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// Example demonstrating Body class features. Shows creating bodies from
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:convert';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

// Basic handler that returns a simple greeting.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import 'dart:developer';
import 'dart:io';

/// Complete code sample referenced by the Shelf migration guide.
// doctag<complete-relic>
import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

Future<void> main() async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:io';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// Demonstrates various static file serving patterns and caching strategies.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:developer';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';
import 'package:web_socket/web_socket.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:developer';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// Extension to provide easy access to the request ID.
Expand Down
1 change: 0 additions & 1 deletion example/example.dart → packages/examples/example.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// doctag<hello-world-app>
import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// A simple 'Hello World' server demonstrating basic Relic usage.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:developer';
import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// Middleware that validates API keys for authentication.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:developer';

import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// Middleware that handles Cross-Origin Resource Sharing (CORS).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:developer';
import 'dart:isolate';

import 'package:http/http.dart' as http;
import 'package:relic/io_adapter.dart';
import 'package:relic/relic.dart';

/// Demonstrates authentication middleware with context properties.
Expand Down
Loading
Loading