Skip to content

Commit

Permalink
feat: Add Simple Dart Project with GitHub Actions CI. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
klkucaj authored Dec 13, 2024
1 parent 36b87cc commit 8e31e86
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 23 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/dart-tests.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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
30 changes: 9 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0

- Initial version.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:lints/recommended.yaml
8 changes: 8 additions & 0 deletions lib/relic.dart
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions lib/src/relic_base.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// Checks if you are awesome. Spoiler: you are.
class Awesome {
bool get isAwesome => true;
}
15 changes: 15 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions test/relic_test.dart
Original file line number Diff line number Diff line change
@@ -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);
});
});
}

0 comments on commit 8e31e86

Please sign in to comment.