Skip to content

Commit

Permalink
[cli_config] Add coverage (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes authored Mar 23, 2023
1 parent 5d48fe4 commit c967aa8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/cli_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,16 @@ jobs:

- run: dart test
if: ${{matrix.run-tests}}

- name: Install coverage
run: dart pub global activate coverage
if: ${{ matrix.sdk == 'stable' }}
- name: Collect coverage
run: dart pub global run coverage:test_with_coverage
if: ${{ matrix.sdk == 'stable' }}
- name: Upload coverage
uses: coverallsapp/github-action@50c33ad324a9902697adbf2f92c22cf5023eacf1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./pkgs/cli_config/coverage/lcov.info
if: ${{ matrix.sdk == 'stable' }}
2 changes: 2 additions & 0 deletions pkgs/cli_config/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
# Avoid committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock

coverage/
1 change: 1 addition & 0 deletions pkgs/cli_config/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![package:cli_config](https://github.com/dart-lang/tools/actions/workflows/cli_config.yml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/cli_config.yml)
[![pub package](https://img.shields.io/pub/v/cli_config.svg)](https://pub.dev/packages/cli_config)
[![Coverage Status](https://coveralls.io/repos/github/dart-lang/tools/badge.svg?branch=main)](https://coveralls.io/github/dart-lang/tools?branch=main)
<!-- [![package publisher](https://img.shields.io/pub/publisher/cli_config.svg)](https://pub.dev/packages/cli_config/publisher) -->

A library to take config values from configuration files, CLI arguments, and environment variables.
2 changes: 2 additions & 0 deletions pkgs/cli_config/lib/cli_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/// A library to take config values from configuration files, CLI arguments,
/// and environment variables.
library cli_config;

export 'src/cli_config.dart';
5 changes: 5 additions & 0 deletions pkgs/cli_config/lib/src/cli_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

int add(int a, int b) => a + b;
3 changes: 2 additions & 1 deletion pkgs/cli_config/test/cli_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:cli_config/cli_config.dart';
import 'package:test/test.dart';

void main() {
test('dummy test', () {
expect(42, 42);
expect(add(21, 21), 42);
});
}

0 comments on commit c967aa8

Please sign in to comment.