Run Tests #237
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
schedule: | |
- cron: "0 0 1 * *" # Run Monthly | |
jobs: | |
run_tests: | |
name: Run Tests - Dart ${{ matrix.sdk }} - ${{ matrix.os }} | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
working-directory: copy_with_extension_gen | |
strategy: | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
sdk: | |
- stable | |
- beta | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Dart | |
uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: ${{ matrix.sdk }} | |
- name: Dart Info | |
run: | | |
dart --disable-analytics | |
dart --version | |
- name: Pub Get - copy_with_extension_gen | |
run: dart pub get | |
- name: Pub Get - copy_with_extension | |
run: dart pub get | |
working-directory: copy_with_extension | |
- name: Execute build_runner | |
run: dart run build_runner build --delete-conflicting-outputs | |
- name: Analyze | |
uses: zgosalvez/github-actions-analyze-dart@v1 | |
- name: Run tests | |
run: dart run test | |
- name: Check formatting | |
run: dart format --set-exit-if-changed ../ | |
- name: Check Outdated Packages - copy_with_extension_gen | |
if: matrix.sdk == 'stable' && matrix.os == 'ubuntu-latest' | |
run: | | |
warning_msg=`dart pub outdated` | |
warning_formatted=${warning_msg//$'\n'/} | |
if [[ $warning_formatted =~ "constrained" ]]; then | |
echo $warning_msg | |
echo -n "::warning ::$warning_formatted" | |
fi | |
- name: Check Outdated Packages - copy_with_extension | |
working-directory: copy_with_extension | |
if: matrix.sdk == 'stable' && matrix.os == 'ubuntu-latest' | |
run: | | |
warning_msg=`dart pub outdated` | |
warning_formatted=${warning_msg//$'\n'/} | |
if [[ $warning_formatted =~ "constrained" ]]; then | |
echo $warning_msg | |
echo -n "::warning ::$warning_formatted" | |
fi | |
- name: Check Score - copy_with_extension_gen | |
if: matrix.sdk == 'stable' && matrix.os == 'ubuntu-latest' | |
uses: axel-op/dart-package-analyzer@v3 | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
relativePath: copy_with_extension_gen | |
- name: Check Score - copy_with_extension | |
if: matrix.sdk == 'stable' && matrix.os == 'ubuntu-latest' | |
uses: axel-op/dart-package-analyzer@v3 | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
relativePath: copy_with_extension | |
- name: Check Files Are in Sync | |
if: matrix.sdk == 'stable' && matrix.os == 'ubuntu-latest' | |
run: | | |
cmp -s example/example.dart ../copy_with_extension/example/example.dart || (echo "::error ::File example.dart is out of sync" && exit 1) | |
cmp -s LICENSE ../copy_with_extension/LICENSE || (echo "::error ::File LICENSE is out of sync" && exit 1) | |
cmp -s CHANGELOG.md ../copy_with_extension/CHANGELOG.md || (echo "::warning ::File CHANGELOG.md is out of sync") |