Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PACKAGE_NAME=$(yq '.name' pubspec.yaml)

results=$(find ./lib/src -name "*.dart" -exec grep -l "^import ['\"]package:$PACKAGE_NAME/[^/]*.dart" {} +)
results=$(find ./lib/src -name "*.dart" -exec grep -l "^import ['\"]package:$PACKAGE_NAME/[^/]*\.dart" {} +)

if [[ "$results" != "" ]]; then
echo
Expand All @@ -12,4 +12,4 @@ if [[ "$results" != "" ]]; then
echo "::error::Relying on specific files is always preferred over importing the package's entrypoint file"
echo "::error::Please update these to reference specific files in $PACKAGE_NAME, instead of the entrypoint."
exit 1
fi
fi
36 changes: 36 additions & 0 deletions .github/workflows/_test:additional-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 🧪 additional-checks

on:
push:
branches:
- master
pull_request:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why these tests are running?

paths:
- .github/workflows/_test:additional-checks.yaml
- .github/actions/additional-checks/**
- __tests__/fixtures/additional-checks*


permissions:
contents: read
id-token: write

jobs:
ddev-alias:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/additional-checks
with:
package-path: ./__tests__/fixtures/additional-checks
command: ddev --help

no_entrypoint_imports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/additional-checks
with:
package-path: ./__tests__/fixtures/additional-checks
command: no_entrypoint_imports

Empty file.
Empty file.
6 changes: 6 additions & 0 deletions __tests__/fixtures/additional-checks/lib/src/foo.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

/// The following is intentionally commented out, it should not be included
/// in the no_entrypoint_imports check
// import 'package:additional_checks/additional_checks.dart';

import 'package:additional_checks/src/dart/bar.dart';
8 changes: 8 additions & 0 deletions __tests__/fixtures/additional-checks/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: additional_checks
version: 1.0.0
publish_to: none
environment:
sdk: '>=2.10.0 <3.0.0'

dev_dependencies:
dart_dev: ^4.2.4