Skip to content

Commit

Permalink
Update Commit Workflow (#251)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Eein authored Oct 19, 2024
1 parent b520dd1 commit f7e15eb
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 45 deletions.
8 changes: 1 addition & 7 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
"commands": [
"swagger"
]
},
"husky": {
"version": "0.7.0",
"commands": [
"husky"
]
}
}
}
}
23 changes: 23 additions & 0 deletions .github/workflows/lint-backend.yml
Original file line number Diff line number Diff line change
@@ -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 .
6 changes: 2 additions & 4 deletions .github/workflows/test-backend.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions .husky/pre-commit

This file was deleted.

11 changes: 0 additions & 11 deletions .husky/task-runner.json

This file was deleted.

1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions LeaderboardBackend/LeaderboardBackend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,4 @@
<Exec Command="dotnet tool restore"></Exec>
<Exec EnvironmentVariables="EnvPath=../swagger-gen.env;ASPNETCORE_ENVIRONMENT=development" Command="dotnet tool run swagger tofile --output &quot;@(OpenApiFile)&quot; &quot;$(OutputPath)/$(AssemblyName).dll&quot; v1"></Exec>
</Target>

<!-- set HUSKY to 0 in CI/CD disable this -->
<Target Name="husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
<Exec Command="dotnet husky install" WorkingDirectory="../" StandardOutputImportance="Low" StandardErrorImportance="High" />
</Target>

</Project>
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f7e15eb

Please sign in to comment.