From f44b6b3eb82c776c53cfa109002174c18899c630 Mon Sep 17 00:00:00 2001 From: Ved Date: Sun, 5 Jun 2022 02:54:21 +0300 Subject: [PATCH] CI: Add build & lint workflows --- .github/workflows/dotnet.yml | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/dotnet.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..e7c33e8 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,45 @@ +name: .NET CI + +on: + workflow_dispatch: + push: + branches: + - master + pull_request: +jobs: + build: + runs-on: ubuntu-latest + name: Build + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0' + include-prerelease: True + + - name: Build + run: dotnet build + + linter: + name: dotnet format + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + # Full git history is needed to get a proper list of changed files + fetch-depth: 0 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0' + include-prerelease: True + + - name: Lint Changed Files + run: | + mapfile -t files < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep '.*\.cs$') + if [ ${#files[@]} -ne 0 ]; then dotnet format --verify-no-changes --include "${files[@]}"; fi