-
Notifications
You must be signed in to change notification settings - Fork 27
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
5 changed files
with
182 additions
and
45 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
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,37 @@ | ||
on: | ||
push: | ||
|
||
jobs: | ||
test: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.x' | ||
|
||
#- run: echo "Hello world" | ||
#- run: go version | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Test | ||
run: go test ./... | ||
|
||
lint: | ||
name: Lint | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21.x' | ||
|
||
- name: Verify formatting | ||
run: | | ||
no_unformatted_files="$(gofmt -l $(git ls-files '*.go') | wc -l)" | ||
exit "$no_unformatted_files" |
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,22 @@ | ||
FROM golang:alpine3.19@sha256:cdc86d9f363e8786845bea2040312b4efa321b828acdeb26f393faa864d887b0 AS build | ||
|
||
WORKDIR /app | ||
|
||
# Pre-compile std lib, can be cached! | ||
RUN CGO_ENABLED=0 GOOS=linux go install -v -installsuffix cgo -a std | ||
|
||
COPY go.mod ./ | ||
RUN go mod download && go mod verify | ||
|
||
COPY ./cmd ./cmd | ||
COPY ./internal ./internal | ||
RUN go build -v -o /app/bin/main ./cmd/api/main.go | ||
RUN CGO_ENABLED=0 GOOS=linux go build -v -installsuffix cgo -o /app/bin/main -ldflags "-s -w" ./cmd/api/main.go | ||
|
||
FROM scratch | ||
|
||
COPY --from=build /app/bin/main /app/bin/main | ||
|
||
EXPOSE 8888 | ||
|
||
CMD ["/app/bin/main"] |
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