-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
68 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,14 @@ jobs: | |
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Set up buf | ||
uses: bufbuild/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build Backend | ||
run: go build -v ./... | ||
run: | | ||
go generate ./... | ||
go build -v ./... | ||
- name: Test Backend | ||
run: go test -v -coverprofile=coverage.cov -coverpkg ./... -covermode=atomic ./... | ||
- name: Upload coverage reports to Codecov | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM golang as builder | ||
|
||
WORKDIR /build | ||
|
||
RUN apt update && apt install -y nodejs npm | ||
|
||
ADD go.mod . | ||
ADD go.sum . | ||
|
||
RUN go install github.com/bufbuild/buf/cmd/buf@latest | ||
|
||
ADD . . | ||
|
||
RUN go generate ./... | ||
RUN go build ./cmd/moneyd | ||
|
||
FROM debian:stable-slim | ||
|
||
COPY --from=builder /build/moneyd / | ||
|
||
ENTRYPOINT [ "./moneyd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ui | ||
|
||
import ( | ||
"embed" | ||
"errors" | ||
"io/fs" | ||
"log" | ||
"net/http" | ||
"os" | ||
"strings" | ||
) | ||
|
||
//go:generate npm i | ||
//go:generate npm run build | ||
//go:embed all:build | ||
var files embed.FS | ||
|
||
func SvelteKitHandler(path string) http.Handler { | ||
fsys, err := fs.Sub(files, "build") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
filesystem := http.FS(fsys) | ||
|
||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
path := strings.TrimPrefix(r.URL.Path, path) | ||
_, err := filesystem.Open(path) | ||
if errors.Is(err, os.ErrNotExist) { | ||
path = "index.html" | ||
} | ||
r.URL.Path = path | ||
http.FileServer(filesystem).ServeHTTP(w, r) | ||
}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters