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

ci(passkit): add workflow #37

Closed
wants to merge 6 commits into from
Closed
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
23 changes: 23 additions & 0 deletions .github/workflows/passkit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: passkit

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths:
- "passkit/**"
- ".github/workflows/passkit.yaml"
branches:
- master

jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
with:
dart_sdk: 3.4.3
working_directory: passkit
# TODO: Increase minimum coverage to 100% gradually.
min_coverage: 50
coverage_excludes: '*.g.dart'
15 changes: 1 addition & 14 deletions passkit/lib/passkit.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
library;

export 'src/passkit/barcode.dart';
export 'src/passkit/beacon.dart';
export 'src/passkit/field_dict.dart';
export 'src/passkit/location.dart';
export 'src/passkit/nfc.dart';
export 'src/passkit/parse_utils.dart';
export 'src/passkit/pass_structure.dart';
export 'src/passkit/pass_data.dart';
export 'src/passkit/pass_type.dart';
export 'src/passkit/personalization.dart';
export 'src/passkit/pk_pass_image.dart';
export 'src/passkit/pkpass.dart';
export 'src/passkit/semantic_tag_type.dart';
export 'src/passkit/semantics.dart';
export 'src/models/models.dart';
export 'src/passkit_web_client.dart';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:passkit/src/passkit/semantics.dart';
import 'package:passkit/src/models/models.dart';

part 'field_dict.g.dart';

Expand Down
13 changes: 13 additions & 0 deletions passkit/lib/src/models/models.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export 'field_dict.dart';
export 'location.dart';
export 'nfc.dart';
export 'pass_structure.dart';
export 'pass_data.dart';
export 'pass_type.dart';
export 'personalization.dart';
export 'pk_pass_image.dart';
export 'pkpass.dart';
export 'barcode.dart';
export 'beacon.dart';
export 'semantics.dart';
export 'semantic_tag_type.dart';
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import 'package:csslib/parser.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:passkit/src/passkit/barcode.dart';
import 'package:passkit/src/passkit/beacon.dart';
import 'package:passkit/src/passkit/location.dart';
import 'package:passkit/src/passkit/nfc.dart';
import 'package:passkit/src/passkit/parse_utils.dart';
import 'package:passkit/src/passkit/pass_structure.dart';
import 'package:passkit/src/passkit/semantics.dart';
import 'package:passkit/src/models/models.dart';
import 'package:passkit/src/utils/utils.dart';

part 'pass_data.g.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:passkit/src/passkit/field_dict.dart';
import 'package:passkit/src/models/models.dart';

part 'pass_structure.g.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import 'dart:convert';
import 'dart:typed_data';

import 'package:archive/archive.dart';
import 'package:passkit/src/passkit/pass_data.dart';
import 'package:passkit/src/passkit/pass_type.dart';
import 'package:passkit/src/passkit/personalization.dart';
import 'package:passkit/src/passkit/pk_pass_image.dart';
import 'package:passkit/src/models/models.dart';

/// Dart uses a special fast decoder when using a fused [Utf8Decoder] and [JsonDecoder].
/// This speeds up decoding.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:passkit/src/passkit/semantic_tag_type.dart';
import 'package:passkit/src/models/models.dart';

part 'semantics.g.dart';

Expand Down
11 changes: 7 additions & 4 deletions passkit/lib/src/passkit_web_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:typed_data';
import 'package:http/http.dart';
import 'package:http_parser/http_parser.dart';
import 'package:passkit/passkit.dart';
import 'package:passkit/src/models/models.dart';
import 'package:passkit/src/passkit_web_client_exceptions.dart';

/// This class allows you to update a [PkPass] the latest version, if the pass
Expand Down Expand Up @@ -42,8 +43,9 @@ class PassKitWebClient {

final identifier = pass.pass.passTypeIdentifier;
final serial = pass.pass.serialNumber;
final endpoint = Uri.parse(webServiceUrl)
.resolveUri(Uri(pathSegments: ['v1', 'passes', identifier, serial]));
final endpoint = Uri.parse(webServiceUrl).resolveUri(
Uri(pathSegments: ['v1', 'passes', identifier, serial]),
);

final response = await _client.get(
endpoint,
Expand Down Expand Up @@ -72,8 +74,9 @@ class PassKitWebClient {
throw PassKitWebServiceUnsupported();
}

final endpoint =
Uri.parse(webServiceUrl).resolveUri(Uri(pathSegments: ['v1', 'log']));
final endpoint = Uri.parse(webServiceUrl).resolveUri(
Uri(pathSegments: ['v1', 'log']),
);

await _client.post(endpoint, body: jsonEncode(messages));
}
Expand Down
10 changes: 6 additions & 4 deletions passkit/lib/src/passkit_web_client_exceptions.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class PassKitWebServiceUnsupported implements Exception {
@override
String toString() => "The PkPass file doesn't specify a 'webServiceURL' and "
"thus there's no possibility to make a HTTP request.";
String toString() {
return '''The PkPass file doesn't specify a 'webServiceURL' and thus there's no possibility to make a HTTP request.''';
}
}

class PassKitWebServiceAuthenticationError implements Exception {}
Expand All @@ -12,6 +13,7 @@ class PassKitWebServiceUnrecognizedStatusCode implements Exception {
final int statusCode;

@override
String toString() =>
'PassKitWebServiceUnrecognizedStatusCode(statusCode: $statusCode)';
String toString() {
return 'PassKitWebServiceUnrecognizedStatusCode(statusCode: $statusCode)';
}
}
1 change: 1 addition & 0 deletions passkit/lib/src/utils/utils.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'parse_utils.dart';
Loading