From f7e15eb919cc6318af3012ab03198e4e67647c2a Mon Sep 17 00:00:00 2001 From: William Volin Date: Sat, 19 Oct 2024 12:55:32 -0700 Subject: [PATCH] Update Commit Workflow (#251) * feat: update commit workflow - removes husky and refs to it - adds workflow dispatch - adds ci runs on pr to main fix json from changing remove package json stuff * feat: split lint and build --- .config/dotnet-tools.json | 8 +------ .github/workflows/lint-backend.yml | 23 ++++++++++++++++++++ .github/workflows/test-backend.yml | 6 ++--- .husky/pre-commit | 5 ----- .husky/task-runner.json | 11 ---------- Dockerfile | 1 - LeaderboardBackend/LeaderboardBackend.csproj | 7 ------ README.md | 10 --------- 8 files changed, 26 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/lint-backend.yml delete mode 100755 .husky/pre-commit delete mode 100644 .husky/task-runner.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 33cf51f2..6e09974e 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -13,12 +13,6 @@ "commands": [ "swagger" ] - }, - "husky": { - "version": "0.7.0", - "commands": [ - "husky" - ] } } -} \ No newline at end of file +} diff --git a/.github/workflows/lint-backend.yml b/.github/workflows/lint-backend.yml new file mode 100644 index 00000000..b6e24a88 --- /dev/null +++ b/.github/workflows/lint-backend.yml @@ -0,0 +1,23 @@ +name: backend-lint +on: + workflow_dispatch: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + backend-test: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Setup dotnet 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0' + - name: Restore NuGet packages + run: dotnet restore + - name: Restore tools + run: dotnet tool restore + - name: Lint + run: dotnet format --verify-no-changes --no-restore . diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 93b90f61..ae38dcaa 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -1,10 +1,10 @@ name: backend-test on: + workflow_dispatch: push: branches: [ main ] pull_request: -env: - HUSKY: 0 + branches: [ main ] jobs: backend-test: runs-on: ubuntu-latest @@ -19,8 +19,6 @@ jobs: run: dotnet restore - name: Restore tools run: dotnet tool restore - - name: Lint - run: dotnet format --verify-no-changes --no-restore . - name: Backup committed openapi.json run: cp LeaderboardBackend/openapi.json /tmp/committed-openapi.json - name: Build diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 9c28df1e..00000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -dotnet husky run --group pre-commit - diff --git a/.husky/task-runner.json b/.husky/task-runner.json deleted file mode 100644 index 1d75e569..00000000 --- a/.husky/task-runner.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "tasks": [ - { - "name": "dotnet-format", - "group": "pre-commit", - "command": "dotnet", - "args": ["format", "--include", "${staged}"], - "include": ["**/*.cs", "**/*.csproj", "**/*.json"] - } - ] -} diff --git a/Dockerfile b/Dockerfile index 99e637f2..881488a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,6 @@ EXPOSE 80 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG DISABLE_OPENAPI_FILE_GEN=true -ARG HUSKY=0 WORKDIR /source # copy csproj and restore as distinct layer that can be cached diff --git a/LeaderboardBackend/LeaderboardBackend.csproj b/LeaderboardBackend/LeaderboardBackend.csproj index 4e493cad..80c6b739 100644 --- a/LeaderboardBackend/LeaderboardBackend.csproj +++ b/LeaderboardBackend/LeaderboardBackend.csproj @@ -72,11 +72,4 @@ - - - - - - - diff --git a/README.md b/README.md index 797bcb3b..f26f0c6e 100644 --- a/README.md +++ b/README.md @@ -16,16 +16,6 @@ The original backend, written in Go and inactive, can be found [here](https://gi # Project Setup -## Setting up Environment - -Firstly, set `core.filemode false` in your git config, either by running `git config core.filemode false` in your terminal, or -``` -[core] - filemode = false -``` -in your `~/.gitconfig` (Windows users may need to do the latter, according to a comment under [this SO answer](https://stackoverflow.com/a/2972113)). This is to prevent committing filemode changes of our pre-commit hook, `.husky/pre-commit` to your PRs. - - ## Editor/IDE There are a couple options available for you to choose, depending on your OS.