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