Skip to content

Commit

Permalink
add test to CI for example directory
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal authored and umputun committed May 10, 2024
1 parent 30173d5 commit 899e101
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,17 @@ updates:
"GitHub Actions updates":
patterns:
- "*"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
groups:
"Go modules updates":
dependency-type: "production"
"Go modules updates for tests":
dependency-type: "development"
- package-ecosystem: "gomod"
directory: "/examples/plugin"
schedule:
interval: "monthly"
groups:
"Go modules updates":
dependency-type: "production"
"Go modules updates for tests":
dependency-type: "development"
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ jobs:

- name: build and test
run: |
go test -v -timeout=100s -covermode=count -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./...
go test -race -v -timeout=100s -covermode=atomic -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./...
go build -race ./...
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mocks" | grep -v "_mock" > $GITHUB_WORKSPACE/profile.cov
working-directory: app
env:
TZ: "America/Chicago"

- name: test examples
run: |
go test -race ./...
go build -race ./...
working-directory: examples/plugin
env:
TZ: "America/Chicago"

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
Expand Down
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,12 @@ RUN \
echo "version=$version" && \
cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w"


FROM ghcr.io/umputun/baseimage/app:v1.12.0 as base

FROM scratch
FROM umputun/baseimage:scratch-latest
# enables automatic changelog generation by tools like Dependabot
LABEL org.opencontainers.image.source="https://github.com/umputun/reproxy"
ENV REPROXY_IN_DOCKER=1

COPY --from=backend /build/reproxy /srv/reproxy
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=base /etc/passwd /etc/passwd
COPY --from=base /etc/group /etc/group

WORKDIR /srv
ENTRYPOINT ["/srv/reproxy"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Custom 404 (not found) page can be set with `--assets.404=<path>` parameter. The
Serving purely static content is one of the popular use cases. Usually this used for the separate frontend container providing UI only. With the assets server such a container is almost trivial to make. This is an example from the container serving [reproxy.io](http://reproxy.io)

```docker
FROM node:16-alpine as build
FROM node:22-alpine as build
WORKDIR /build
COPY site/ /build
Expand Down
4 changes: 4 additions & 0 deletions app/proxy/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net/http/httptest"
"strconv"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -73,7 +74,10 @@ func TestHttp_healthHandler(t *testing.T) {
}))

var count int
var mux sync.Mutex
ps := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
mux.Lock()
defer mux.Unlock()
count++
t.Logf("req: %v", r)
if r.URL.Path == "/123/ping" {
Expand Down
4 changes: 1 addition & 3 deletions examples/plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-alpine as build
FROM golang:1.22-alpine as build

ENV CGO_ENABLED=0

Expand All @@ -8,8 +8,6 @@ WORKDIR /build
RUN go build -o /build/plugin-example -ldflags "-X main.revision=${version} -s -w"


FROM ghcr.io/umputun/baseimage/app:v1.6.1 as base

FROM scratch

COPY --from=build /build/plugin-example /srv/plugin-example
Expand Down

0 comments on commit 899e101

Please sign in to comment.