Refactor DataverseAPITests class to implement IDisposable interface #38
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
# This is a GitHub Actions workflow for testing customizations implemented around Dataverse using its API. | |
# The workflow is triggered on every push only under the "src/Dataverse.API.Testing" folder to the main branch. | |
# This workflow need to define the following permissions to be able to publish the test results: permissions: contents: read, actions: read and checks: write | |
# | |
# The workflow performs the following steps: | |
# 0. Enable git long paths: It enables long paths in git to avoid the "Filename too long" error. | |
# 1. Setup: It sets up the required environment with .NET 8.0 using "actions/setup-dotnet@v3" | |
# 2. Restore Dependencies: It restores all the dependencies and tools of the .NET solution (.sln) using the 'dotnet restore' command. | |
# 3. Build and Test: It targets a solution to runs API tests using the 'dotnet test' command leveraging the "TENANT_ID", "CLIENT_ID" and "CLIENT_SECRET" GitHub environment secrets and the "DATAVERSE_ENVIRONMENT_URL" environment variable. To be able to analyse the results of the tests, set also the following parameter: --logger "trx;LogFileName=test-results.trx" | |
# 5. Publish Test Results: Use the "dorny/test-reporter@main" GitHub action using the trx file generated by the test command and the "dotnet-trx" reporter to get a nice report of the test results. This step should always be run. | |
name: Dataverse API Testing | |
on: | |
push: | |
paths: | |
- 'src/Dataverse.API.Testing/**' | |
branches: | |
- main | |
permissions: | |
contents: read | |
actions: read | |
checks: write | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
environment: | |
name: 'Sandbox' | |
steps: | |
- name: Enable git long paths | |
run: git config --global core.longpaths true | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore dependencies | |
run: dotnet restore src/Dataverse.API.Testing/Dataverse.API.Testing.sln | |
- name: Build Solution & Run tests | |
run: dotnet test src/Dataverse.API.Testing/Dataverse.API.Testing.sln --logger "trx;LogFileName=test-results.trx" | |
env: | |
DATASERVICE_URL: ${{ vars.DATAVERSE_ENVIRONMENT_URL }} | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
- name: Publish Test Results | |
if: always() | |
uses: dorny/test-reporter@main | |
with: | |
name: Dataverse API Testing | |
path: src/Dataverse.API.Testing/**/*.trx | |
reporter: dotnet-trx |