mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: update dev config (#857)
This commit is contained in:
45
.github/workflows/backend-tests.yml
vendored
Normal file
45
.github/workflows/backend-tests.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: Backend Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- "release/v*.*.*"
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
paths-ignore:
|
||||||
|
- "web/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
go-static-checks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: 1.19
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: Verify go.mod is tidy
|
||||||
|
run: |
|
||||||
|
go mod tidy -go=1.19
|
||||||
|
git diff --exit-code
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
|
with:
|
||||||
|
args: -v
|
||||||
|
skip-cache: true
|
||||||
|
|
||||||
|
go-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: 1.19
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: Run all tests
|
||||||
|
run: go test -v ./... | tee test.log; exit ${PIPESTATUS[0]}
|
||||||
|
- name: Pretty print tests running time
|
||||||
|
run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}'
|
@@ -1,4 +1,4 @@
|
|||||||
name: Test
|
name: Frontend Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -7,6 +7,8 @@ on:
|
|||||||
- "release/v*.*.*"
|
- "release/v*.*.*"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- "web/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
eslint-checks:
|
eslint-checks:
|
||||||
@@ -53,36 +55,3 @@ jobs:
|
|||||||
- name: Run frontend build
|
- name: Run frontend build
|
||||||
run: yarn build
|
run: yarn build
|
||||||
working-directory: web
|
working-directory: web
|
||||||
|
|
||||||
go-static-checks:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: 1.19
|
|
||||||
check-latest: true
|
|
||||||
cache: true
|
|
||||||
- name: Verify go.mod is tidy
|
|
||||||
run: |
|
|
||||||
go mod tidy -go=1.19
|
|
||||||
git diff --exit-code
|
|
||||||
- name: golangci-lint
|
|
||||||
uses: golangci/golangci-lint-action@v3
|
|
||||||
with:
|
|
||||||
args: -v
|
|
||||||
skip-cache: true
|
|
||||||
|
|
||||||
go-tests:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: 1.19
|
|
||||||
check-latest: true
|
|
||||||
cache: true
|
|
||||||
- name: Run all tests
|
|
||||||
run: go test -v ./... | tee test.log; exit ${PIPESTATUS[0]}
|
|
||||||
- name: Pretty print tests running time
|
|
||||||
run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}'
|
|
@@ -37,4 +37,4 @@ Memos is built with a curated tech stack. It is optimized for developer experien
|
|||||||
cd web && yarn && yarn dev
|
cd web && yarn && yarn dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Memos should now be running at [http://localhost:3000](http://localhost:3000) and change either frontend or backend code would trigger live reload.
|
Memos should now be running at [http://localhost:3001](http://localhost:3001) and change either frontend or backend code would trigger live reload.
|
||||||
|
@@ -48,7 +48,7 @@ func checkDSN(dataDir string) (string, error) {
|
|||||||
func GetProfile() (*Profile, error) {
|
func GetProfile() (*Profile, error) {
|
||||||
profile := Profile{}
|
profile := Profile{}
|
||||||
flag.StringVar(&profile.Mode, "mode", "dev", "mode of server")
|
flag.StringVar(&profile.Mode, "mode", "dev", "mode of server")
|
||||||
flag.IntVar(&profile.Port, "port", 8080, "port of server")
|
flag.IntVar(&profile.Port, "port", 8081, "port of server")
|
||||||
flag.StringVar(&profile.Data, "data", "", "data directory")
|
flag.StringVar(&profile.Data, "data", "", "data directory")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
@@ -13,22 +13,22 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
port: 3000,
|
port: 3001,
|
||||||
proxy: {
|
proxy: {
|
||||||
"^/api": {
|
"^/api": {
|
||||||
target: "http://localhost:8080/",
|
target: "http://localhost:8081/",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"^/o/": {
|
"^/o/": {
|
||||||
target: "http://localhost:8080/",
|
target: "http://localhost:8081/",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"^/h/": {
|
"^/h/": {
|
||||||
target: "http://localhost:8080/",
|
target: "http://localhost:8081/",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"^/u/\\d*/rss.xml": {
|
"^/u/\\d*/rss.xml": {
|
||||||
target: "http://localhost:8080/",
|
target: "http://localhost:8081/",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user