3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #226303 from Laurent2916/master

codeberg-pages: init at 4.6.2
This commit is contained in:
Ryan Lahfa 2023-05-05 17:13:01 +02:00 committed by GitHub
commit 8a2099942b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 93 additions and 0 deletions

View file

@ -8666,6 +8666,12 @@
githubId = 621759;
name = "Lassulus";
};
laurent-f1z1 = {
email = "laurent.nixpkgs@fainsin.bzh";
github = "Laurent2916";
githubId = 21087104;
name = "Laurent Fainsin";
};
layus = {
email = "layus.on@gmail.com";
github = "layus";

View file

@ -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";
};
}

View file

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

View file

@ -6493,6 +6493,8 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Security;
};
codeberg-pages = callPackage ../development/tools/continuous-integration/codeberg-pages { };
codebraid = callPackage ../tools/misc/codebraid { };
codemov = callPackage ../tools/misc/codemov { };