Skip to content

Tidy unit tests

Tidy unit tests #2983

# Workflow Syntax: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# Example: https://github.com/github/VisualStudio/blob/263aac11f57d53c5f9fe64ba9916f77c058974d7/.github/workflows/main.yml
# Build and Test (ref. https://docs.github.com/en/actions/guides/building-and-testing-net)
# Note: Github recommends using full commit SHAs when using 3rd party actions
name: Continuous Integration
concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true
env:
build-config: Release
solution: EDDI.sln
# Build artifact variables
build-artifact-name: build-artifact
# Define our triggers
on:
push:
branches:
- '*'
- develop
- '!l10n_develop'
- '!refs/pull/*'
paths-ignore:
- docs/* # Every file in the root docs folder
- '**.html' # HTML files anywhere in the repo
- '**.md' # Markdown files anywhere in the repo
- '**.resx' # RESX files anywhere in the repo
pull_request:
# The branches below must be a subset of the branches above
branches:
- develop
paths-ignore:
- docs/* # Every file in the root docs folder
- '**.html' # HTML files anywhere in the repo
- '**.md' # Markdown files anywhere in the repo
- '**.resx' # RESX files anywhere in the repo
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │ * indicates 'all'
# │ │ │ │ │ Ref. https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule
# │ │ │ │ │
# * * * * *
- cron: '30 2 * * 0' # Runs at 2:30 AM UTC, any day of the month, any month of the year, on Sundays
jobs:
build:
name: Build & Test
runs-on: windows-latest
steps:
- name: Check out the repository on the workflow runner
uses: actions/checkout@v3.1.0
# Build
- name: Add msbuild.exe to PATH
uses: microsoft/setup-msbuild@v1.1.3
- name: Add nuget to PATH
uses: nuget/setup-nuget@fd9fffd6ca4541cf4152a9565835ca1a88a6eb37
with:
nuget-version: 'latest'
- name: Retrieve any cached copies of dependencies (these may be stored for up to a week)
uses: actions/cache@main
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files with embedded PackageReference data
restore-keys: |
${{ runner.os }}-nuget
- name: Restore any missing dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: nuget restore ${{ env.solution }} -NonInteractive
- name: Save our updated cache of dependencies
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files with embedded PackageReference data
- name: Build our solution
id: build
run: msbuild ${{ env.solution }} /p:Configuration=${{ env.build-config }} /p:UseSharedCompilation=false /verbosity:minimal
- name: Upload build artifacts
uses: actions/upload-artifact@v3.1.0
with:
name: ${{ env.build-artifact-name }}
path: ./bin/Release/*
# Perform unit testing
- name: Add VSTest.console.exe to PATH
uses: darenm/Setup-VSTest@d9a5dffa3f11d9c27ec42eb69515d3aaeaad9ef8
- name: Test our solution
uses: ./.github/actions/Test
with:
target-path: vstest.console.exe
target-args: Tests\bin\Release\Tests.dll /tests:UnitTests /Parallel /InIsolation /Blame