Skip to content

Commit

Permalink
chore: update pipeline workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Andrews <[email protected]>
  • Loading branch information
ABC2015 committed Dec 14, 2024
1 parent 7b27b78 commit aa0f76b
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions .github/workflows/validation-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,52 +85,52 @@ jobs:
fi
validate-dart-sdk-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Validate Dart SDK versions in all pubspec.yaml files
run: |
echo "Validating Dart SDK versions in all pubspec.yaml files..."
# Find all pubspec.yaml files (recursively)
PUBSPEC_FILES=$(find . -name "pubspec.yaml")
echo "Found the following pubspec.yaml files:"
echo "$PUBSPEC_FILES"
# Define the minimum required Dart SDK version
MINIMUM_VERSION="3.5.4"
ALL_VALID="true"
# Iterate over each pubspec.yaml file
for PUBSPEC in $PUBSPEC_FILES; do
echo "Checking $PUBSPEC..."
# Extract the Dart SDK version in the ^<version> format
SDK_VERSION=$(grep -Po '(?<=sdk:\s\^)[0-9]+\.[0-9]+\.[0-9]+' "$PUBSPEC" || echo "not_found")
echo "Extracted Dart SDK version from $PUBSPEC: $SDK_VERSION"
# Validate the extracted version
if [ "$SDK_VERSION" = "not_found" ]; then
echo "❌ Failed to extract Dart SDK version from $PUBSPEC. Ensure the file contains a valid 'sdk: ^<version>' entry."
ALL_VALID="false"
continue
fi
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

# Compare the version
if [[ $(echo -e "${SDK_VERSION}\n${MINIMUM_VERSION}" | sort -V | head -n1) != "$MINIMUM_VERSION" ]]; then
echo "❌ Dart SDK version in $PUBSPEC must be at least $MINIMUM_VERSION, found $SDK_VERSION"
ALL_VALID="false"
- name: Validate Dart SDK versions in all pubspec.yaml files
run: |
echo "Validating Dart SDK versions in all pubspec.yaml files..."
# Find all pubspec.yaml files (recursively)
PUBSPEC_FILES=$(find . -name "pubspec.yaml")
echo "Found the following pubspec.yaml files:"
echo "$PUBSPEC_FILES"
# Define the minimum required Dart SDK version
MINIMUM_VERSION="3.5.4"
ALL_VALID="true"
# Iterate over each pubspec.yaml file
for PUBSPEC in $PUBSPEC_FILES; do
echo "Checking $PUBSPEC..."
# Extract the Dart SDK version in the ^<version> format
SDK_VERSION=$(grep -Po '(?<=sdk:\s\^)[0-9]+\.[0-9]+\.[0-9]+' "$PUBSPEC" || echo "not_found")
echo "Extracted Dart SDK version from $PUBSPEC: $SDK_VERSION"
# Validate the extracted version
if [ "$SDK_VERSION" = "not_found" ]; then
echo "❌ Failed to extract Dart SDK version from $PUBSPEC. Ensure the file contains a valid 'sdk: ^<version>' entry."
ALL_VALID="false"
continue
fi
# Compare the version
if [[ $(echo -e "${SDK_VERSION}\n${MINIMUM_VERSION}" | sort -V | head -n1) != "$MINIMUM_VERSION" ]]; then
echo "❌ Dart SDK version in $PUBSPEC must be at least $MINIMUM_VERSION, found $SDK_VERSION"
ALL_VALID="false"
else
echo "✅ Dart SDK version in $PUBSPEC is satisfactory: $SDK_VERSION"
fi
done
# Exit with failure if any pubspec.yaml file has an invalid version
if [ "$ALL_VALID" != "true" ]; then
echo "❌ One or more pubspec.yaml files have an invalid Dart SDK version."
exit 1
else
echo "✅ Dart SDK version in $PUBSPEC is satisfactory: $SDK_VERSION"
echo "✅ All pubspec.yaml files have a valid Dart SDK version."
fi
done
# Exit with failure if any pubspec.yaml file has an invalid version
if [ "$ALL_VALID" != "true" ]; then
echo "❌ One or more pubspec.yaml files have an invalid Dart SDK version."
exit 1
else
echo "✅ All pubspec.yaml files have a valid Dart SDK version."
fi

0 comments on commit aa0f76b

Please sign in to comment.