Skip to content

Commit

Permalink
Run dotnet format only once per solution in CI (#294)
Browse files Browse the repository at this point in the history
* Don't run dotnet format for the entire CI matrix

* Fix Tsavorite paths

---------

Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
Co-authored-by: darrenge <darrenge@microsoft.com>
Co-authored-by: Tal Zaccai <talzacc@microsoft.com>
  • Loading branch information
4 people authored Apr 23, 2024
1 parent df94b6d commit 8fed778
Showing 1 changed file with 37 additions and 8 deletions.
45 changes: 37 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
changes:
name: Check for changes
runs-on: ubuntu-latest # don't need matrix to test where the changes were made in code
runs-on: ubuntu-latest # don't need matrix to test where the changes were made in code
permissions:
pull-requests: read
contents: read
Expand All @@ -38,10 +38,44 @@ jobs:
garnet:
- '!((*.md)|(website/**))'
format-garnet:
name: Format Garnet
needs: changes
runs-on: ubuntu-latest
if: needs.changes.outputs.garnet == 'true'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore Garnet.sln
- name: Check style format
run: dotnet format Garnet.sln --no-restore --verify-no-changes --verbosity diagnostic

format-tsavorite:
name: Format Tsavorite
needs: changes
runs-on: ubuntu-latest
if: needs.changes.outputs.tsavorite == 'true'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore libs/storage/Tsavorite/cs/Tsavorite.sln
- name: Check style format
run: dotnet format libs/storage/Tsavorite/cs/Tsavorite.sln --no-restore --verify-no-changes --verbosity diagnostic

# Job to build and test Garnet code
build-test-garnet:
name: Garnet
needs: changes
needs: [changes, format-garnet]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -60,8 +94,6 @@ jobs:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore
- name: Check style format
run: dotnet format --verify-no-changes --verbosity diagnostic
- name: Build Garnet
run: dotnet build --configuration ${{ matrix.configuration }}
- name: Run tests ${{ matrix.test }}
Expand All @@ -77,7 +109,7 @@ jobs:
# Job to build and test Tsavorite code (only if there were changes to it)
build-test-tsavorite:
name: Tsavorite
needs: changes
needs: [changes, format-tsavorite]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -110,8 +142,6 @@ jobs:
azurite &
- name: Install dependencies
run: dotnet restore
- name: Format
run: dotnet format --verify-no-changes --verbosity diagnostic
- name: Build Tsavorite
run: dotnet build libs/storage/Tsavorite/cs/test/Tsavorite.test.csproj --configuration ${{ matrix.configuration }}
- name: Run Tsavorite tests
Expand Down Expand Up @@ -151,4 +181,3 @@ jobs:
steps:
- run: echo Done!
if: ${{ !(failure() || cancelled()) }}

0 comments on commit 8fed778

Please sign in to comment.