1
0
mirror of https://github.com/umputun/reproxy.git synced 2024-11-24 08:12:31 +02:00

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

View File

@ -22,12 +22,20 @@ jobs:
- name: build and test - name: build and test
run: | 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 cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mocks" | grep -v "_mock" > $GITHUB_WORKSPACE/profile.cov
working-directory: app working-directory: app
env: env:
TZ: "America/Chicago" TZ: "America/Chicago"
- name: test examples
run: |
go test -race ./...
go build -race ./...
working-directory: examples/plugin
env:
TZ: "America/Chicago"
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@v6

View File

@ -18,19 +18,12 @@ RUN \
echo "version=$version" && \ echo "version=$version" && \
cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w" cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w"
FROM umputun/baseimage:scratch-latest
FROM ghcr.io/umputun/baseimage/app:v1.12.0 as base
FROM scratch
# enables automatic changelog generation by tools like Dependabot # enables automatic changelog generation by tools like Dependabot
LABEL org.opencontainers.image.source="https://github.com/umputun/reproxy" LABEL org.opencontainers.image.source="https://github.com/umputun/reproxy"
ENV REPROXY_IN_DOCKER=1 ENV REPROXY_IN_DOCKER=1
COPY --from=backend /build/reproxy /srv/reproxy 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 WORKDIR /srv
ENTRYPOINT ["/srv/reproxy"] 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) 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 ```docker
FROM node:16-alpine as build FROM node:22-alpine as build
WORKDIR /build WORKDIR /build
COPY site/ /build COPY site/ /build

View File

@ -10,6 +10,7 @@ import (
"net/http/httptest" "net/http/httptest"
"strconv" "strconv"
"strings" "strings"
"sync"
"testing" "testing"
"time" "time"
@ -73,7 +74,10 @@ func TestHttp_healthHandler(t *testing.T) {
})) }))
var count int var count int
var mux sync.Mutex
ps := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ps := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
mux.Lock()
defer mux.Unlock()
count++ count++
t.Logf("req: %v", r) t.Logf("req: %v", r)
if r.URL.Path == "/123/ping" { 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 ENV CGO_ENABLED=0
@ -8,8 +8,6 @@ WORKDIR /build
RUN go build -o /build/plugin-example -ldflags "-X main.revision=${version} -s -w" 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 FROM scratch
COPY --from=build /build/plugin-example /srv/plugin-example COPY --from=build /build/plugin-example /srv/plugin-example