From 75a415570dc3d29eb49a694c6e86321353c32aca Mon Sep 17 00:00:00 2001 From: Philip Vu Date: Thu, 19 Sep 2024 22:30:22 -0700 Subject: [PATCH] Separate formatting from unit tests --- .github/actions/setup-dotnet/action.yaml | 6 ++++++ .../{run-tests.yaml => run-checks.yaml} | 21 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) rename .github/workflows/{run-tests.yaml => run-checks.yaml} (68%) diff --git a/.github/actions/setup-dotnet/action.yaml b/.github/actions/setup-dotnet/action.yaml index ae69af7..4c0eb0d 100644 --- a/.github/actions/setup-dotnet/action.yaml +++ b/.github/actions/setup-dotnet/action.yaml @@ -1,6 +1,11 @@ name: "Setup .NET" description: | Installs .NET and restores dependencies. +inputs: + build: + description: "Whether to build the project after restoring dependencies" + required: false + default: true runs: using: composite @@ -22,6 +27,7 @@ runs: shell: bash - name: Build Project + if: ${{ inputs.build }} run: dotnet build --configuration Release --no-restore working-directory: ./ shell: bash \ No newline at end of file diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-checks.yaml similarity index 68% rename from .github/workflows/run-tests.yaml rename to .github/workflows/run-checks.yaml index cd5e6ae..7b81906 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-checks.yaml @@ -1,7 +1,7 @@ env: GIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} -name: "C#/.NET Unit Tests" +name: "C#/.NET Checks" on: pull_request: types: [labeled, opened, synchronize, reopened, auto_merge_enabled] @@ -21,10 +21,23 @@ jobs: - name: Setup .NET uses: ./.github/actions/setup-dotnet - - name: Check Formatting - uses: ./.github/actions/check-formatting - - name: Run Tests run: dotnet test --no-restore --verbosity normal working-directory: ./Aptos.Tests shell: bash + + run-format-check: + name: Check Formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ env.GIT_SHA }} + + - name: Setup .NET + uses: ./.github/actions/setup-dotnet + with: + build: false + + - name: Check Formatting + uses: ./.github/actions/check-formatting