fix: handle types without a namespace or assembly in reside-in checks #2101
Workflow file for this run
This file contains hidden or 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: build | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| merge_group: | |
| types: [checks_requested] | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup mise | |
| uses: jdx/mise-action@3c2e0cf82a5b2e5249f0d3635a4d83d0ae861518 # v4.2.5 | |
| with: | |
| cache: false | |
| - name: Check formatting and lint | |
| run: mise run check | |
| coverage: | |
| name: Check code coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup mise | |
| uses: jdx/mise-action@3c2e0cf82a5b2e5249f0d3635a4d83d0ae861518 # v4.2.5 | |
| with: | |
| cache: false | |
| - name: Run tests | |
| run: dotnet test -c Debug --collect:"XPlat Code Coverage" --settings coverlet.runsettings ArchUnitNETTests/ | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| run-tests: | |
| name: Run tests | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup mise | |
| uses: jdx/mise-action@3c2e0cf82a5b2e5249f0d3635a4d83d0ae861518 # v4.2.5 | |
| with: | |
| cache: false | |
| - name: Run tests | |
| run: dotnet test -c Debug | |
| publish-docs: | |
| name: Publish documentation | |
| runs-on: ubuntu-latest | |
| needs: | |
| - lint | |
| - coverage | |
| - run-tests | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| path: ./current | |
| persist-credentials: false | |
| - name: Checkout gh-pages branch | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: gh-pages | |
| path: ./docs | |
| # Credentials are needed here: the later "Commit and push changes" / | |
| # "Update readthedocs preview" steps push to this checkout. | |
| persist-credentials: true # zizmor: ignore[artipacked] | |
| - name: Setup doxygen | |
| run: sudo apt-get install doxygen graphviz | |
| - name: Setup environment | |
| run: | | |
| if [[ "$GITHUB_REF" =~ ^"refs/tags/"[0-9]+.[0-9]+.[0-9]+$ ]]; then | |
| docs_subpath="stable" | |
| else | |
| if [[ "$GITHUB_REF" =~ ^"refs/tags/"[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+$ ]]; then | |
| docs_subpath="preview" | |
| else | |
| docs_subpath="latest" | |
| fi | |
| fi | |
| echo "DOCS_TEMP_DIR_SUBPATH=$docs_subpath" >> "$GITHUB_ENV" | |
| echo "DOCS_OUTPUT_DIR=$GITHUB_WORKSPACE/docs/$docs_subpath" >> "$GITHUB_ENV" | |
| - name: Generate documentation | |
| working-directory: ./current/documentation | |
| env: | |
| DOCS_OUTPUT_DIR: ${{ env.DOCS_OUTPUT_DIR }} | |
| run: | | |
| set -eo pipefail | |
| rm -rf "$DOCS_OUTPUT_DIR" | |
| doxygen | |
| touch .nojekyll | |
| - name: Check release conditions | |
| run: | | |
| if [[ "$GITHUB_REF" =~ ^"refs/tags/"[0-9]+.[0-9]+.[0-9]+(-[a-z]+.[0-9]+)?|"refs/heads/main"$ ]]; then | |
| echo "CREATE_RELEASE=true" >> "$GITHUB_ENV" | |
| else | |
| echo "CREATE_RELEASE=false" >> "$GITHUB_ENV" | |
| fi | |
| - name: Commit and push changes | |
| if: env.CREATE_RELEASE == 'true' | |
| working-directory: ./docs | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "publish-docs@github.com" | |
| git add -A | |
| if [[ "$(git status --porcelain)" ]]; then | |
| git commit -m "Update documentation for $GITHUB_REF_NAME" | |
| git push | |
| else | |
| echo "No changes to commit" | |
| fi | |
| - name: Update readthedocs preview | |
| if: env.CREATE_RELEASE == 'true' && env.DOCS_TEMP_DIR_SUBPATH == 'preview' | |
| working-directory: ./docs | |
| run: | | |
| git fetch origin preview | |
| git checkout preview | |
| git reset --hard "$GITHUB_REF" | |
| git push origin --force-with-lease | |
| build-packages: | |
| name: Build and pack packages | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup mise | |
| uses: jdx/mise-action@3c2e0cf82a5b2e5249f0d3635a4d83d0ae861518 # v4.2.5 | |
| with: | |
| cache: false | |
| - name: Build | |
| run: dotnet build -c Release | |
| - name: Pack | |
| run: | | |
| if ("$env:GITHUB_EVENT_NAME" -eq "release") { | |
| $semver = "$env:GITHUB_REF_NAME" | |
| if ($semver -match '^(\d+)\.(\d+)\.\d+') { | |
| $major = $matches[1] | |
| $minor = $matches[2] | |
| $packageVersion = "$env:GITHUB_REF_NAME" | |
| $assemblyVersion = "$major.$minor.0.0" | |
| } else { | |
| throw "Invalid semver format" | |
| } | |
| } else { | |
| # Placeholder version for non-release builds; never used for a real release. | |
| $packageVersion = "0.0.0-ci" | |
| $assemblyVersion = "0.0.0.0" | |
| } | |
| Write-Host "Package version: $packageVersion" | |
| Write-Host "Assembly version: $assemblyVersion" | |
| dotnet pack -c Release --output nupkgs -p:PackageVersion=$packageVersion -p:AssemblyVersion=$assemblyVersion | |
| - name: Upload package artifact | |
| if: github.event_name == 'release' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: nupkgs | |
| path: nupkgs/*.nupkg | |
| retention-days: 1 | |
| publish-packages: | |
| name: Publish packages | |
| if: github.event_name == 'release' | |
| needs: | |
| - lint | |
| - coverage | |
| - run-tests | |
| - build-packages | |
| runs-on: windows-latest | |
| environment: deploy | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download package artifact | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: nupkgs | |
| path: nupkgs | |
| - name: NuGet login (OIDC → temp API key) | |
| uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 | |
| id: nuget-login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Push | |
| env: | |
| NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }} | |
| run: dotnet nuget push .\nupkgs\*.nupkg --source https://api.nuget.org/v3/index.json --api-key "$env:NUGET_API_KEY" |