Skip to content

Check if the "lib" directory exists before iterating its sub-tree #565

Check if the "lib" directory exists before iterating its sub-tree

Check if the "lib" directory exists before iterating its sub-tree #565

Workflow file for this run

name: CI
on:
pull_request:
branches: [ main ]
types: [opened, labeled, unlabeled, synchronize]
push:
branches: [ main ]
jobs:
check_label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
if: github.ref != 'refs/heads/main'
with:
mode: exactly
count: 0
labels: "not ready"
get_flutter_version:
needs: check_label
runs-on: ubuntu-latest
outputs:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
steps:
- uses: actions/checkout@v3
- uses: kuhnroyal/flutter-fvm-config-action@v2
id: fvm-config-action
get_last_released_version:
needs: check_label
runs-on: ubuntu-latest
outputs:
last_released_version: ${{ steps.step1.outputs.last_released_version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # we need the tags here
- id: step1
name: Get latest version
run: |
tag=$(git describe --tags --abbrev=0)
version="${tag#releases/}"
version="${version#v}"
echo "last_released_version=${version}" >> $GITHUB_OUTPUT
analysis:
needs: [check_label, get_flutter_version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ needs.get_flutter_version.outputs.flutter-version }}
channel: 'any'
cache-path: '${{ runner.tool_cache }}/flutter-${{ needs.get_flutter_version.outputs.flutter-version }}-any'
- name: Verify formatting
run: dart format --set-exit-if-changed .
- name: Install dependencies
run: dart pub get
- name: Verify Builder have been run
run: |
dart pub run build_runner build --delete-conflicting-outputs
git diff --exit-code HEAD
- name: Analyze project source
run: dart analyze --fatal-infos --fatal-warnings .
semver:
needs: [get_last_released_version, get_flutter_version]
uses: bmw-tech/dart_apitool/.github/workflows/check_version.yml@workflow/v1
with:
runs-on: ubuntu-latest
old: "pub://dart_apitool/${{ needs.get_last_released_version.outputs.last_released_version }}"
new: "."
ignore-prerelease: 'on'
flutter-channel: 'any'
flutter-version: ${{ needs.get_flutter_version.outputs.flutter-version }}
semver-dogfood:
needs: [get_last_released_version, get_flutter_version]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '${{ inputs.flutter-version }}'
channel: '${{ inputs.flutter-channel }}'
cache-path: '${{ runner.tool_cache }}/flutter-${{ needs.get_flutter_version.outputs.flutter-version }}-any'
- name: Install dependencies
run: dart pub get
- name: check version
run: dart bin/main.dart diff --old pub://dart_apitool/${{ needs.get_last_released_version.outputs.last_released_version }} --new . --ignore-prerelease on
test:
needs: [check_label, get_flutter_version]
strategy:
matrix:
platform: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ needs.get_flutter_version.outputs.flutter-version }}
channel: 'any'
cache-path: '${{ runner.tool_cache }}/flutter-${{ needs.get_flutter_version.outputs.flutter-version }}-any'
- name: Install dependencies
run: dart pub get
- name: Run tests
run: dart test
coverage:
needs: [check_label, get_flutter_version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ needs.get_flutter_version.outputs.flutter-version }}
channel: 'any'
cache-path: '${{ runner.tool_cache }}/flutter-${{ needs.get_flutter_version.outputs.flutter-version }}-any'
- name: Install dependencies
run: |
dart pub get
dart pub global activate coverage
dart pub global activate dlcov
- name: Gather coverage
run: |
dart pub global run coverage:test_with_coverage
- name: Check threshold
run: |
dart pub global run dlcov:dlcov -c 75
pana:
needs: [check_label, get_flutter_version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ needs.get_flutter_version.outputs.flutter-version }}
channel: 'any'
cache-path: '${{ runner.tool_cache }}/flutter-${{ needs.get_flutter_version.outputs.flutter-version }}-any'
- name: Install Dependencies
run: |
dart pub get
dart pub global activate pana 0.21.45 #temporary as the latest version 0.22.0 has issues with the dartdoc interface
- name: Verify Pub Score
run: |
dart --version
flutter --version
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
echo "score: $PANA_SCORE"
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1]
if (( $SCORE < $TOTAL )); then echo $PANA; echo "minimum score not met!"; exit 1; fi