Add unit.tests
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
name: '🌙 Nightly API Spec Tests'
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run every night at 2 AM UTC
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
jobs:
|
||||
api-spec-validation:
|
||||
name: Validate SRF API Spec
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build solution
|
||||
run: dotnet build --no-restore --configuration Release
|
||||
|
||||
- name: Run API Spec Tests
|
||||
id: api_tests
|
||||
run: |
|
||||
dotnet test \
|
||||
--no-build \
|
||||
--configuration Release \
|
||||
--filter "Category=APISpec" \
|
||||
--logger "console;verbosity=detailed" || echo "TESTS_FAILED=true" >> $GITHUB_ENV
|
||||
|
||||
- name: Check Test Results
|
||||
if: always()
|
||||
run: |
|
||||
if [ "$TESTS_FAILED" = "true" ]; then
|
||||
echo "❌ API Spec Tests Failed"
|
||||
echo ""
|
||||
echo "This may indicate:"
|
||||
echo " - SRF Play API has changed"
|
||||
echo " - API endpoints are experiencing issues"
|
||||
echo " - Response schemas have been modified"
|
||||
echo ""
|
||||
echo "Actions needed:"
|
||||
echo " 1. Review the test output above"
|
||||
echo " 2. Check if SRF Play API documentation has been updated"
|
||||
echo " 3. Update API models if the schema has changed"
|
||||
echo " 4. Update tests if they need to be adjusted"
|
||||
echo ""
|
||||
exit 1
|
||||
else
|
||||
echo "✅ All API spec tests passed!"
|
||||
echo "The SRF Play API is working as expected."
|
||||
fi
|
||||
|
||||
- name: Upload Test Logs
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: api-test-failure-logs
|
||||
path: |
|
||||
**/*.trx
|
||||
**/TestResults/
|
||||
retention-days: 30
|
||||
Reference in New Issue
Block a user