From afc9709484b16f91eb04d7bc5ce5fea60a1e2b92 Mon Sep 17 00:00:00 2001 From: boojack Date: Sun, 25 Dec 2022 10:39:45 +0800 Subject: [PATCH] chore: update dev config (#857) --- .github/workflows/backend-tests.yml | 45 +++++++++++++++++++ .../{tests.yml => frontend-tests.yml} | 37 ++------------- docs/development.md | 2 +- server/profile/profile.go | 2 +- web/vite.config.ts | 10 ++--- 5 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/backend-tests.yml rename .github/workflows/{tests.yml => frontend-tests.yml} (54%) diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml new file mode 100644 index 00000000..b9330cfa --- /dev/null +++ b/.github/workflows/backend-tests.yml @@ -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"}' diff --git a/.github/workflows/tests.yml b/.github/workflows/frontend-tests.yml similarity index 54% rename from .github/workflows/tests.yml rename to .github/workflows/frontend-tests.yml index 92ff3db8..81c31cb2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/frontend-tests.yml @@ -1,4 +1,4 @@ -name: Test +name: Frontend Test on: push: @@ -7,6 +7,8 @@ on: - "release/v*.*.*" pull_request: branches: [main] + paths: + - "web/**" jobs: eslint-checks: @@ -53,36 +55,3 @@ jobs: - name: Run frontend build run: yarn build 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"}' diff --git a/docs/development.md b/docs/development.md index 58e82ba4..234e3624 100644 --- a/docs/development.md +++ b/docs/development.md @@ -37,4 +37,4 @@ Memos is built with a curated tech stack. It is optimized for developer experien 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. diff --git a/server/profile/profile.go b/server/profile/profile.go index 0b23ff8a..553bdbd1 100644 --- a/server/profile/profile.go +++ b/server/profile/profile.go @@ -48,7 +48,7 @@ func checkDSN(dataDir string) (string, error) { func GetProfile() (*Profile, error) { profile := Profile{} 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.Parse() diff --git a/web/vite.config.ts b/web/vite.config.ts index 6a5d0d6d..6d5c2329 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -13,22 +13,22 @@ export default defineConfig({ ], server: { host: "0.0.0.0", - port: 3000, + port: 3001, proxy: { "^/api": { - target: "http://localhost:8080/", + target: "http://localhost:8081/", changeOrigin: true, }, "^/o/": { - target: "http://localhost:8080/", + target: "http://localhost:8081/", changeOrigin: true, }, "^/h/": { - target: "http://localhost:8080/", + target: "http://localhost:8081/", changeOrigin: true, }, "^/u/\\d*/rss.xml": { - target: "http://localhost:8080/", + target: "http://localhost:8081/", changeOrigin: true, }, },