codeberg-pages: init at v4.6.2

Laureηt 587f267c 59e41fe8

+87
+30
pkgs/development/tools/continuous-integration/codeberg-pages/default.nix
···
··· 1 + { lib, fetchFromGitea, buildGoModule }: 2 + 3 + buildGoModule rec { 4 + pname = "codeberg-pages"; 5 + version = "4.6.2"; 6 + 7 + src = fetchFromGitea { 8 + domain = "codeberg.org"; 9 + owner = "Codeberg"; 10 + repo = "pages-server"; 11 + rev = "ce241fa40adee2b12f8e225db98e09a45bc2acbb"; 12 + sha256 = "sha256-mL2Xs7eyldoZK4zrX6WFlFtwdLN0iVyl1Qh8X6b2u9c="; 13 + }; 14 + 15 + vendorSha256 = "sha256-R/LuZkA2xHmu7SO3BVyK1C6n9U+pYn50kNkyLltn2ng="; 16 + 17 + patches = [ ./disable_httptest.patch ]; 18 + 19 + ldflags = [ "-s" "-w" ]; 20 + 21 + tags = [ "sqlite" "sqlite_unlock_notify" "netgo" ]; 22 + 23 + meta = with lib; { 24 + mainProgram = "codeberg-pages"; 25 + maintainers = with maintainers; [ laurent-f1z1 ]; 26 + license = licenses.eupl12; 27 + homepage = "https://codeberg.org/Codeberg/pages-server"; 28 + description = "Static websites hosting from Gitea repositories"; 29 + }; 30 + }
+55
pkgs/development/tools/continuous-integration/codeberg-pages/disable_httptest.patch
···
··· 1 + diff --git a/server/handler/handler_test.go b/server/handler/handler_test.go 2 + deleted file mode 100644 3 + index 626564a..0000000 4 + --- a/server/handler/handler_test.go 5 + +++ /dev/null 6 + @@ -1,49 +0,0 @@ 7 + -package handler 8 + - 9 + -import ( 10 + - "net/http/httptest" 11 + - "testing" 12 + - "time" 13 + - 14 + - "codeberg.org/codeberg/pages/server/cache" 15 + - "codeberg.org/codeberg/pages/server/gitea" 16 + - "github.com/rs/zerolog/log" 17 + -) 18 + - 19 + -func TestHandlerPerformance(t *testing.T) { 20 + - giteaClient, _ := gitea.NewClient("https://codeberg.org", "", cache.NewKeyValueCache(), false, false) 21 + - testHandler := Handler( 22 + - "codeberg.page", "raw.codeberg.org", 23 + - giteaClient, 24 + - "https://docs.codeberg.org/pages/raw-content/", 25 + - []string{"/.well-known/acme-challenge/"}, 26 + - []string{"raw.codeberg.org", "fonts.codeberg.org", "design.codeberg.org"}, 27 + - cache.NewKeyValueCache(), 28 + - cache.NewKeyValueCache(), 29 + - ) 30 + - 31 + - testCase := func(uri string, status int) { 32 + - t.Run(uri, func(t *testing.T) { 33 + - req := httptest.NewRequest("GET", uri, nil) 34 + - w := httptest.NewRecorder() 35 + - 36 + - log.Printf("Start: %v\n", time.Now()) 37 + - start := time.Now() 38 + - testHandler(w, req) 39 + - end := time.Now() 40 + - log.Printf("Done: %v\n", time.Now()) 41 + - 42 + - resp := w.Result() 43 + - 44 + - if resp.StatusCode != status { 45 + - t.Errorf("request failed with status code %d", resp.StatusCode) 46 + - } else { 47 + - t.Logf("request took %d milliseconds", end.Sub(start).Milliseconds()) 48 + - } 49 + - }) 50 + - } 51 + - 52 + - testCase("https://mondstern.codeberg.page/", 404) // TODO: expect 200 53 + - testCase("https://codeberg.page/", 404) // TODO: expect 200 54 + - testCase("https://example.momar.xyz/", 424) 55 + -}
+2
pkgs/top-level/all-packages.nix
··· 6449 inherit (darwin.apple_sdk.frameworks) Security; 6450 }; 6451 6452 codebraid = callPackage ../tools/misc/codebraid { }; 6453 6454 codevis = callPackage ../tools/misc/codevis { };
··· 6449 inherit (darwin.apple_sdk.frameworks) Security; 6450 }; 6451 6452 + codeberg-pages = callPackage ../development/tools/continuous-integration/codeberg-pages { }; 6453 + 6454 codebraid = callPackage ../tools/misc/codebraid { }; 6455 6456 codevis = callPackage ../tools/misc/codevis { };