#3175 Moving usings to GlobalUsing.cs (#3186) #4048
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
name: Tests | |
# Controls when the workflow will run | |
on: | |
pull_request: | |
branches: [ main, main-vnext ] | |
push: | |
branches: [ main, main-vnext ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
unit-test: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: Restore Dotnet tools | |
run: dotnet tool restore | |
working-directory: src/ | |
- name: Restore dependencies | |
run: dotnet restore IoTHub.Portal.sln | |
working-directory: src/ | |
- name: Build | |
run: dotnet build IoTHub.Portal.sln --no-restore -p:ClientAssetsRestoreCommand="npm ci" | |
working-directory: src/ | |
- name: Run unit tests | |
run: dotnet test --no-build --verbosity normal --logger trx --collect:"XPlat Code Coverage" IoTHub.Portal.Tests.Unit.csproj | |
working-directory: src/IoTHub.Portal.Tests.Unit/ | |
# Upload test results as artifact | |
- uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: test-results | |
path: | | |
src/IoTHub.Portal.Tests.Unit/TestResults | |
codecov: | |
name: Codecov | |
runs-on: ubuntu-latest | |
needs: unit-test | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/download-artifact@v4 | |
with: | |
name: test-results | |
path: | | |
src/IoTHub.Portal.Tests.Unit/TestResults | |
- name: Upload to Codecov test reports | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: src/IoTHub.Portal.Tests.Unit/TestResults | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
#e2e-tests: | |
# name: E2E tests | |
# runs-on: ubuntu-latest | |
# environment: E2E | |
# steps: | |
# - uses: actions/[email protected] | |
# - name: Setup .NET | |
# uses: actions/setup-dotnet@v4 | |
# with: | |
# dotnet-version: 7.0.x | |
# - name: Launch the portal locally | |
# uses: isbang/[email protected] | |
# with: | |
# compose-file: "./src/e2e-docker-compose.yml" | |
# down-flags: "--volumes" | |
# up-flags: "--build" | |
# env: | |
# GITHUB_RUN_NUMBER: ${{ github.run_number }} | |
# CLOUDPROVIDER: ${{ Azure }} | |
# PORTALNAME: ${{ vars.PORTALNAME }} | |
# OIDC__VALIDATEAUDIENCE: ${{ vars.OIDC__VALIDATEAUDIENCE }} | |
# OIDC__SCOPE: ${{ vars.OIDC__SCOPE }} | |
# OIDC__METADATAURL: ${{ vars.OIDC__METADATAURL }} | |
# OIDC__CLIENTID: ${{ vars.OIDC__CLIENTID }} | |
# OIDC__AUTHORITY: ${{ vars.OIDC__AUTHORITY }} | |
# OIDC__APICLIENTID: ${{ vars.OIDC__APICLIENTID }} | |
# LORAFEATURE_ENABLED: ${{ vars.LORAFEATURE_ENABLED }} | |
# AZURE_STORAGEACCOUNT__BLOBCONTAINERNAME: ${{ vars.STORAGEACCOUNT__BLOBCONTAINERNAME }} | |
# AZURE_LORAKEYMANAGEMENT__URL: ${{ vars.LORAKEYMANAGEMENT__URL }} | |
# AZURE_IOTHUB__EVENTHUB__CONSUMERGROUP: ${{ vars.IOTHUB__EVENTHUB__CONSUMERGROUP }} | |
# AZURE_IOTDPS__SERVICEENDPOINT: ${{ vars.IOTDPS__SERVICEENDPOINT }} | |
# AZURE_IOTDPS__IDSCOPE: ${{ vars.IOTDPS__IDSCOPE }} | |
# AZURE_IDEAS__URL: ${{ vars.IDEAS__URL }} | |
# AZURE_IDEAS__ENABLED: ${{ vars.IDEAS__ENABLED }} | |
# AZURE_IDEAS__AUTHENTICATION__HEADER: ${{ vars.IDEAS__AUTHENTICATION__HEADER }} | |
# POSTGRESQL__CONNECTIONSTRING: ${{ secrets.POSTGRESQL__CONNECTIONSTRING }} | |
# JOBSTORE__CONNECTIONSTRING: ${{ secrets.JOBSTORE__CONNECTIONSTRING }} | |
# AZURE_IOTHUB__EVENTHUB__ENDPOINT: ${{ secrets.IOTHUB__EVENTHUB__ENDPOINT }} | |
# AZURE_LORAKEYMANAGEMENT__CODE: ${{ secrets.LORAKEYMANAGEMENT__CODE }} | |
# AZURE_IOTHUB__CONNECTIONSTRING: ${{ secrets.IOTHUB__CONNECTIONSTRING }} | |
# AZURE_IOTDPS__CONNECTIONSTRING: ${{ secrets.IOTDPS__CONNECTIONSTRING }} | |
# AZURE_STORAGEACCOUNT__CONNECTIONSTRING: ${{ secrets.STORAGEACCOUNT__CONNECTIONSTRING }} | |
# IDEAS__AUTHENTICATION__TOKEN: ${{ secrets.IDEAS__AUTHENTICATION__TOKEN }} | |
# - name: Wait until portal is up | |
# run: | | |
# while ! nc -z localhost 80 </dev/null; do sleep 10; done | |
# shell: bash | |
# - name: Install Chrome Driver | |
# run: | | |
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
# echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list | |
# sudo apt-get update | |
# sudo apt-get install google-chrome-stable | |
# LATEST_CHROMEDRIVER=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE) | |
# wget -q -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/${LATEST_CHROMEDRIVER}/chromedriver_linux64.zip" | |
# sudo unzip -q /tmp/chromedriver.zip -d /usr/local/bin/ | |
# sudo chmod +x /usr/local/bin/chromedriver | |
# - name: Install Chrome | |
# run: sudo apt-get install google-chrome-stable | |
# - name: Run E2E tests | |
# run: dotnet test IoTHub.Portal.Tests.E2E.csproj | |
# working-directory: src/IoTHub.Portal.Tests.E2E/ | |
# env: | |
# E2E_USERNAME: ${{ vars.E2E_USERNAME }} | |
# E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }} | |
# E2E_URL: http://localhost:80/ | |
# - name: Get docker logs | |
# run: | | |
# docker logs src_portal_1 | |
# shell: bash | |
# if: always() |