diff --git a/.github/workflows/dart-tests.yaml b/.github/workflows/dart-tests.yaml new file mode 100644 index 0000000..25dc940 --- /dev/null +++ b/.github/workflows/dart-tests.yaml @@ -0,0 +1,135 @@ +name: Relic CI + +on: + push: + branches: + - main + - dev + pull_request: + branches: + - main + - dev + +env: + PUB_CACHE_PATH: ~/.pub-cache + +jobs: + dart_format: + name: Verify Dart Formatting + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + dart_sdk: ['3.3.0'] + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Setup Dart + uses: dart-lang/setup-dart@v1.3 + with: + sdk: ${{ matrix.dart_sdk }} + - name: Cache Dart dependencies + uses: actions/cache@v3 + with: + path: ${{ env.PUB_CACHE_PATH }} + key: ${{ runner.os }}-pub-cache-${{ matrix.dart_sdk }} + restore-keys: | + ${{ runner.os }}-pub-cache- + - name: Verify formatting + run: dart format --output=none --set-exit-if-changed . + + dart_analyze: + name: Run Dart Analysis + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + dart_sdk: ['3.3.0', 'stable'] + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Setup Dart + uses: dart-lang/setup-dart@v1.3 + with: + sdk: ${{ matrix.dart_sdk }} + - name: Cache Dart dependencies + uses: actions/cache@v3 + with: + path: ${{ env.PUB_CACHE_PATH }} + key: ${{ runner.os }}-pub-cache-${{ matrix.dart_sdk }} + restore-keys: | + ${{ runner.os }}-pub-cache- + - name: Install dependencies + run: dart pub upgrade + - name: Analyze + run: dart analyze + + dart_analyze_downgrade: + name: Run Dart Analysis Downgrade + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Setup Dart + uses: dart-lang/setup-dart@v1.3 + with: + sdk: '3.3.0' + - name: Cache Dart dependencies + uses: actions/cache@v3 + with: + path: ${{ env.PUB_CACHE_PATH }} + key: ${{ runner.os }}-pub-cache-downgrade + restore-keys: | + ${{ runner.os }}-pub-cache- + - name: Install dependencies (Downgrade) + run: dart pub downgrade + - name: Analyze + run: dart analyze + + dart_analyze_latest_downgrade: + name: Run Dart Analysis Latest (stable) Downgrade + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Setup Dart + uses: dart-lang/setup-dart@v1.3 + with: + sdk: 'stable' + - name: Cache Dart dependencies + uses: actions/cache@v3 + with: + path: ${{ env.PUB_CACHE_PATH }} + key: ${{ runner.os }}-pub-cache-downgrade + restore-keys: | + ${{ runner.os }}-pub-cache- + - name: Install dependencies (Downgrade) + run: dart pub downgrade + - name: Analyze + run: dart analyze + + unit_tests: + name: Run Unit Tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + dart_sdk: ['3.3.0'] + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Setup Dart + uses: dart-lang/setup-dart@v1.3 + with: + sdk: ${{ matrix.dart_sdk }} + - name: Cache Dart dependencies + uses: actions/cache@v3 + with: + path: ${{ env.PUB_CACHE_PATH }} + key: ${{ runner.os }}-pub-cache-${{ matrix.dart_sdk }} + restore-keys: | + ${{ runner.os }}-pub-cache- + - name: Install dependencies + run: dart pub upgrade + - name: Run tests + run: dart test diff --git a/.gitignore b/.gitignore index 3a83c2f..bbad1e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,15 @@ -# See https://www.dartlang.org/guides/libraries/private-files - -# Files and directories created by pub +# Dart tool and build artifacts .dart_tool/ -.packages +.pub/ build/ -# If you're building an application, you may want to check-in your pubspec.lock pubspec.lock -# Directory created by dartdoc -# If you don't generate documentation locally you can remove this line. -doc/api/ - -# dotenv environment variables file -.env* +# macOS system files +.DS_Store -# Avoid committing generated Javascript files: -*.dart.js -*.info.json # Produced by the --dump-info flag. -*.js # When generated by dart2js. Don't specify *.js if your - # project includes source files written in JavaScript. -*.js_ -*.js.deps -*.js.map +# IDE and editor configurations +.atom/ +.idea/ +.vscode/ +.vscode-test/ -.flutter-plugins -.flutter-plugins-dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a0712a7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 + +- Initial version. diff --git a/README.md b/README.md index 09cf038..b255549 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ -# relic -Strictly typed HTTP server with incredible performance. +# Relic + +Relic is a basic HTTP server based on Shelf. Unlike Shelf, Relic is strictly typed, and it has some other performance improvements. This release is still experimental. + +Relic is primarily created for [Serverpod](https://serverpod.dev). \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..572dd23 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1 @@ +include: package:lints/recommended.yaml diff --git a/lib/relic.dart b/lib/relic.dart new file mode 100644 index 0000000..0694ca1 --- /dev/null +++ b/lib/relic.dart @@ -0,0 +1,8 @@ +/// Support for doing something awesome. +/// +/// More dartdocs go here. +library; + +export 'src/relic_base.dart'; + +// TODO: Export any libraries intended for clients of this package. diff --git a/lib/src/relic_base.dart b/lib/src/relic_base.dart new file mode 100644 index 0000000..41deac6 --- /dev/null +++ b/lib/src/relic_base.dart @@ -0,0 +1,4 @@ +/// Checks if you are awesome. Spoiler: you are. +class Awesome { + bool get isAwesome => true; +} diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..35da383 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,15 @@ +name: relic +description: A lightweight web server inspired by Shelf. +version: 0.2.0 +repository: https://github.com/serverpod/relic + +environment: + sdk: '>=3.3.0 <4.0.0' + +dependencies: + +dev_dependencies: + dart_flutter_team_lints: ^3.0.0 + http: '>=1.0.0 <2.0.0' + test: ^1.24.2 + test_descriptor: ^2.0.1 diff --git a/test/relic_test.dart b/test/relic_test.dart new file mode 100644 index 0000000..a13957b --- /dev/null +++ b/test/relic_test.dart @@ -0,0 +1,16 @@ +import 'package:relic/relic.dart'; +import 'package:test/test.dart'; + +void main() { + group('A group of tests', () { + final awesome = Awesome(); + + setUp(() { + // Additional setup goes here. + }); + + test('First Test', () { + expect(awesome.isAwesome, isTrue); + }); + }); +}