Skip to content

contribute a CI #3

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

Merged
merged 2 commits into from
Feb 14, 2023
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
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/dash_analytics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:dash_analytics"
about: "Create a bug or file a feature request against package:dash_analytics."
labels: "package:dash_analytics"
---
8 changes: 8 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Dependabot configuration file.
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
7 changes: 7 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Configuration for .github/workflows/pull_request_label.yml.

'infra':
- '.github/**'

'package:dash_analytics':
- 'pkgs/dash_analytics/**'
44 changes: 44 additions & 0 deletions .github/workflows/dash_analytics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: package:dash_analytics
permissions: read-all

on:
pull_request:
branches: [ main ]
paths:
- '.github/workflows/dash_analytics.yml'
- 'pkgs/dash_analytics/**'
push:
branches: [ main ]
paths:
- '.github/workflows/dash_analytics.yml'
- 'pkgs/dash_analytics/**'
schedule:
- cron: '0 0 * * 0' # weekly

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pkgs/dash_analytics
strategy:
matrix:
sdk: [stable, dev] # {pkgs.versions}
include:
- sdk: stable
run-tests: true
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: ${{matrix.sdk}}

- run: dart pub get

- run: dart analyze --fatal-infos

- run: dart format --output=none --set-exit-if-changed .
if: ${{matrix.run-tests}}

- run: dart test
if: ${{matrix.run-tests}}
22 changes: 22 additions & 0 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This workflow applies labels to pull requests based on the paths that are
# modified in the pull request.
#
# Edit `.github/labeler.yml` to configure labels. For more information, see
# https://github.com/actions/labeler.

name: Pull Request Labeler
permissions: read-all

on:
pull_request_target

jobs:
label:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@5c7539237e04b714afd8ad9b4aed733815b9fab4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ This repository is home to tooling related Dart packages.
## Packages

| Package | Description | Version |
|---|---|---|
| --- | --- | --- |
| [dash_analytics](pkgs/dash_analytics/) | A package for logging analytics for all dash related tooling to Google Analytics | <!-- [![pub package](https://img.shields.io/pub/v/dash_analytics.svg)](https://pub.dev/packages/dash_analytics) --> |

## Publishing automation

Expand Down
15 changes: 0 additions & 15 deletions mono_repo.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion pkgs/dash_analytics/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![package:dash_analytics](https://github.com/dart-lang/tools/actions/workflows/dash_analytics.yml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/dash_analytics.yml)

## What's This?

This package is intended to be used on Dash (Flutter, Dart, etc.) related tooling only.
Expand All @@ -7,4 +9,4 @@ This is not intended to be general purpose or consumed by the community. It is r

## Using This Package As A Dash Tool

Refer to the [guide](USAGE_GUIDE.md)
Refer to the [guide](USAGE_GUIDE.md).
2 changes: 1 addition & 1 deletion pkgs/dash_analytics/USAGE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ Explanation of the each key above
- endDateTime: the latest, most recent event that was sent
- sessionCount: count of sessions; sessions have a minimum time of 30 minutes
- flutterChannelCount: count of flutter channels (can be 0 if developer is a Dart dev only)
- toolCount: count of the dash tools sending analytics
- toolCount: count of the dash tools sending analytics
6 changes: 4 additions & 2 deletions pkgs/dash_analytics/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: dash_analytics
description: A package for logging analytics for all dash related tooling to Google Analytics
description: >-
A package for logging analytics for all dash related tooling to Google
Analytics.
version: 0.1.0
repository: https://github.com/dart-lang/tools
repository: https://github.com/dart-lang/tools/tree/main/pkgs/dash_analytics

environment:
sdk: '>=2.19.0 <3.0.0'
Expand Down
9 changes: 4 additions & 5 deletions pkgs/dash_analytics/test/dash_analytics_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ import 'dart:io' as io;
import 'dart:math';

import 'package:clock/clock.dart';
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:test/test.dart';
import 'package:yaml/yaml.dart';

import 'package:dash_analytics/dash_analytics.dart';
import 'package:dash_analytics/src/config_handler.dart';
import 'package:dash_analytics/src/constants.dart';
import 'package:dash_analytics/src/session.dart';
import 'package:dash_analytics/src/user_property.dart';
import 'package:dash_analytics/src/utils.dart';
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:test/test.dart';
import 'package:yaml/yaml.dart';

Comment on lines 15 to 20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I had these import statements within my repo, it recognized that the imports for package:... were separate from package:dash_analytics/... but it seems that it treats them the same now and combines them into one block. I imagine this because of the new structure?

https://github.com/eliasyishak/dash_analytics/blob/main/test/dash_analytics_test.dart#L9-L20

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that's odd - what were you using to sort the imports?

Here, I used the 'organize imports' command (from vs-code, via the analysis server). That will just treat all package: imports the same (sorting dart:, package:, then file imports, and breaking them into separate groups).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also used the same command via VS Code, but just adding here for clarity but it seems like the root folder for VS Code affects how it organizes imports within the test directory. When making root tools/ it doesn't recognize that package:... and 'package:dash_analytics/...is different. But when you make your roottools/pkgs/dash_analytics` it properly separates them.

Could have to do with how the analysis server is determining which directory is the source directory for a given package.

void main() {
late FileSystem fs;
Expand Down