codeberg-pages: init at v4.6.2
This commit is contained in:
parent
59e41fe872
commit
587f267c7d
|
@ -0,0 +1,30 @@
|
|||
{ lib, fetchFromGitea, buildGoModule }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "codeberg-pages";
|
||||
version = "4.6.2";
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "codeberg.org";
|
||||
owner = "Codeberg";
|
||||
repo = "pages-server";
|
||||
rev = "ce241fa40adee2b12f8e225db98e09a45bc2acbb";
|
||||
sha256 = "sha256-mL2Xs7eyldoZK4zrX6WFlFtwdLN0iVyl1Qh8X6b2u9c=";
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-R/LuZkA2xHmu7SO3BVyK1C6n9U+pYn50kNkyLltn2ng=";
|
||||
|
||||
patches = [ ./disable_httptest.patch ];
|
||||
|
||||
ldflags = [ "-s" "-w" ];
|
||||
|
||||
tags = [ "sqlite" "sqlite_unlock_notify" "netgo" ];
|
||||
|
||||
meta = with lib; {
|
||||
mainProgram = "codeberg-pages";
|
||||
maintainers = with maintainers; [ laurent-f1z1 ];
|
||||
license = licenses.eupl12;
|
||||
homepage = "https://codeberg.org/Codeberg/pages-server";
|
||||
description = "Static websites hosting from Gitea repositories";
|
||||
};
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
diff --git a/server/handler/handler_test.go b/server/handler/handler_test.go
|
||||
deleted file mode 100644
|
||||
index 626564a..0000000
|
||||
--- a/server/handler/handler_test.go
|
||||
+++ /dev/null
|
||||
@@ -1,49 +0,0 @@
|
||||
-package handler
|
||||
-
|
||||
-import (
|
||||
- "net/http/httptest"
|
||||
- "testing"
|
||||
- "time"
|
||||
-
|
||||
- "codeberg.org/codeberg/pages/server/cache"
|
||||
- "codeberg.org/codeberg/pages/server/gitea"
|
||||
- "github.com/rs/zerolog/log"
|
||||
-)
|
||||
-
|
||||
-func TestHandlerPerformance(t *testing.T) {
|
||||
- giteaClient, _ := gitea.NewClient("https://codeberg.org", "", cache.NewKeyValueCache(), false, false)
|
||||
- testHandler := Handler(
|
||||
- "codeberg.page", "raw.codeberg.org",
|
||||
- giteaClient,
|
||||
- "https://docs.codeberg.org/pages/raw-content/",
|
||||
- []string{"/.well-known/acme-challenge/"},
|
||||
- []string{"raw.codeberg.org", "fonts.codeberg.org", "design.codeberg.org"},
|
||||
- cache.NewKeyValueCache(),
|
||||
- cache.NewKeyValueCache(),
|
||||
- )
|
||||
-
|
||||
- testCase := func(uri string, status int) {
|
||||
- t.Run(uri, func(t *testing.T) {
|
||||
- req := httptest.NewRequest("GET", uri, nil)
|
||||
- w := httptest.NewRecorder()
|
||||
-
|
||||
- log.Printf("Start: %v\n", time.Now())
|
||||
- start := time.Now()
|
||||
- testHandler(w, req)
|
||||
- end := time.Now()
|
||||
- log.Printf("Done: %v\n", time.Now())
|
||||
-
|
||||
- resp := w.Result()
|
||||
-
|
||||
- if resp.StatusCode != status {
|
||||
- t.Errorf("request failed with status code %d", resp.StatusCode)
|
||||
- } else {
|
||||
- t.Logf("request took %d milliseconds", end.Sub(start).Milliseconds())
|
||||
- }
|
||||
- })
|
||||
- }
|
||||
-
|
||||
- testCase("https://mondstern.codeberg.page/", 404) // TODO: expect 200
|
||||
- testCase("https://codeberg.page/", 404) // TODO: expect 200
|
||||
- testCase("https://example.momar.xyz/", 424)
|
||||
-}
|
|
@ -6449,6 +6449,8 @@ with pkgs;
|
|||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
};
|
||||
|
||||
codeberg-pages = callPackage ../development/tools/continuous-integration/codeberg-pages { };
|
||||
|
||||
codebraid = callPackage ../tools/misc/codebraid { };
|
||||
|
||||
codevis = callPackage ../tools/misc/codevis { };
|
||||
|
|
Loading…
Reference in a new issue