Skip to content

Commit

Permalink
Linting Action Runner (#1)
Browse files Browse the repository at this point in the history
* πŸ‘· Testing Action Runner

This is a test push to test the github action runner does what it should. Currently it should fail on two linting issues if everything works as expected.

* πŸ’š Linting runner works

Linting runner is working as expected

* πŸ‘· Linting runner shouldn't hang...

* πŸ’š Removed Caching entirely
  • Loading branch information
MountVesuvius authored Aug 28, 2024
1 parent 0af1b71 commit 2c8263b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 43 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Project Linting

on:
push:
branches:
- '**'

jobs:
lint:
name: Run golangci-lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
- name: Run golangci-lint
run: |
golangci-lint run
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tmp/*
TODO.md
43 changes: 2 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,44 +87,5 @@ Will place the controller template structure here when I've built the template f
### Services
Will place the service template structure here when I've built the template file.

---

Current Dev tasks
straight coding tasks:
- [x] dockerfile written
- [x] docker compose together
- [x] setup connection between postgres and backend using gorm
- [x] basic user model to test jwt auth
- [x] connected Air to have hot reloading during development
- [x] signing jwt access and refresh tokens
- [x] writing the authentication middleware
- [x] roles for users
- [x] refresh access token
- [x] middleware auth for multiple roles
- [ ] Rate limiting?
- [ ] only https traffic
- [ ] setup CORS (Cross Origin Resource Sharing)
- [ ] possible look into CSRF (Cross Site Request Forgery)
- [ ] setup swagger api documentation
- [ ] possibly some sort of health checks (not sure what to really do here)
- [ ] setup a query caching example
- [ ] background job queue?? (not sure if this fits here...)
- [ ] better api versioning (put a system in place)
- [ ] figure out how to serve static files (will need a cdn (content delivery network) for that)
- [ ] rate limiting?
- [ ] figure out how unit tests
- [ ] write the runner for the automated unit tests

coding but still vague
- [ ] write the service & controller template we will use for each part of the project

research
- [ ] doing some additional research on bcrypt cost (i’m a little worried about it)

doco
- [x] writing a quickstart guide
- [ ] writing doco for all of this

possibly...
- [ ] middleware logging for all requests (ISO9001, ISO27001)
- [ ] metadata that is attached with calls (100% needed just need to think about it a bit more) db column
## Testing the Project
Linting is done using `golangci-lint run`, which will show all the errors in the project. There is also an action runner that will do the same, but ideally the linting should be run locally first before the runner has to pick it up.
5 changes: 4 additions & 1 deletion initialize/sync-database.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ import "github.com/MountVesuvius/go-gin-postgres-template/models"

// Auto migrate the table
func SyncDatabase() {
DB.AutoMigrate(&models.User{})
err := DB.AutoMigrate(&models.User{})
if err != nil {
panic("Failed to sync the database")
}
}
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ func main() {
router := gin.Default()
routes.User(router, userController, jwtService)
routes.Auth(router, jwtService)
router.Run()

routerErr := router.Run()
if routerErr != nil {
log.Fatal("Router has not started", err)
}
}

0 comments on commit 2c8263b

Please sign in to comment.