add test to CI for example directory

This commit is contained in:
Dmitry Verkhoturov 2024-05-09 17:44:28 +02:00 committed by Umputun
parent 30173d599c
commit 899e101d7a
6 changed files with 16 additions and 21 deletions

View File

@ -13,10 +13,6 @@ updates:
"GitHub Actions updates":
patterns:
- "*"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "gomod"
directory: "/"
schedule:
@ -24,8 +20,6 @@ updates:
groups:
"Go modules updates":
dependency-type: "production"
"Go modules updates for tests":
dependency-type: "development"
- package-ecosystem: "gomod"
directory: "/examples/plugin"
schedule:
@ -33,5 +27,3 @@ updates:
groups:
"Go modules updates":
dependency-type: "production"
"Go modules updates for tests":
dependency-type: "development"

View File

@ -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

View File

@ -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"]

View File

@ -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

View File

@ -10,6 +10,7 @@ import (
"net/http/httptest"
"strconv"
"strings"
"sync"
"testing"
"time"
@ -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" {

View File

@ -1,4 +1,4 @@
FROM golang:1.16-alpine as build
FROM golang:1.22-alpine as build
ENV CGO_ENABLED=0
@ -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