Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/benchmark flutter #11

Merged
merged 15 commits into from
Aug 22, 2024
Merged
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
25 changes: 11 additions & 14 deletions .github/workflows/checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
image: dart:stable
env:
pub-cache-name: pub
PUB_CACHE: /github/home/.pub-cache
timeout-minutes: 10
steps:
- name: 🚂 Get latest code
Expand All @@ -42,45 +43,41 @@ jobs:
lib
test
analysis_options.yaml
README.md
CHANGELOG.md

- name: 📤 Restore Pub modules
id: cache-pub-restore
uses: actions/cache/restore@v4
with:
path: |
$PWD/.pub_cache/
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

- name: 🗄️ Export Pub cache directory
id: export-pub-cache
timeout-minutes: 1
run: |
export PUB_CACHE=$PWD/.pub_cache/
export PATH="$PATH":"$HOME/.pub-cache/bin"
${{ env.PUB_CACHE }}
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('pubspec.yaml') }}

- name: 👷 Install Dependencies
id: install-dependencies
timeout-minutes: 1
run: dart pub get --no-example
run: |
echo $PUB_CACHE/bin >> $GITHUB_PATH
dart pub get --no-example

- name: 📥 Save Pub modules
id: cache-pub-save
uses: actions/cache/save@v4
with:
path: |
$PWD/.pub_cache/
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
${{ env.PUB_CACHE }}
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('pubspec.yaml') }}

- name: 🔎 Check format
id: check-format
timeout-minutes: 1
run: dart format --set-exit-if-changed -l 80 -o none lib/
run: dart format --set-exit-if-changed -l 80 -o none lib/ test/

- name: 📈 Check analyzer
id: check-analyzer
timeout-minutes: 1
run: dart analyze --fatal-infos --fatal-warnings lib/
run: dart analyze --fatal-infos --fatal-warnings lib/ test/

- name: 👀 Verify versions
id: verify-versions
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
env:
pub-cache-name: pub
threshold: 50
PUB_CACHE: /github/home/.pub-cache
timeout-minutes: 15
steps:
- name: 🚂 Get latest code
Expand All @@ -129,20 +130,14 @@ jobs:
uses: actions/cache/restore@v4
with:
path: |
$PWD/.pub_cache/
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}

- name: 🗄️ Export Pub cache directory
id: export-pub-cache
timeout-minutes: 1
run: |
export PUB_CACHE=$PWD/.pub_cache/
export PATH="$PATH":"$HOME/.pub-cache/bin"
${{ env.PUB_CACHE }}
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('pubspec.yaml') }}

- name: 👷 Install Dependencies
id: install-dependencies
timeout-minutes: 1
run: |
echo $PUB_CACHE/bin >> $GITHUB_PATH
apt-get update && apt-get install -y lcov bc
dart pub get --no-example

Expand All @@ -151,8 +146,8 @@ jobs:
uses: actions/cache/save@v4
with:
path: |
$PWD/.pub_cache/
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('**/pubspec.yaml') }}
${{ env.PUB_CACHE }}
key: ${{ runner.os }}-spinify-${{ env.pub-cache-name }}-${{ hashFiles('pubspec.yaml') }}

- name: 📢 Run Echo server
id: run-echo-server
Expand Down
1 change: 1 addition & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/benchmark/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.3

- Move benchmark to example folder

## 0.0.2

- Basic functionality implemented
Expand Down
81 changes: 61 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,71 @@
.PHONY: format get outdated test publish deploy echo-up echo-down coverage analyze check pana generate

ifeq ($(OS),Windows_NT)
SHELL = cmd
RM = del /Q
MKDIR = mkdir
PWD = $(shell $(PWD))
else
SHELL = /bin/bash -e -o pipefail
RM = rm -f
MKDIR = mkdir -p
PWD = pwd
endif

format:
@echo "Formatting the code"
@dart format -l 80 --fix .
.DEFAULT_GOAL := all
.PHONY: all
all: ## build pipeline
all: generate format check test

.PHONY: precommit
precommit: ## validate the branch before commit
precommit: all

.PHONY: help
help:
@echo 'Usage: make <OPTIONS> ... <TARGETS>'
@echo ''
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: format
format: ## Format the code
@dart format -l 80 --fix lib/ test/
@dart fix --apply .

