Skip to content

Commit

Permalink
Skip DataverseAdapter tests unless DataverseAdapter has been changed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad authored Jan 3, 2024
1 parent a421625 commit 26cf814
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,29 @@ jobs:
- name: Create test reporting database
run: docker exec $(docker ps --latest --quiet) /opt/mssql-tools/bin/sqlcmd -U "sa" -P "$MSSQL_PASSWORD" -Q "create database $MSSQL_DB; alter database $MSSQL_DB set ALLOW_SNAPSHOT_ISOLATION on;"

- name: Build
run: dotnet build --configuration Release
working-directory: TeachingRecordSystem/tests/TeachingRecordSystem.Core.Dqt.CrmIntegrationTests
- name: Get test filter
id: test_filter
run: |
# If no DataverseAdapter files (or their tests) have been changed in this PR then filter out related tests
DOTNET_TEST_FILTER=""
git fetch origin main --quiet --depth=1
CHANGED_FILES=$(git diff --name-only origin/main $GITHUB_SHA)
if [[ $(echo "$CHANGED_FILES" | grep -EL "DataverseAdapter") ]]; then
echo "::notice::Skipping DataverseAdapter tests"
DOTNET_TEST_FILTER='--filter "FullyQualifiedName!~TeachingRecordSystem.Core.Dqt.CrmIntegrationTests.DataverseAdapterTests"'
fi
echo filter_arg=$DOTNET_TEST_FILTER >> $GITHUB_OUTPUT
- name: Run tests
uses: ./.github/workflows/actions/test
with:
test_project_path: TeachingRecordSystem/tests/TeachingRecordSystem.Core.Dqt.CrmIntegrationTests
report_name: "DQT test results"
report_name: "DQT integration test results"
dotnet_test_args: >-
--no-build
-e DqtReporting__ReportingDbConnectionString="Data Source=(local); Initial Catalog=${{ env.MSSQL_DB }}; User=sa; Password=${{ env.MSSQL_PASSWORD }}; TrustServerCertificate=True"
-e ConnectionStrings__DefaultConnection="Host=localhost;Username=postgres;Password=trs;Database=trs"
${{ steps.test_filter.outputs.filter_arg }}
config_json: ${{ steps.get_secrets.outputs.INTEGRATION-TEST-CONFIG }}

package:
Expand Down

0 comments on commit 26cf814

Please sign in to comment.