Skip to content

Fix Type.Is() for various open generic types #510

Fix Type.Is() for various open generic types

Fix Type.Is() for various open generic types #510

Workflow file for this run

#
# GitHub Actions workflow: Builds and tests the code in this repository.
#
# For more details on workflows, see README.md.
#
# NOTES:
#
# * We don't use CodeQL because it takes, at the time of writing, 3 minutes to run which is
# 3x the time of the "build-and-test" job. Since we already have the Microsoft Code Analysis
# enabled, I don't expect CodeQL to offer much advantages (especially compared to the time it
# takes to execute).
#
name: Continuous Integration
# When to run this workflow
#
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
# See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
#
# TIP: Don't use "schedule" triggers as this will cause the workflow to be disabled after 60 days of inactivity
# (and afterward the workflow must be manually reenabled).
on:
# Trigger the workflow on push to the main branch.
push:
branches:
- main
# Trigger the workflow for any pull requests.
pull_request:
# Allow manual run of this workflow (https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow)
workflow_dispatch:
# Permissions for GITHUB_TOKEN for this workflow.
#
# See: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
#
# NOTE: Because we run with minimal permissions, we use "@vX" (instead of "@hash") for non-GitHub steps below.
# Usually you would use "@hash" as a security measure to pin a specific version. However, since we run with
# minimal permissions here, malicious code can't do much harm (most likely). For more details, see:
# https://blog.gitguardian.com/github-actions-security-cheat-sheet/#use-specific-action-version-tags
permissions:
contents: read
env:
DOTNET_VERSION: '8.0'
# NOTE: Jobs run in parallel by default.
# https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow
jobs:
#
# Build & Test job
#
build-and-test:
# Name of the job
name: Build & Test
# Set the type of machine to run on
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
runs-on: ubuntu-latest
steps:
###########################################################################
#
# Setup Steps
#
###########################################################################
# See: https://github.com/marketplace/actions/checkout
- name: Clone Git repository
uses: actions/checkout@v4
with:
lfs: true
submodules: true
# This creates ${{ steps.short-sha.outputs.sha }} to be used below.
# See: https://github.com/marketplace/actions/short-sha
- name: Determine Git short commit hash
id: short-sha
uses: benjlevesque/short-sha@v3.0
# See: https://github.com/marketplace/actions/setup-net-core-sdk
- name: Setup .NET build environment
uses: actions/setup-dotnet@v4
with:
# NOTE: Apparently only the 3rd component can be "x"; i.e. "5.x" is not supported.
dotnet-version: '${{ env.DOTNET_VERSION }}.x'
###########################################################################
#
# Build Steps
#
###########################################################################
# See: https://docs.microsoft.com/de-de/dotnet/core/tools/dotnet-build
# NOTE: Without specifying a solution file, "dotnet build" searches for a .sln file in the current directory.
- name: Build code
run: dotnet build --configuration Release
# See: https://docs.microsoft.com/de-de/dotnet/core/tools/dotnet-test
# NOTES:
# * Without specifying a solution file, "dotnet test" searches for a .sln file in the current directory.
# * There seems to be no way to name the .trx file as '<project>.trx'. If no 'LogFileName' is specified,
# the .trx files will be named something like "_fv-az278-737_2021-08-15_03_50_33.trx".
# * The Option 'TreatNoTestsAsError' is documented here: https://learn.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2022#runconfiguration-element
- name: Run tests
id: run_tests
run: dotnet test --configuration Release --no-restore --no-build --logger "trx;LogFileName=${{ runner.os }}.trx" --nologo -- RunConfiguration.TreatNoTestsAsError=true
env:
# Tells tests that they're running in a (potentially slow) CI environment.
RUNS_IN_CI: true
###########################################################################
#
# Archive Steps
#
###########################################################################
# See: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload test results
uses: actions/upload-artifact@v4
# Run this step even if "run_tests" has failed (but not if any other previous step has failed - which would
# be "failure()" - because in this case the tests have not run and thus no .trx files have been generated).
# See: https://docs.github.com/en/actions/learn-github-actions/expressions#failure
if: success() || steps.run_tests.conclusion == 'failure'
with:
# NOTE: To make the downloads of the test results easier to use (i.e. when downloading test results
# from different runs), we'll add an id to the name.
#
# We don't just use the sha because this workflow also runs on a schedule - which means that different
# runs would again create files with the same name (e.g. two consecutive scheduled runs while the
# repo hasn't changed in the meantime).
#
# Instead we use 'github.run_number' because this gives us the same number that's also shown in the
# ui - like 27 for run #27 ('github.run_id' on the other hand gives us some "random" big number like
# 1152888876 - which is less useful). For more details, see:
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
#
# NOTE: We put the "run_number" first so that the result zip file can be sorted by name.
name: 'test-results-#${{ github.run_number }}-${{ steps.short-sha.outputs.sha }}-${{ runner.os }}'
path: '**/*.trx'
if-no-files-found: error
#
# Create action test report
#
# NOTE: This is a separate job (from 'build-and-test') because it needs special write permissions.
#
test-report:
# Name of the job
name: Test Report
needs: build-and-test
# Set the type of machine to run on
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
runs-on: ubuntu-latest
permissions:
actions: read
checks: write
steps:
# See: https://github.com/marketplace/actions/test-reporter
- name: Create test report
# For pinned versions, see: https://blog.gitguardian.com/github-actions-security-cheat-sheet/#use-specific-action-version-tags
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # version 1.9.1
with:
# NOTE: We add the 'github.run_number' to the name so that we can easier identify the
# test report if they pile up due to bug https://github.com/dorny/test-reporter/issues/67.
# See top of this file for more details.
name: 'Test Report #${{ github.run_number }}'
# The name of the artifact (minus extension) created by the CI workflow.
artifact: /test-results-(.*)/
# Path to test results (inside artifact .zip)
path: '**/*.trx'
# Format of test results
reporter: dotnet-trx
# Don't mark the test report generated as failed if there's a failed test.
# Only mark it as failed if something with the workflow has actually gone wrong.
fail-on-error: false
# Workaround for error 'fatal: not a git repository' caused by a call to 'git ls-files'
# (This is because this job doesn't checkout any git repository.)
# See: https://github.com/dorny/test-reporter/issues/169#issuecomment-1583560458
max-annotations: 0
#
# Publish Online Documentation
#
# NOTE: This is a separate job (from 'build-and-test') because it needs special write permissions.
#
documentation:
# Name of the job
name: Publish Documentation
# Only run this on the 'main' branch.
if: github.ref == 'refs/heads/main'
# Set the type of machine to run on
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
runs-on: ubuntu-latest
permissions:
# This job needs permissions to push changes to the "retype" branch. Thus, it needs "write" permission.
contents: write
steps:
###########################################################################
#
# Setup Steps
#
###########################################################################
# See: https://github.com/marketplace/actions/checkout
- name: Clone Git repository
uses: actions/checkout@v4
with:
lfs: true
submodules: false # not needed
###########################################################################
#
# Build Steps
#
###########################################################################
# See: https://github.com/retypeapp/action-build
- name: Build HTML files
# For pinned versions, see: https://blog.gitguardian.com/github-actions-security-cheat-sheet/#use-specific-action-version-tags
uses: retypeapp/action-build@a95ca1f9508dec8465a93f2e50a1228d22e90f4e # version 3.5.0
# See: https://github.com/retypeapp/action-github-pages
- name: Publish HTML files to GitHub Pages
# For pinned versions, see: https://blog.gitguardian.com/github-actions-security-cheat-sheet/#use-specific-action-version-tags
uses: retypeapp/action-github-pages@5a952a4f53fc7366288db464ec120f755e9f1303 # version 3.5.0
with:
# The branch where the results are stored
branch: retype
# Update the "retype" branch (instead of creating a new branch)
update-branch: true