get:
.PHONY: get
get: ## Get the dependencies
@dart pub get

outdated:
.PHONY: outdated
outdated: get ## Check for outdated dependencies
@dart pub outdated --show-all --dev-dependencies --dependency-overrides --transitive --no-prereleases

test: get
@dart test --debug --coverage=coverage --platform chrome,vm test/unit_test.dart
.PHONY: test
test: get ## Run the tests
@dart test --debug --coverage=coverage --platform vm,chrome test/unit_test.dart

publish: generate
.PHONY: publish-check
publish-check: ## Check the package before publishing
@dart pub publish --dry-run

.PHONY: deploy-check
deploy-check: publish-check

.PHONY: publish
publish: generate ## Publish the package
@yes | dart pub publish

.PHONY: deploy
deploy: publish

echo-up:
.PHONY: echo-up
echo-up: ## Start the echo server
@dart run tool/echo_up.dart

echo-down:
.PHONY: echo-down
echo-down: ## Stop the echo server
@dart run tool/echo_down.dart

coverage: get
.PHONY: coverage
coverage: get ## Generate the coverage report
@dart pub global activate coverage
@dart pub global run coverage:test_with_coverage -fb -o coverage -- \
--platform vm --compiler=kernel --coverage=coverage \
Expand All @@ -50,23 +80,34 @@ coverage: get
@lcov --list coverage/lcov.info
@genhtml -o coverage coverage/lcov.info

analyze: get format
@echo "Analyze the code"
@dart analyze --fatal-infos --fatal-warnings
.PHONY: analyze
analyze: get ## Analyze the code
@dart format --set-exit-if-changed -l 80 -o none lib/ test/
@dart analyze --fatal-infos --fatal-warnings lib/ test/

check: analyze
@dart pub publish --dry-run
.PHONY: check
check: analyze publish-check ## Check the code
@dart pub global activate pana
@pana --json --no-warning --line-length 80 > log.pana.json

.PHONY: pana
pana: check

generate: get
.PHONY: generate
generate: get ## Generate the code
@dart pub global activate protoc_plugin
@protoc --proto_path=lib/src/protobuf --dart_out=lib/src/protobuf lib/src/protobuf/client.proto
@dart run build_runner build --delete-conflicting-outputs
@dart format -l 80 lib/src/model/pubspec.yaml.g.dart lib/src/protobuf/ test/

.PHONY: gen
gen: generate

codegen: generate
.PHONY: codegen
codegen: generate

.PHONY: diff
diff: ## git diff
$(call print-target)
@git diff --exit-code
@RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions benchmark/pubspec.yaml → example/benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ^3.5.0
sdk: ^3.4.0
flutter: ^3.24.0

dependencies:
flutter:
Expand All @@ -18,7 +19,7 @@ dependencies:
# Centrifuge clients
centrifuge: ^0.14.0
spinify:
path: ../
path: ../../

# Utilities
l: ^5.0.0-pre.2
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions lib/src/model/pubspec.yaml.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ sealed class Pubspec {
static const PubspecVersion version = (
/// Non-canonical string representation of the version as provided
/// in the pubspec.yaml file.
representation: r'0.0.2',
representation: r'0.0.3',

/// Returns a 'canonicalized' representation
/// of the application version.
/// This represents the version string in accordance with
/// Semantic Versioning (SemVer) standards.
canonical: r'0.0.2',
canonical: r'0.0.3',

/// MAJOR version when you make incompatible API changes.
/// The major version number: 1 in "1.2.3".
Expand All @@ -112,7 +112,7 @@ sealed class Pubspec {

/// PATCH version when you make backward compatible bug fixes.
/// The patch version number: 3 in "1.2.3".
patch: 2,
patch: 3,

/// The pre-release identifier: "foo" in "1.2.3-foo".
preRelease: <String>[],
Expand All @@ -125,12 +125,12 @@ sealed class Pubspec {
static final DateTime timestamp = DateTime.utc(
2024,
8,
18,
6,
33,
36,
43,
85,
21,
23,
58,
0,
218,
35,
);

/// Name
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: >
Dart client to communicate with Centrifuge and Centrifugo from Dart and Flutter
over WebSockets with Protobuf support.

version: 0.0.2
version: 0.0.3

homepage: https://centrifugal.dev

Expand Down
Loading