Skip to content

Commit 8aae329

Browse files
FEATURE (checks): Add linters & formatters checks on each PR
1 parent cbf502c commit 8aae329

File tree

3 files changed

+70
-3
lines changed

3 files changed

+70
-3
lines changed

.github/workflows/docker.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,75 @@ on:
66
workflow_dispatch: {}
77

88
jobs:
9+
lint-backend:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: "1.23.3"
19+
20+
- name: Cache Go modules
21+
uses: actions/cache@v4
22+
with:
23+
path: |
24+
~/go/pkg/mod
25+
~/.cache/go-build
26+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-
29+
30+
- name: Install golangci-lint
31+
run: |
32+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3
33+
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
34+
35+
- name: Run golangci-lint
36+
run: |
37+
cd backend
38+
golangci-lint run
39+
40+
- name: Verify go mod tidy
41+
run: |
42+
cd backend
43+
go mod tidy
44+
git diff --exit-code go.mod go.sum || (echo "go mod tidy made changes, please run 'go mod tidy' and commit the changes" && exit 1)
45+
46+
lint-frontend:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Check out code
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: "20"
56+
cache: "npm"
57+
cache-dependency-path: frontend/package-lock.json
58+
59+
- name: Install dependencies
60+
run: |
61+
cd frontend
62+
npm ci
63+
64+
- name: Check if prettier was run
65+
run: |
66+
cd frontend
67+
npm run format
68+
git diff --exit-code || (echo "Prettier made changes, please run 'npm run format' and commit the changes" && exit 1)
69+
70+
- name: Check if linter was run
71+
run: |
72+
cd frontend
73+
npm run lint
74+
975
docker:
1076
runs-on: ubuntu-latest
77+
needs: [lint-backend, lint-frontend]
1178

1279
steps:
1380
- name: Check out code

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
154154

155155
## 🤝 Contributing
156156

157-
Contributions are welcome! Read [contributing guide](contribute/readme.md) for more details, prioerities and rules are specified there. If you want to contribute, but don't know what and how - message me on Telegram [@rostislavdugin](https://t.me/rostislavdugin)
157+
Contributions are welcome! Read [contributing guide](contribute/readme.md) for more details, prioerities and rules are specified there. If you want to contribute, but don't know what and how - message me on Telegram [@rostislav_dugin](https://t.me/rostislav_dugin)

contribute/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ Notifications flow:
6565

6666
Extra:
6767

68-
- add linters and formatters on each PR (in progress by Rostislav Dugin)
68+
- add versioning instead of :latest (in progress by Rostislav Dugin)
69+
- add tests running on each PR
6970
- add prettier labels to GitHub README
70-
- add versioning instead of :latest
7171
- create pretty website like rybbit.io with demo
7272
- add HTTPS for Postgresus
7373
- add simple SQL queries via UI

0 commit comments

Comments
 (0)