refactor: solution structure #19
Workflow file for this run
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: .NET | |
on: | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '.github/workflows/dotnet-build.yml' | |
- '*.props' | |
- '*.sln*' | |
jobs: | |
build: | |
name: Build & Test | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key: ${{ steps.create-cache-key.outputs.key }} | |
permissions: | |
packages: read | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Create cache key | |
id: create-cache-key | |
run: | | |
echo key=${{ runner.os }}-${{ hashFiles('src/**', 'tests/**') }}-test-results >> "$GITHUB_OUTPUT" | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
if: steps.cache-tests.outputs.cache-hit != 'true' | |
with: | |
dotnet-version: 8.0.x | |
- name: Cache nuget packages | |
uses: actions/cache@v3 | |
if: steps.cache-tests.outputs.cache-hit != 'true' | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-${{ hashFiles('**/*.Packages.props', '**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: move nuget config | |
if: steps.cache-tests.outputs.cache-hit != 'true' | |
run: | | |
mkdir .tmp-nuget-config | |
mv NuGet.config .tmp-nuget-config | |
- name: build sources | |
if: steps.cache-tests.outputs.cache-hit != 'true' | |
run: | | |
for csproj in $(find src | grep csproj$) | |
do | |
dotnet build -c Release "$csproj" | |
done | |
- name: move nuget config back | |
if: steps.cache-tests.outputs.cache-hit != 'true' | |
run: | | |
mv .tmp-nuget-config/NuGet.config . | |
rm -rf .tmp-nuget-config | |
- name: validate packages | |
if: steps.cache-tests.outputs.cache-hit != 'true' | |
run: | | |
ls | |
- name: Remove .Reflect tests | |
if: steps.cache-tests.outpust.cache-hit != 'true' | |
run: | | |
dotnet sln SourceKit.sln remove tests/SourceKit.Reflect.Tests/SourceKit.Reflect.Tests.csproj | |
rm -rf tests/SourceKit.Reflect.Tests | |
- name: Test | |
if: steps.cache-tests.outputs.cache-hit != 'true' | |
run: dotnet test -c Debug |