Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71a5c15b4c | ||
|
|
e8c3e2f792 | ||
|
|
87e23545d1 | ||
|
|
2b62070557 | ||
|
|
d11610b6c7 | ||
|
|
9cbb909f08 | ||
|
|
2d750a4ce7 | ||
|
|
0a7e2d14e2 | ||
|
|
763a092640 | ||
|
|
ec43d2ae46 | ||
|
|
afd1fe50c4 | ||
|
|
254d339656 | ||
|
|
9b89550766 | ||
|
|
712fdbc97b | ||
|
|
23bbccd2b1 | ||
|
|
d82bb6f468 | ||
|
|
a0ced02345 |
+10
-5
@@ -1,10 +1,10 @@
|
||||
# Read-only split mirror: a libs/ruby/warp_engine alkönyvtárat kitükrözi a
|
||||
# tools/warp_engine repóba (fejlesztés itt, a monorepóban történik; a tükör
|
||||
# engines/warp_engine repóba (fejlesztés itt, a monorepóban történik; a tükör
|
||||
# csak publikálásra való). Tag-elt release (warp_engine-v*) esetén a gem a
|
||||
# Forgejo rubygems registry-be is felmegy.
|
||||
#
|
||||
# Szükséges Woodpecker secret: forge_token — Forgejo access token
|
||||
# repository:write (tools/warp_engine) és package:write joggal.
|
||||
# repository:write (engines/warp_engine) és package:write joggal.
|
||||
|
||||
when:
|
||||
- event: push
|
||||
@@ -32,7 +32,7 @@ steps:
|
||||
- git subtree split --prefix=libs/ruby/warp_engine HEAD -b warp-engine-split
|
||||
# a secretbe másolt token végén lehet sortörés — levágjuk
|
||||
- TOKEN="$$(printf '%s' "$${FORGE_TOKEN}" | tr -d '[:space:]')"
|
||||
- git push --force "https://ci:$${TOKEN}@git.teletypegames.org/tools/warp_engine.git" warp-engine-split:master
|
||||
- git push --force "https://ci:$${TOKEN}@git.teletypegames.org/engines/warp_engine.git" warp-engine-split:master
|
||||
when:
|
||||
- event: push
|
||||
branch: master
|
||||
@@ -48,10 +48,15 @@ steps:
|
||||
- gem build warp_engine.gemspec
|
||||
- mkdir -p ~/.gem
|
||||
- TOKEN="$$(printf '%s' "$${FORGE_TOKEN}" | tr -d '[:space:]')"
|
||||
# Nevesített kulcs, nem a hoszt-URL: a RubyGems a credentials fájl
|
||||
# kulcsait normalizálja (a pontokból __ lesz, záró perjelet kap), így egy
|
||||
# URL-kulcs sosem egyezik a --host értékével. Ilyenkor a gem push
|
||||
# bejelentkezni próbál a RubyGems sign_in végpontján, amit a Gitea nem
|
||||
# ismer — ez adta a "404 page not found"-ot.
|
||||
- |
|
||||
printf -- '---\n:https://git.teletypegames.org/api/packages/tools/rubygems: Bearer %s\n' "$${TOKEN}" > ~/.gem/credentials
|
||||
printf -- '---\n:gitea: Bearer %s\n' "$${TOKEN}" > ~/.gem/credentials
|
||||
- chmod 600 ~/.gem/credentials
|
||||
- gem push --host https://git.teletypegames.org/api/packages/tools/rubygems warp_engine-*.gem
|
||||
- gem push --key gitea --host https://git.teletypegames.org/api/packages/engines/rubygems warp_engine-*.gem
|
||||
when:
|
||||
- event: tag
|
||||
ref: refs/tags/warp_engine-v*
|
||||
|
||||
+95
-94
@@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: ../libs/ruby/warp_engine
|
||||
specs:
|
||||
warp_engine (0.1.0)
|
||||
warp_engine (0.3.0)
|
||||
apipie-rails
|
||||
blueprinter
|
||||
rails (>= 8.0)
|
||||
@@ -10,31 +10,31 @@ PATH
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
action_text-trix (2.1.18)
|
||||
action_text-trix (2.1.19)
|
||||
railties
|
||||
actioncable (8.1.3)
|
||||
actionpack (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
actioncable (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (8.1.3)
|
||||
actionpack (= 8.1.3)
|
||||
activejob (= 8.1.3)
|
||||
activerecord (= 8.1.3)
|
||||
activestorage (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
actionmailbox (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activestorage (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (8.1.3)
|
||||
actionpack (= 8.1.3)
|
||||
actionview (= 8.1.3)
|
||||
activejob (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
actionmailer (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
actionview (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (8.1.3)
|
||||
actionview (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
actionpack (8.1.3.1)
|
||||
actionview (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
nokogiri (>= 1.8.5)
|
||||
rack (>= 2.2.4)
|
||||
rack-session (>= 1.0.1)
|
||||
@@ -42,21 +42,21 @@ GEM
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
useragent (~> 0.16)
|
||||
actiontext (8.1.3)
|
||||
actiontext (8.1.3.1)
|
||||
action_text-trix (~> 2.1.15)
|
||||
actionpack (= 8.1.3)
|
||||
activerecord (= 8.1.3)
|
||||
activestorage (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
actionpack (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activestorage (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
actionview (8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
activeadmin (3.5.1)
|
||||
activeadmin (3.5.2)
|
||||
arbre (~> 1.2, >= 1.2.1)
|
||||
csv
|
||||
formtastic (>= 3.1)
|
||||
@@ -68,22 +68,22 @@ GEM
|
||||
ransack (>= 4.0)
|
||||
activeadmin_blaze_theme (1.1.0)
|
||||
activeadmin (>= 2.0, < 4)
|
||||
activejob (8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
activejob (8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
activerecord (8.1.3)
|
||||
activemodel (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
activemodel (8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
activerecord (8.1.3.1)
|
||||
activemodel (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (8.1.3)
|
||||
actionpack (= 8.1.3)
|
||||
activejob (= 8.1.3)
|
||||
activerecord (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
activestorage (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
marcel (~> 1.0)
|
||||
activesupport (8.1.3)
|
||||
activesupport (8.1.3.1)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
@@ -107,18 +107,18 @@ GEM
|
||||
bcrypt (3.1.22)
|
||||
bigdecimal (4.1.2)
|
||||
blueprinter (1.3.0)
|
||||
bootsnap (1.24.3)
|
||||
msgpack (~> 1.2)
|
||||
bootsnap (1.25.0)
|
||||
msgpack (~> 1.5)
|
||||
builder (3.3.0)
|
||||
concurrent-ruby (1.3.6)
|
||||
concurrent-ruby (1.3.8)
|
||||
connection_pool (3.0.2)
|
||||
crass (1.0.6)
|
||||
csv (3.3.5)
|
||||
crass (1.0.7)
|
||||
csv (3.3.6)
|
||||
date (3.5.1)
|
||||
debug (1.11.1)
|
||||
irb (~> 1.10)
|
||||
reline (>= 0.3.8)
|
||||
devise (5.0.3)
|
||||
devise (5.0.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 7.0)
|
||||
@@ -126,7 +126,7 @@ GEM
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.6.2)
|
||||
drb (2.2.3)
|
||||
erb (6.0.4)
|
||||
erb (6.0.7)
|
||||
erubi (1.13.1)
|
||||
factory_bot (6.6.0)
|
||||
activesupport (>= 6.1.0)
|
||||
@@ -138,19 +138,19 @@ GEM
|
||||
formtastic (6.0.0)
|
||||
actionpack (>= 7.2.0)
|
||||
formtastic_i18n (0.7.0)
|
||||
globalid (1.3.0)
|
||||
globalid (1.4.0)
|
||||
activesupport (>= 6.1)
|
||||
has_scope (0.9.0)
|
||||
actionpack (>= 7.0)
|
||||
activesupport (>= 7.0)
|
||||
i18n (1.14.8)
|
||||
i18n (1.15.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
inherited_resources (1.14.0)
|
||||
actionpack (>= 6.0)
|
||||
has_scope (>= 0.6)
|
||||
railties (>= 6.0)
|
||||
responders (>= 2)
|
||||
io-console (0.8.2)
|
||||
io-console (0.9.1)
|
||||
irb (1.18.0)
|
||||
pp (>= 0.6.0)
|
||||
prism (>= 1.3.0)
|
||||
@@ -160,7 +160,7 @@ GEM
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.19.5)
|
||||
json (2.21.2)
|
||||
kaminari (1.2.2)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.2.2)
|
||||
@@ -173,27 +173,27 @@ GEM
|
||||
activerecord
|
||||
kaminari-core (= 1.2.2)
|
||||
kaminari-core (1.2.2)
|
||||
language_server-protocol (3.17.0.5)
|
||||
language_server-protocol (3.17.0.6)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.7.0)
|
||||
loofah (2.25.1)
|
||||
loofah (2.25.2)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.12.0)
|
||||
mail (2.9.0)
|
||||
mail (2.9.1)
|
||||
logger
|
||||
mini_mime (>= 0.1.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
marcel (1.1.0)
|
||||
marcel (1.2.1)
|
||||
mini_mime (1.1.5)
|
||||
minitest (6.0.6)
|
||||
drb (~> 2.0)
|
||||
prism (~> 1.5)
|
||||
msgpack (1.8.0)
|
||||
msgpack (1.8.4)
|
||||
mysql2 (0.5.7)
|
||||
bigdecimal
|
||||
net-imap (0.6.4)
|
||||
net-imap (0.6.6)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
@@ -203,23 +203,20 @@ GEM
|
||||
net-smtp (0.5.1)
|
||||
net-protocol
|
||||
nio4r (2.7.5)
|
||||
nokogiri (1.19.3-arm64-darwin)
|
||||
nokogiri (1.19.4-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.19.3-x86_64-linux-gnu)
|
||||
nokogiri (1.19.4-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
orm_adapter (0.5.0)
|
||||
parallel (1.28.0)
|
||||
parser (3.3.11.1)
|
||||
parallel (2.1.0)
|
||||
parser (3.3.12.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
pp (0.6.3)
|
||||
pp (0.6.4)
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
prism (1.9.0)
|
||||
psych (5.3.1)
|
||||
date
|
||||
stringio
|
||||
puma (8.0.1)
|
||||
puma (8.0.2)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.8.1)
|
||||
rack (3.2.6)
|
||||
@@ -230,30 +227,30 @@ GEM
|
||||
rack (>= 1.3)
|
||||
rackup (2.3.1)
|
||||
rack (>= 3)
|
||||
rails (8.1.3)
|
||||
actioncable (= 8.1.3)
|
||||
actionmailbox (= 8.1.3)
|
||||
actionmailer (= 8.1.3)
|
||||
actionpack (= 8.1.3)
|
||||
actiontext (= 8.1.3)
|
||||
actionview (= 8.1.3)
|
||||
activejob (= 8.1.3)
|
||||
activemodel (= 8.1.3)
|
||||
activerecord (= 8.1.3)
|
||||
activestorage (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
rails (8.1.3.1)
|
||||
actioncable (= 8.1.3.1)
|
||||
actionmailbox (= 8.1.3.1)
|
||||
actionmailer (= 8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
actiontext (= 8.1.3.1)
|
||||
actionview (= 8.1.3.1)
|
||||
activejob (= 8.1.3.1)
|
||||
activemodel (= 8.1.3.1)
|
||||
activerecord (= 8.1.3.1)
|
||||
activestorage (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 8.1.3)
|
||||
railties (= 8.1.3.1)
|
||||
rails-dom-testing (2.3.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.7.0)
|
||||
loofah (~> 2.25)
|
||||
rails-html-sanitizer (1.7.1)
|
||||
loofah (~> 2.25, >= 2.25.2)
|
||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||
railties (8.1.3)
|
||||
actionpack (= 8.1.3)
|
||||
activesupport (= 8.1.3)
|
||||
railties (8.1.3.1)
|
||||
actionpack (= 8.1.3.1)
|
||||
activesupport (= 8.1.3.1)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
@@ -266,12 +263,17 @@ GEM
|
||||
activerecord (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
i18n
|
||||
rdoc (7.2.0)
|
||||
rbs (4.1.2)
|
||||
logger
|
||||
prism (>= 1.6.0)
|
||||
tsort
|
||||
rdoc (8.0.0)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
prism (>= 1.6.0)
|
||||
rbs (>= 4.0.0)
|
||||
tsort
|
||||
regexp_parser (2.12.0)
|
||||
reline (0.6.3)
|
||||
reline (0.7.0)
|
||||
io-console (~> 0.5)
|
||||
responders (3.2.0)
|
||||
actionpack (>= 7.0)
|
||||
@@ -296,7 +298,7 @@ GEM
|
||||
rspec-support (3.13.7)
|
||||
rss (0.3.3)
|
||||
rexml
|
||||
rubocop (1.86.1)
|
||||
rubocop (1.89.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
@@ -307,14 +309,14 @@ GEM
|
||||
rubocop-ast (>= 1.49.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.49.1)
|
||||
rubocop-ast (1.50.0)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.7)
|
||||
rubocop-performance (1.26.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.47.1, < 2.0)
|
||||
rubocop-rails (2.34.3)
|
||||
rubocop-rails (2.36.0)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
@@ -346,9 +348,8 @@ GEM
|
||||
actionpack (>= 6.1)
|
||||
activesupport (>= 6.1)
|
||||
sprockets (>= 3.0.0)
|
||||
stringio (3.2.0)
|
||||
thor (1.5.0)
|
||||
tilt (2.7.0)
|
||||
tilt (2.8.0)
|
||||
timeout (0.6.1)
|
||||
tsort (0.2.0)
|
||||
tzinfo (2.0.6)
|
||||
@@ -360,11 +361,11 @@ GEM
|
||||
useragent (0.16.11)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
websocket-driver (0.8.0)
|
||||
websocket-driver (0.8.2)
|
||||
base64
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.7.5)
|
||||
zeitwerk (2.8.3)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-22
|
||||
|
||||
@@ -12,13 +12,13 @@ Rails.application.config.to_prepare do
|
||||
# and their builder images. An image bump is one line here, rolled out to
|
||||
# every repo by the deploy.
|
||||
c.ci_platforms = {
|
||||
"godot" => { builder: "git.teletypegames.org/internal/godot-builder:4.7.1" },
|
||||
"phaser" => { builder: "git.teletypegames.org/internal/phaser-builder:latest" },
|
||||
"love" => { builder: "git.teletypegames.org/internal/love-builder:latest" },
|
||||
"bevy" => { builder: "git.teletypegames.org/internal/bevy-builder:latest" },
|
||||
"c64" => { builder: "git.teletypegames.org/internal/c64-builder:latest" },
|
||||
"ebitengine" => { builder: "git.teletypegames.org/internal/ebitengine-builder:latest" },
|
||||
"tic80" => { builder: "git.teletypegames.org/internal/tic80pro:latest" }
|
||||
"godot" => { builder: "git.teletypegames.org/build/godot-builder:4.7.1" },
|
||||
"phaser" => { builder: "git.teletypegames.org/build/phaser-builder:latest" },
|
||||
"love" => { builder: "git.teletypegames.org/build/love-builder:latest" },
|
||||
"bevy" => { builder: "git.teletypegames.org/build/bevy-builder:latest" },
|
||||
"c64" => { builder: "git.teletypegames.org/build/c64-builder:latest" },
|
||||
"ebitengine" => { builder: "git.teletypegames.org/build/ebitengine-builder:latest" },
|
||||
"tic80" => { builder: "git.teletypegames.org/build/tic80pro:latest" }
|
||||
}
|
||||
# Explicit URL: request.base_url would yield http:// behind the host nginx
|
||||
# (no X-Forwarded-Proto reaches Rails), and the resulting 301 makes the
|
||||
|
||||
+20
-20
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_06_000001) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_06_000002) do
|
||||
create_table "admin_users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "deleted_at", precision: 3
|
||||
@@ -45,24 +45,6 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_06_000001) do
|
||||
t.index ["token_digest"], name: "idx_application_tokens_token_digest", unique: true
|
||||
end
|
||||
|
||||
create_table "ci_repositories", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.boolean "active", default: true, null: false
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
t.datetime "last_pipeline_at", precision: 3
|
||||
t.string "last_pipeline_status", limit: 32
|
||||
t.string "platform", limit: 32, null: false
|
||||
t.string "repo_name", limit: 128, null: false
|
||||
t.string "repo_owner", limit: 128, null: false
|
||||
t.bigint "software_id", unsigned: true
|
||||
t.datetime "updated_at", precision: 3
|
||||
t.bigint "woodpecker_repo_id", null: false, unsigned: true
|
||||
t.index ["deleted_at"], name: "idx_ci_repos_deleted"
|
||||
t.index ["repo_owner", "repo_name"], name: "idx_ci_repos_owner_name", unique: true
|
||||
t.index ["software_id"], name: "idx_ci_repos_software"
|
||||
t.index ["woodpecker_repo_id"], name: "idx_ci_repos_wp_id", unique: true
|
||||
end
|
||||
|
||||
create_table "downloads", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
@@ -214,6 +196,24 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_06_000001) do
|
||||
t.index ["image_id"], name: "index_members_on_image_id"
|
||||
end
|
||||
|
||||
create_table "pipelines", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.boolean "active", default: true, null: false
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
t.datetime "last_pipeline_at", precision: 3
|
||||
t.string "last_pipeline_status", limit: 32
|
||||
t.string "platform", limit: 32, null: false
|
||||
t.string "repo_name", limit: 128, null: false
|
||||
t.string "repo_owner", limit: 128, null: false
|
||||
t.bigint "software_id", unsigned: true
|
||||
t.datetime "updated_at", precision: 3
|
||||
t.bigint "woodpecker_repo_id", null: false, unsigned: true
|
||||
t.index ["deleted_at"], name: "idx_pipelines_deleted"
|
||||
t.index ["repo_owner", "repo_name"], name: "idx_pipelines_owner_name", unique: true
|
||||
t.index ["software_id"], name: "idx_pipelines_software"
|
||||
t.index ["woodpecker_repo_id"], name: "idx_pipelines_wp_id", unique: true
|
||||
end
|
||||
|
||||
create_table "platform_links", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
@@ -282,10 +282,10 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_06_000001) do
|
||||
end
|
||||
|
||||
add_foreign_key "admin_users", "members"
|
||||
add_foreign_key "ci_repositories", "softwares", name: "fk_ci_repos_software", on_delete: :nullify
|
||||
add_foreign_key "downloads", "releases", name: "fk_downloads_release", on_delete: :nullify
|
||||
add_foreign_key "external_links", "softwares", name: "fk_softwares_external_links", on_delete: :cascade
|
||||
add_foreign_key "members", "images"
|
||||
add_foreign_key "pipelines", "softwares", name: "fk_pipelines_software", on_delete: :nullify
|
||||
add_foreign_key "release_assets", "releases", name: "fk_releases_release_assets", on_delete: :cascade
|
||||
add_foreign_key "releases", "softwares", name: "fk_softwares_releases", on_delete: :cascade
|
||||
add_foreign_key "software_images", "images"
|
||||
|
||||
Generated
+1576
-1190
File diff suppressed because it is too large
Load Diff
@@ -160,6 +160,7 @@ export default {
|
||||
win_x64: 'Windows (64-bit)',
|
||||
linux_x86: 'Linux (32-bit)',
|
||||
linux_x64: 'Linux (64-bit)',
|
||||
linux_arm64: 'Linux (ARM 64-bit)',
|
||||
mac_x64: 'macOS (Intel)',
|
||||
mac_arm64: 'macOS (Apple Silicon)',
|
||||
mac_universal: 'macOS',
|
||||
@@ -197,6 +198,24 @@ export default {
|
||||
title: 'Build Matrix',
|
||||
subtitle: 'Which engines build for which platforms.',
|
||||
},
|
||||
batocera: {
|
||||
title: 'Batocera Store',
|
||||
subtitle: 'Our catalog, straight on your retro box.',
|
||||
lead: 'ttg-batocera-store puts our catalog on Batocera, the plug-and-play retro gaming distribution. It pulls our games into the box\'s ROM folders together with box art and EmulationStation metadata, and can be re-run any time from the Ports menu to pick up new releases. Python 3 standard library only — nothing to install alongside it.',
|
||||
repo: 'Git repository',
|
||||
docs: 'Documentation',
|
||||
batoceraProject: 'Batocera project',
|
||||
installTitle: 'Install',
|
||||
installDesc: 'Run this over SSH on the Batocera box. It installs the client, writes the config, creates the Ports entry and runs the first sync.',
|
||||
installNote: 'Then restart EmulationStation so the games show up:',
|
||||
useTitle: 'Use it',
|
||||
useDesc: 'On the device: Ports ▸ "Teletype Games Store". Over SSH the client has a small CLI:',
|
||||
platformsTitle: 'What it installs',
|
||||
platformsDesc: 'A catalog platform is installable when its release asset boots directly on a Batocera system. Other platforms ship web and desktop builds instead, so they are not mapped.',
|
||||
engineTitle: 'Run your own store',
|
||||
engineDesc: 'Nothing here is specific to us. Our store is just a config file on top of warp-engine-batocera-store, an open engine that works with any WarpEngine-based site: point it at your own catalog, give it a name and a ROM subfolder of its own, and your games land on a Batocera box the same way. Several stores can live side by side on one machine without touching each other\'s games.',
|
||||
copy: 'Copy',
|
||||
},
|
||||
code: {
|
||||
title: 'Codebase',
|
||||
subtitle: 'Explore our collection of open-source projects, study our source code, and contribute to our independent game development tools.',
|
||||
|
||||
@@ -160,6 +160,7 @@ export default {
|
||||
win_x64: 'Windows (64 bit)',
|
||||
linux_x86: 'Linux (32 bit)',
|
||||
linux_x64: 'Linux (64 bit)',
|
||||
linux_arm64: 'Linux (ARM 64 bit)',
|
||||
mac_x64: 'macOS (Intel)',
|
||||
mac_arm64: 'macOS (Apple Silicon)',
|
||||
mac_universal: 'macOS',
|
||||
@@ -197,6 +198,24 @@ export default {
|
||||
title: 'Build mátrix',
|
||||
subtitle: 'Melyik engine melyik platformra fordít.',
|
||||
},
|
||||
batocera: {
|
||||
title: 'Batocera Store',
|
||||
subtitle: 'A katalógusunk közvetlenül a retró gépeden.',
|
||||
lead: 'A ttg-batocera-store a katalógusunkat teszi fel a Batocerára, a plug-and-play retró gamer disztribúcióra. A játékainkat a gép ROM mappáiba tölti le, borítóképpel és EmulationStation metaadatokkal együtt, és a Ports menüből bármikor újrafuttatható az új kiadásokért. Csak a Python 3 alapkönyvtárát használja — nem kell mellé semmit telepíteni.',
|
||||
repo: 'Git tároló',
|
||||
docs: 'Dokumentáció',
|
||||
batoceraProject: 'Batocera projekt',
|
||||
installTitle: 'Telepítés',
|
||||
installDesc: 'Futtasd ezt SSH-n a Batocera gépen. Telepíti a klienst, kiírja a konfigurációt, létrehozza a Ports bejegyzést és lefuttatja az első szinkront.',
|
||||
installNote: 'Utána indítsd újra az EmulationStationt, hogy megjelenjenek a játékok:',
|
||||
useTitle: 'Használat',
|
||||
useDesc: 'A gépen: Ports ▸ „Teletype Games Store”. SSH-n keresztül egy egyszerű CLI áll rendelkezésre:',
|
||||
platformsTitle: 'Mit telepít',
|
||||
platformsDesc: 'Egy katalógus-platform akkor telepíthető, ha a kiadás fájlja közvetlenül elindul egy Batocera rendszeren. A többi platform webes és asztali buildeket ad, ezért nincsenek leképezve.',
|
||||
engineTitle: 'Csinálj saját store-t',
|
||||
engineDesc: 'Itt semmi sem ránk van szabva. A mi store-unk csak egy konfigurációs fájl a warp-engine-batocera-store fölött, ami bármilyen WarpEngine alapú oldallal működik: állítsd a saját katalógusodra, adj neki nevet és saját ROM almappát, és a játékaid ugyanígy kerülnek fel egy Batocera gépre. Egy gépen több store is megfér egymás mellett anélkül, hogy egymás játékaihoz nyúlnának.',
|
||||
copy: 'Másolás',
|
||||
},
|
||||
code: {
|
||||
title: 'Kódbázis',
|
||||
subtitle: 'Fedezd fel nyílt forráskódú projektek gyűjteményét, tanulmányozd forráskódunkat, és járulj hozzá független játékfejlesztő eszközeinkhez.',
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
<template>
|
||||
<header class="hero-section-gradient from-emerald-700 to-teal-800 py-16">
|
||||
<div class="hero-container">
|
||||
<h1 class="hero-title">{{ t('batocera.title') }}</h1>
|
||||
<p class="hero-subtitle text-emerald-50">{{ t('batocera.subtitle') }}</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="main-container py-12 px-4 mt-0">
|
||||
<div class="bat-panel">
|
||||
<p class="bat-lead">{{ t('batocera.lead') }}</p>
|
||||
|
||||
<div class="bat-links">
|
||||
<a :href="REPO_URL" target="_blank" rel="noopener noreferrer" class="bat-link bat-link-dark">
|
||||
<i class="fa-solid fa-code-branch"></i> {{ t('batocera.repo') }}
|
||||
</a>
|
||||
<a :href="WIKI_URL" target="_blank" rel="noopener noreferrer" class="bat-link bat-link-indigo">
|
||||
<i class="fa-solid fa-book"></i> {{ t('batocera.docs') }}
|
||||
</a>
|
||||
<a :href="BATOCERA_URL" target="_blank" rel="noopener noreferrer" class="bat-link bat-link-emerald">
|
||||
<i class="fa-solid fa-tv"></i> {{ t('batocera.batoceraProject') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="bat-section">
|
||||
<h2 class="bat-section-title">
|
||||
<span class="bat-step">1</span> {{ t('batocera.installTitle') }}
|
||||
</h2>
|
||||
<p class="bat-section-desc">{{ t('batocera.installDesc') }}</p>
|
||||
<div class="bat-code">
|
||||
<pre><code>{{ INSTALL_CMD }}</code></pre>
|
||||
<button class="bat-copy" :title="t('batocera.copy')" @click="copy(INSTALL_CMD)">
|
||||
<i :class="copied === INSTALL_CMD ? 'fa-solid fa-check' : 'fa-regular fa-copy'"></i>
|
||||
</button>
|
||||
</div>
|
||||
<p class="bat-note">{{ t('batocera.installNote') }}</p>
|
||||
<div class="bat-code">
|
||||
<pre><code>{{ RESTART_CMD }}</code></pre>
|
||||
<button class="bat-copy" :title="t('batocera.copy')" @click="copy(RESTART_CMD)">
|
||||
<i :class="copied === RESTART_CMD ? 'fa-solid fa-check' : 'fa-regular fa-copy'"></i>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="bat-section">
|
||||
<h2 class="bat-section-title">
|
||||
<span class="bat-step">2</span> {{ t('batocera.useTitle') }}
|
||||
</h2>
|
||||
<p class="bat-section-desc">{{ t('batocera.useDesc') }}</p>
|
||||
<div class="bat-code">
|
||||
<pre><code>{{ CLI_SNIPPET }}</code></pre>
|
||||
<button class="bat-copy" :title="t('batocera.copy')" @click="copy(CLI_SNIPPET)">
|
||||
<i :class="copied === CLI_SNIPPET ? 'fa-solid fa-check' : 'fa-regular fa-copy'"></i>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="bat-section">
|
||||
<h2 class="bat-section-title">{{ t('batocera.platformsTitle') }}</h2>
|
||||
<p class="bat-section-desc">{{ t('batocera.platformsDesc') }}</p>
|
||||
<ul class="bat-platforms">
|
||||
<li v-for="p in platforms" :key="p.platform" class="bat-platform">
|
||||
<i :class="p.icon" class="bat-platform-icon"></i>
|
||||
<span class="bat-platform-name">{{ p.label }}</span>
|
||||
<code class="bat-platform-ext">{{ p.ext }}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="bat-section bat-engine">
|
||||
<h2 class="bat-section-title">
|
||||
<i class="fa-solid fa-cubes bat-engine-icon"></i> {{ t('batocera.engineTitle') }}
|
||||
</h2>
|
||||
<p class="bat-section-desc">{{ t('batocera.engineDesc') }}</p>
|
||||
<a :href="ENGINE_URL" target="_blank" rel="noopener noreferrer" class="bat-link bat-link-slate">
|
||||
<i class="fa-solid fa-code-branch"></i> warp-engine-batocera-store
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<div class="bat-back">
|
||||
<RouterLink to="/catalog" class="bat-back-link">{{ t('catalogShow.back') }}</RouterLink>
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { CONFIG } from '../../lib/config'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const FORGE = 'https://git.teletypegames.org/tools'
|
||||
const REPO_URL = `${FORGE}/ttg-batocera-store`
|
||||
// The store is only a config; the client itself is a reusable engine that runs
|
||||
// against any WarpEngine site, so it gets its own repository and its own link.
|
||||
const ENGINE_URL = `${FORGE}/warp-engine-batocera-store`
|
||||
const WIKI_URL = `${CONFIG.wikiBase}/others/ttg-batocera-store`
|
||||
const BATOCERA_URL = 'https://batocera.org'
|
||||
|
||||
// The installer is served straight from the forge, so this one line is the
|
||||
// whole install on a Batocera box.
|
||||
const INSTALL_CMD = `curl -fsSL ${REPO_URL}/raw/branch/master/install.sh | bash`
|
||||
const RESTART_CMD = 'batocera-es-swissknife --restart'
|
||||
const STORE_CLI = '/userdata/system/batocera-store/ttg-store'
|
||||
const CLI_SNIPPET = [
|
||||
`${STORE_CLI} list # compatible catalog entries`,
|
||||
`${STORE_CLI} sync # download everything new`,
|
||||
`${STORE_CLI} remove c64demo`,
|
||||
].join('\n')
|
||||
|
||||
const platforms = [
|
||||
{ platform: 'c64', label: 'Commodore 64 (VICE)', ext: '.prg', icon: 'fa-solid fa-floppy-disk' },
|
||||
{ platform: 'tic80', label: 'TIC-80', ext: '.tic', icon: 'fa-solid fa-tv' },
|
||||
]
|
||||
|
||||
const copied = ref('')
|
||||
|
||||
async function copy(text: string) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
copied.value = text
|
||||
setTimeout(() => { if (copied.value === text) copied.value = '' }, 2000)
|
||||
} catch {
|
||||
// Clipboard API needs a secure context — the command stays selectable anyway.
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.bat-panel {
|
||||
@apply bg-white rounded-2xl shadow-xl border border-gray-100 p-6 md:p-8;
|
||||
}
|
||||
.bat-lead {
|
||||
@apply text-gray-600 leading-relaxed mb-6;
|
||||
}
|
||||
.bat-links {
|
||||
@apply flex flex-wrap gap-3;
|
||||
}
|
||||
.bat-link {
|
||||
@apply inline-flex items-center gap-2 font-bold py-2.5 px-5 rounded-xl text-sm text-white transition-all active:scale-95;
|
||||
}
|
||||
.bat-link-dark { @apply bg-slate-800 hover:bg-slate-900 shadow-lg shadow-slate-800/20; }
|
||||
.bat-link-slate { @apply bg-slate-600 hover:bg-slate-700 shadow-lg shadow-slate-600/20; }
|
||||
.bat-link-indigo { @apply bg-indigo-600 hover:bg-indigo-700 shadow-lg shadow-indigo-600/20; }
|
||||
.bat-link-emerald { @apply bg-emerald-600 hover:bg-emerald-700 shadow-lg shadow-emerald-600/20; }
|
||||
|
||||
.bat-section {
|
||||
@apply bg-white rounded-2xl shadow-xl border border-gray-100 p-6 md:p-8 mt-6;
|
||||
}
|
||||
.bat-section-title {
|
||||
@apply flex items-center gap-3 text-xl font-bold text-gray-900 mb-2;
|
||||
}
|
||||
.bat-step {
|
||||
@apply inline-flex items-center justify-center w-7 h-7 rounded-full bg-emerald-100 text-emerald-700 text-sm font-bold;
|
||||
}
|
||||
.bat-section-desc {
|
||||
@apply text-gray-600 mb-4;
|
||||
}
|
||||
.bat-note {
|
||||
@apply text-gray-600 mt-4 mb-3 text-sm;
|
||||
}
|
||||
.bat-code {
|
||||
@apply relative bg-gray-900 text-gray-100 rounded-xl overflow-x-auto;
|
||||
}
|
||||
.bat-code pre {
|
||||
@apply p-4 pr-14 font-mono text-sm leading-relaxed;
|
||||
}
|
||||
.bat-copy {
|
||||
@apply absolute top-2 right-2 w-9 h-9 rounded-lg bg-gray-800 text-gray-300 hover:bg-gray-700 hover:text-white transition-colors;
|
||||
}
|
||||
.bat-engine {
|
||||
@apply bg-gray-50;
|
||||
}
|
||||
.bat-engine-icon {
|
||||
@apply text-gray-400 text-lg;
|
||||
}
|
||||
.bat-platforms {
|
||||
@apply grid grid-cols-1 sm:grid-cols-2 gap-3;
|
||||
}
|
||||
.bat-platform {
|
||||
@apply flex items-center gap-3 bg-gray-50 border border-gray-100 rounded-xl px-4 py-3;
|
||||
}
|
||||
.bat-platform-icon {
|
||||
@apply text-gray-400;
|
||||
}
|
||||
.bat-platform-name {
|
||||
@apply font-medium text-gray-800 flex-grow;
|
||||
}
|
||||
.bat-platform-ext {
|
||||
@apply font-mono text-xs text-purple-600 bg-purple-50 px-2 py-0.5 rounded;
|
||||
}
|
||||
.bat-back {
|
||||
@apply mt-8 text-center;
|
||||
}
|
||||
.bat-back-link {
|
||||
@apply text-gray-400 hover:text-gray-600 text-sm font-medium transition-colors;
|
||||
}
|
||||
</style>
|
||||
@@ -120,6 +120,7 @@ const columnGroups = [
|
||||
color: 'group-amber',
|
||||
kinds: [
|
||||
{ kind: 'linux_x64', sub: '64 bit' },
|
||||
{ kind: 'linux_arm64', sub: 'ARM 64 bit' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -66,6 +66,10 @@
|
||||
<RouterLink to="/builds" class="builds-link">
|
||||
<i class="fa-solid fa-table-cells"></i> {{ t('builds.title') }}
|
||||
</RouterLink>
|
||||
<span class="builds-link-sep">|</span>
|
||||
<RouterLink to="/batocera" class="builds-link">
|
||||
<i class="fa-solid fa-gamepad"></i> {{ t('batocera.title') }}
|
||||
</RouterLink>
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
@@ -162,9 +166,12 @@ onMounted(() => store.fetch())
|
||||
@apply text-xs text-gray-400 font-medium ml-1;
|
||||
}
|
||||
.builds-link-row {
|
||||
@apply text-center mt-10;
|
||||
@apply flex flex-wrap items-center justify-center gap-3 mt-10;
|
||||
}
|
||||
.builds-link {
|
||||
@apply text-sm text-gray-400 hover:text-purple-600 font-medium transition-colors;
|
||||
}
|
||||
.builds-link-sep {
|
||||
@apply text-gray-200 text-sm;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -314,7 +314,7 @@ const downloadUrl = (path: string) =>
|
||||
// az asset-táblázat sorai és sorrendjük; a html nem letöltés, azt a Play gomb viszi
|
||||
const TABLE_KIND_ORDER = [
|
||||
'cartridge', 'source', 'docs',
|
||||
'win_x64', 'win_x86', 'linux_x64', 'linux_x86',
|
||||
'win_x64', 'win_x86', 'linux_x64', 'linux_arm64', 'linux_x86',
|
||||
'mac_universal', 'mac_arm64', 'mac_x64',
|
||||
]
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
|
||||
<div v-else class="engine-list">
|
||||
<article v-for="(page, index) in enginePages" :key="page.id" class="engine-card group">
|
||||
<article v-for="({ page, digest }, index) in cards" :key="page.id" class="engine-card group">
|
||||
<div class="engine-card-index">{{ String(index + 1).padStart(2, '0') }}</div>
|
||||
|
||||
<div class="engine-card-body">
|
||||
@@ -42,7 +42,21 @@
|
||||
</h2>
|
||||
|
||||
<p v-if="page.description" class="engine-card-desc">{{ page.description }}</p>
|
||||
<p v-if="page.content" class="engine-card-preview">{{ getCleanPreview(page.content) }}</p>
|
||||
<p v-if="digest.intro" class="engine-card-preview">{{ digest.intro }}</p>
|
||||
<p v-else-if="page.content" class="engine-card-preview">{{ getCleanPreview(page.content) }}</p>
|
||||
|
||||
<section v-if="digest.highlights.length" class="engine-highlights">
|
||||
<h3 v-if="digest.highlightsTitle" class="engine-highlights-title">{{ digest.highlightsTitle }}</h3>
|
||||
<ul class="engine-highlights-grid">
|
||||
<li v-for="(item, i) in digest.highlights" :key="i" class="engine-highlight">
|
||||
<span class="engine-highlight-icon"><i class="fa-solid fa-check"></i></span>
|
||||
<p class="engine-highlight-body">
|
||||
<strong v-if="item.title" class="engine-highlight-lead">{{ item.title }}</strong>
|
||||
<template v-if="item.title && item.text"> — </template>{{ item.text }}
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<div class="engine-card-actions">
|
||||
<a :href="exploreUrl(page)" target="_blank" rel="noopener" class="engine-explore-btn">
|
||||
@@ -62,11 +76,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { WIKI_BASE } from '../../api/wiki.api'
|
||||
import { useEnginesStore } from '../../stores/engines.store'
|
||||
import { useEnginesStore, getEngineDigest } from '../../stores/engines.store'
|
||||
import type { WikiPageWithContent } from '../../lib/interfaces/wiki.interface'
|
||||
import SkeletonCard from '../../components/SkeletonCard.vue'
|
||||
|
||||
@@ -76,6 +90,10 @@ const store = useEnginesStore()
|
||||
const { pages: enginePages, loading, error } = storeToRefs(store)
|
||||
const { getCleanPreview } = store
|
||||
|
||||
const cards = computed(() =>
|
||||
enginePages.value.map((page) => ({ page, digest: getEngineDigest(page.content) })),
|
||||
)
|
||||
|
||||
// Explore points at the engine's git repository (from wiki metadata);
|
||||
// pages without one fall back to their wiki page.
|
||||
const exploreUrl = (page: WikiPageWithContent): string =>
|
||||
@@ -135,6 +153,27 @@ onMounted(() => store.fetch())
|
||||
.engine-card-preview {
|
||||
@apply text-base text-slate-400 leading-relaxed mb-8 max-w-3xl;
|
||||
}
|
||||
.engine-highlights {
|
||||
@apply mb-10;
|
||||
}
|
||||
.engine-highlights-title {
|
||||
@apply text-xs font-bold uppercase tracking-[0.2em] text-emerald-400 mb-5;
|
||||
}
|
||||
.engine-highlights-grid {
|
||||
@apply grid md:grid-cols-2 gap-x-10 gap-y-4 max-w-4xl;
|
||||
}
|
||||
.engine-highlight {
|
||||
@apply flex items-start gap-3;
|
||||
}
|
||||
.engine-highlight-icon {
|
||||
@apply mt-1 flex h-5 w-5 flex-none items-center justify-center rounded-md bg-emerald-500/15 text-emerald-400 text-[10px];
|
||||
}
|
||||
.engine-highlight-body {
|
||||
@apply text-sm text-slate-400 leading-relaxed;
|
||||
}
|
||||
.engine-highlight-lead {
|
||||
@apply text-white font-semibold;
|
||||
}
|
||||
.engine-card-actions {
|
||||
@apply flex flex-wrap items-center gap-6;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
|
||||
export const batoceraRouter: RouteRecordRaw[] = [
|
||||
{ path: '/batocera', name: 'batoceraIndex', component: () => import('../page/batocera/BatoceraIndexPage.vue') },
|
||||
]
|
||||
@@ -8,6 +8,7 @@ import { enginesRouter } from './engines.router'
|
||||
import { howtosRouter } from './howtos.router'
|
||||
import { teamRouter } from './team.router'
|
||||
import { buildsRouter } from './builds.router'
|
||||
import { batoceraRouter } from './batocera.router'
|
||||
|
||||
export const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
@@ -21,6 +22,7 @@ export const router = createRouter({
|
||||
...howtosRouter,
|
||||
...teamRouter,
|
||||
...buildsRouter,
|
||||
...batoceraRouter,
|
||||
],
|
||||
scrollBehavior() {
|
||||
return { top: 0 }
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { getEngineDigest } from '../engines.store'
|
||||
|
||||
// Generic markdown in the shape every engine-tagged wiki page must follow:
|
||||
// intro paragraph, then "What You Get" as the first heading with bullets.
|
||||
// Dummy text only — real content always comes from the wiki at runtime.
|
||||
const SAMPLE_MARKDOWN = `
|
||||
> Example Engine is a **sample** framework that turns markdown into landing cards.
|
||||
|
||||
# What You Get
|
||||
|
||||
- **First feature**: some \`inline code\` — with a longer explanation.
|
||||
- **Second feature**: a [link](https://example.org) inside the text.
|
||||
- Plain bullet without a bold lead.
|
||||
|
||||
# Later Section
|
||||
|
||||
- **Not picked up**: a list under a later heading.
|
||||
`
|
||||
|
||||
describe('getEngineDigest', () => {
|
||||
it('extracts the intro from the leading blockquote with inline markdown stripped', () => {
|
||||
const digest = getEngineDigest(SAMPLE_MARKDOWN)
|
||||
expect(digest.intro).toBe(
|
||||
'Example Engine is a sample framework that turns markdown into landing cards.',
|
||||
)
|
||||
})
|
||||
|
||||
it('takes the What You Get heading as the highlights title', () => {
|
||||
expect(getEngineDigest(SAMPLE_MARKDOWN).highlightsTitle).toBe('What You Get')
|
||||
})
|
||||
|
||||
it('parses bold-lead bullets into title and text', () => {
|
||||
const [first, second] = getEngineDigest(SAMPLE_MARKDOWN).highlights
|
||||
expect(first).toEqual({
|
||||
title: 'First feature',
|
||||
text: 'some inline code — with a longer explanation.',
|
||||
})
|
||||
expect(second).toEqual({
|
||||
title: 'Second feature',
|
||||
text: 'a link inside the text.',
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps bullets without a bold lead as plain text', () => {
|
||||
const third = getEngineDigest(SAMPLE_MARKDOWN).highlights[2]
|
||||
expect(third).toEqual({ title: '', text: 'Plain bullet without a bold lead.' })
|
||||
})
|
||||
|
||||
it('stops at the heading after the What You Get section', () => {
|
||||
expect(getEngineDigest(SAMPLE_MARKDOWN).highlights).toHaveLength(3)
|
||||
})
|
||||
|
||||
it('matches the heading case-insensitively', () => {
|
||||
const digest = getEngineDigest('# WHAT you get\n- **A**: b.')
|
||||
expect(digest.highlights).toEqual([{ title: 'A', text: 'b.' }])
|
||||
})
|
||||
|
||||
it('yields no highlights when the first heading is not What You Get', () => {
|
||||
const digest = getEngineDigest('Intro line.\n\n# Features\n- **A**: b.\n\n# What You Get\n- **C**: d.')
|
||||
expect(digest.intro).toBe('Intro line.')
|
||||
expect(digest.highlights).toEqual([])
|
||||
})
|
||||
|
||||
it('caps the highlights at six items', () => {
|
||||
const many = '# What You Get\n' + Array.from({ length: 9 }, (_, i) => `- item ${i}`).join('\n')
|
||||
expect(getEngineDigest(many).highlights).toHaveLength(6)
|
||||
})
|
||||
|
||||
it('uses the first paragraph as intro when there is no blockquote', () => {
|
||||
const digest = getEngineDigest('Just a plain paragraph.\n\n---\n\n# What You Get\n- one')
|
||||
expect(digest.intro).toBe('Just a plain paragraph.')
|
||||
expect(digest.highlights).toEqual([{ title: '', text: 'one' }])
|
||||
})
|
||||
|
||||
it('returns an empty digest for empty content', () => {
|
||||
expect(getEngineDigest('')).toEqual({ intro: '', highlightsTitle: '', highlights: [] })
|
||||
})
|
||||
})
|
||||
@@ -4,6 +4,75 @@ import wikiApi from '../api/wiki.api'
|
||||
import { useLoadable } from '../composables/useLoadable'
|
||||
import type { WikiPageWithContent } from '../lib/interfaces/wiki.interface'
|
||||
|
||||
export interface EngineHighlight {
|
||||
title: string
|
||||
text: string
|
||||
}
|
||||
|
||||
// Landing-page digest of a wiki engine page. Convention: every engine-tagged
|
||||
// page opens with an intro paragraph, then a "What You Get" heading as its
|
||||
// first heading, with the feature bullets underneath.
|
||||
export interface EngineDigest {
|
||||
intro: string
|
||||
highlightsTitle: string
|
||||
highlights: EngineHighlight[]
|
||||
}
|
||||
|
||||
const HIGHLIGHTS_HEADING = 'what you get'
|
||||
const MAX_HIGHLIGHTS = 6
|
||||
|
||||
// Inline markdown (links, bold, code) stripped so the text reads as plain prose.
|
||||
function stripInline(md: string): string {
|
||||
return md
|
||||
.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
|
||||
.replace(/\*\*([^*]+)\*\*/g, '$1')
|
||||
.replace(/[*_`]/g, '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim()
|
||||
}
|
||||
|
||||
export function getEngineDigest(content: string): EngineDigest {
|
||||
const digest: EngineDigest = { intro: '', highlightsTitle: '', highlights: [] }
|
||||
let inHighlights = false
|
||||
|
||||
for (const raw of (content || '').split('\n')) {
|
||||
const line = raw.trim()
|
||||
if (!line || /^([-*_])\1{2,}$/.test(line)) continue
|
||||
|
||||
const heading = line.match(/^#{1,6}\s+(.*)$/)
|
||||
if (heading) {
|
||||
// The section ends at the next heading; and if the page's first heading
|
||||
// is not "What You Get", it doesn't follow the convention — no highlights.
|
||||
if (inHighlights) break
|
||||
const title = stripInline(heading[1])
|
||||
if (title.toLowerCase() !== HIGHLIGHTS_HEADING) break
|
||||
inHighlights = true
|
||||
digest.highlightsTitle = title
|
||||
continue
|
||||
}
|
||||
|
||||
if (inHighlights) {
|
||||
const bullet = line.match(/^[-*]\s+(.*)$/)
|
||||
if (!bullet) continue
|
||||
const lead = bullet[1].match(/^\*\*([^*]+)\*\*\s*[:—–-]?\s*(.*)$/)
|
||||
digest.highlights.push(
|
||||
lead
|
||||
? { title: stripInline(lead[1]), text: stripInline(lead[2]) }
|
||||
: { title: '', text: stripInline(bullet[1]) },
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
// First prose line (paragraph or blockquote) before the heading is the intro.
|
||||
if (!digest.intro) {
|
||||
digest.intro = stripInline(line.replace(/^>\s*/, ''))
|
||||
}
|
||||
}
|
||||
|
||||
digest.highlights = digest.highlights.slice(0, MAX_HIGHLIGHTS)
|
||||
return digest
|
||||
}
|
||||
|
||||
export const useEnginesStore = defineStore('engines', () => {
|
||||
const pages = ref<WikiPageWithContent[]>([])
|
||||
const { loading, error, withCache, invalidate } = useLoadable()
|
||||
@@ -19,5 +88,5 @@ export const useEnginesStore = defineStore('engines', () => {
|
||||
return content.replace(/[#*`_[\]()>|-]/g, '').replace(/\s+/g, ' ').trim().slice(0, 260) + '...'
|
||||
}
|
||||
|
||||
return { pages, loading, error, fetch, getCleanPreview, invalidate }
|
||||
return { pages, loading, error, fetch, getCleanPreview, getEngineDigest, invalidate }
|
||||
})
|
||||
|
||||
@@ -2,3 +2,4 @@ log/
|
||||
spec/dummy/log/
|
||||
spec/dummy/tmp/
|
||||
Gemfile.lock
|
||||
.bundle/
|
||||
|
||||
@@ -18,6 +18,12 @@ Repository: `https://git.teletypegames.org/tools/warp_engine`
|
||||
box: TIC-80, Ebitengine, LÖVE, C64, Godot, Bevy, Phaser. Authenticated by
|
||||
a shared secret or by per-owner database tokens with expiry and scopes
|
||||
(`ApplicationToken`, managed in the admin).
|
||||
- **Pluggable storage**: artifacts are served through a storage adapter
|
||||
(`:local` by default); a host can serve them from an object store without
|
||||
patching the engine.
|
||||
- **Publish events**: every published release emits
|
||||
`ActiveSupport::Notifications` (`warp_engine.publish`), so hosts can react
|
||||
to new builds without model callbacks.
|
||||
- **Public JSON API**: catalog listing, highlighted title, per-platform build
|
||||
matrix, image serving, download tracking, and a static file server for
|
||||
web-playable builds.
|
||||
@@ -26,6 +32,10 @@ Repository: `https://git.teletypegames.org/tools/warp_engine`
|
||||
image library with orphan cleanup, a file manager with a picker mode, and
|
||||
download statistics. Without ActiveAdmin the engine runs headless
|
||||
(API + updater only).
|
||||
- **Woodpecker CI management (optional)**: with a Woodpecker API token
|
||||
configured, the admin also gains repo sync, per-repo pipeline history
|
||||
with manual triggers, and automatic provisioning of application tokens
|
||||
as Woodpecker secrets.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -285,6 +295,98 @@ an empty map (default) disables the feature. Set the Woodpecker side with
|
||||
per-repo in Settings → Extensions). Templates live in
|
||||
`app/services/warp_engine/platforms/<platform>/pipeline.yaml.erb`.
|
||||
|
||||
## Woodpecker CI management
|
||||
|
||||
Beyond serving pipeline configs, WarpEngine can drive the Woodpecker REST API
|
||||
itself. Set `woodpecker_url` and `woodpecker_api_token` — while either is nil
|
||||
(the default), every management feature stays inactive and the admin pages
|
||||
hide themselves:
|
||||
|
||||
```ruby
|
||||
c.woodpecker_url = ENV["WOODPECKER_URL"] # e.g. "https://ci.example.org"
|
||||
c.woodpecker_api_token = ENV["WOODPECKER_API_TOKEN"] # PAT of a Woodpecker *instance admin*
|
||||
c.woodpecker_repo_owner = ENV["WOODPECKER_REPO_OWNER"] # forge org the game repos live under
|
||||
```
|
||||
|
||||
What it unlocks (all surfaced in the admin):
|
||||
|
||||
- **Repo sync** (*Pipelines → Sync from Woodpecker*): mirrors the Woodpecker
|
||||
repo list into `Pipeline` records, auto-matching each repo to a catalog
|
||||
`Software` by name; repos that disappear from Woodpecker are deactivated.
|
||||
Platform and software links are editable by hand afterwards.
|
||||
- **Pipeline history**: each entry on the *Pipelines* page lists its recent
|
||||
runs with a manual *Trigger* action; the newest run refreshes the cached
|
||||
last-pipeline status shown on the Pipelines index. The software's admin
|
||||
page links to its pipelines from the Quick Links sidebar.
|
||||
- **Secret provisioning**: database application tokens are pushed to the
|
||||
repos as the `application_token` Woodpecker secret — creating a token
|
||||
provisions it to its owner's repos (unrestricted tokens to all active
|
||||
repos), deleting a token removes the secret, and *Rotate* creates a
|
||||
replacement token, provisions it everywhere and revokes the old one in a
|
||||
single step.
|
||||
|
||||
The API token must belong to a Woodpecker **instance admin** — listing the
|
||||
server's repos is an admin-only endpoint (anything less yields
|
||||
`403 User not authorized`). Add the user to `WOODPECKER_ADMIN` on the
|
||||
Woodpecker server, then log out and back in: the admin flag is written to
|
||||
the user record at login, a server restart alone is not enough.
|
||||
|
||||
## Storage
|
||||
|
||||
Build artifacts are served through a storage adapter. The default is the
|
||||
local filesystem under `file_container_path` — byte for byte the behaviour
|
||||
the engine always had:
|
||||
|
||||
```ruby
|
||||
c.storage_adapter = :local # default
|
||||
```
|
||||
|
||||
A host that keeps its artifacts elsewhere (an object store behind a CDN, for
|
||||
example) can plug in its own object instead of patching the engine. The
|
||||
contract is three methods:
|
||||
|
||||
```ruby
|
||||
class MyObjectStore
|
||||
def file?(relative_path) = ... # true/false
|
||||
def directory?(relative_path) = ... # true/false
|
||||
|
||||
# Return a WarpEngine::Storage::Location:
|
||||
# Location.file(absolute_path) — the engine will send_file it
|
||||
# Location.redirect(url) — the engine will redirect (signed URL)
|
||||
def locate(relative_path, filename: nil, expires_in: nil) = ...
|
||||
end
|
||||
|
||||
c.storage_adapter = MyObjectStore.new
|
||||
```
|
||||
|
||||
`GET /api/download` and `GET /file/*` both go through the adapter, so a
|
||||
signing adapter turns them into redirects without any further change.
|
||||
`WarpEngine::DownloadService#create` still returns an absolute path (and
|
||||
`nil` when there is none), so existing callers keep working;
|
||||
`#locate` is the new entry point that can also hand back a redirect.
|
||||
|
||||
**Serving only.** Ingestion — `POST /build/upload`, archive extraction and
|
||||
the admin file manager — still writes to the local disk. A remote adapter
|
||||
needs its own upload path today.
|
||||
|
||||
## Publish events
|
||||
|
||||
Publishing a release emits an `ActiveSupport::Notifications` event, so a host
|
||||
can react to a new build without hanging a callback on the models:
|
||||
|
||||
```ruby
|
||||
ActiveSupport::Notifications.subscribe("warp_engine.publish") do |*, payload|
|
||||
payload[:software] # WarpEngine::Software
|
||||
payload[:release] # WarpEngine::Release
|
||||
payload[:platform] # "godot"
|
||||
payload[:name] # "mygame"
|
||||
payload[:version] # "1.2.0"
|
||||
end
|
||||
```
|
||||
|
||||
Hosts that must support older engine versions can feature-detect with
|
||||
`WarpEngine.respond_to?(:instruments_publish?) && WarpEngine.instruments_publish?`.
|
||||
|
||||
## Public API
|
||||
|
||||
| Endpoint | Purpose |
|
||||
|
||||
@@ -60,11 +60,11 @@ ActiveAdmin.register WarpEngine::ApplicationToken, as: "Application Token" do
|
||||
end
|
||||
|
||||
member_action :rotate, method: :post do
|
||||
result = WarpEngine::CiSecretSyncService.new.rotate(resource)
|
||||
result = WarpEngine::SecretSyncService.new.rotate(resource)
|
||||
if result[:rotated]
|
||||
session[:warp_engine_plain_token] = result[:new_token].plain_token
|
||||
redirect_to resource_path(result[:new_token]),
|
||||
notice: "Token rotated and synced to #{result.dig(:sync_result, :synced)&.size || 0} repo(s)"
|
||||
notice: "Token rotated and synced to #{result.dig(:sync_result, :synced)&.size || 0} pipeline(s)"
|
||||
else
|
||||
redirect_to resource_path(resource),
|
||||
alert: "Rotation failed: #{result[:reason]}"
|
||||
@@ -101,13 +101,13 @@ ActiveAdmin.register WarpEngine::ApplicationToken, as: "Application Token" do
|
||||
session[:warp_engine_plain_token] = resource.plain_token
|
||||
|
||||
if WarpEngine.woodpecker_configured?
|
||||
service = WarpEngine::CiSecretSyncService.new
|
||||
repos = service.repos_for_token(resource)
|
||||
if repos.any?
|
||||
result = service.provision(resource.plain_token, repos: repos)
|
||||
flash[:notice] = "Token created and synced to #{result[:synced].size} repo(s)."
|
||||
service = WarpEngine::SecretSyncService.new
|
||||
pipelines = service.pipelines_for_token(resource)
|
||||
if pipelines.any?
|
||||
result = service.provision(resource.plain_token, pipelines: pipelines)
|
||||
flash[:notice] = "Token created and synced to #{result[:synced].size} pipeline(s)."
|
||||
if result[:failed].any?
|
||||
flash[:alert] = "Failed to sync to #{result[:failed].size} repo(s)."
|
||||
flash[:alert] = "Failed to sync to #{result[:failed].size} pipeline(s)."
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -124,7 +124,7 @@ ActiveAdmin.register WarpEngine::ApplicationToken, as: "Application Token" do
|
||||
|
||||
def destroy
|
||||
if WarpEngine.woodpecker_configured?
|
||||
WarpEngine::CiSecretSyncService.new.deprovision(resource)
|
||||
WarpEngine::SecretSyncService.new.deprovision(resource)
|
||||
end
|
||||
resource.revoke!
|
||||
redirect_to collection_path, notice: "Token revoked and Woodpecker secrets cleaned up."
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
ActiveAdmin.register_page "CI Dashboard" do
|
||||
menu parent: "🌀 WarpEngine", priority: 11, label: "🚀 CI Dashboard"
|
||||
|
||||
content do
|
||||
if WarpEngine.woodpecker_configured?
|
||||
begin
|
||||
entries = WarpEngine::CiPipelineService.new.dashboard
|
||||
rescue => e
|
||||
entries = []
|
||||
div class: "flash flash_alert" do
|
||||
"Error connecting to Woodpecker: #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
entries.group_by { |e| e[:repo].platform }.sort.each do |platform, group|
|
||||
panel platform.titleize do
|
||||
table_for group do
|
||||
column("Repository") { |e| link_to e[:repo].full_name, admin_ci_repository_path(e[:repo]) }
|
||||
column("Software") { |e| e[:repo].software ? link_to(e[:repo].software.title, admin_software_path(e[:repo].software)) : "-" }
|
||||
column("Status") { |e|
|
||||
if e[:pipeline]
|
||||
status_tag e[:pipeline]["status"],
|
||||
class: e[:pipeline]["status"] == "success" ? "ok" : "error"
|
||||
else
|
||||
status_tag "unknown", class: "warning"
|
||||
end
|
||||
}
|
||||
column("Branch") { |e| e.dig(:pipeline, "branch") || "-" }
|
||||
column("When") { |e| e.dig(:pipeline, "created_at") || "-" }
|
||||
column("Actions") { |e|
|
||||
if e[:repo].active
|
||||
text_node link_to("Trigger", trigger_admin_ci_repository_path(e[:repo]),
|
||||
method: :post, class: "member_link")
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if entries.empty?
|
||||
para "No CI repositories tracked. Sync repos from the CI Repos page.",
|
||||
style: "color:#999;text-align:center;padding:40px 0;"
|
||||
end
|
||||
else
|
||||
para "Woodpecker is not configured. Set woodpecker_url and woodpecker_api_token in the WarpEngine initializer.",
|
||||
style: "color:#999;text-align:center;padding:40px 0;"
|
||||
end
|
||||
end
|
||||
end
|
||||
+29
-21
@@ -1,7 +1,7 @@
|
||||
ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
|
||||
ActiveAdmin.register WarpEngine::Pipeline, as: "Pipeline" do
|
||||
actions :index, :show, :edit, :update
|
||||
|
||||
menu parent: "🌀 WarpEngine", priority: 10, label: "🔧 CI Repos"
|
||||
menu parent: "🌀 WarpEngine", priority: 10, label: "🚀 Pipelines"
|
||||
|
||||
config.sort_order = "repo_name_asc"
|
||||
config.batch_actions = false
|
||||
@@ -20,19 +20,19 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
|
||||
column :repo_name
|
||||
column :platform
|
||||
column("Software") { |r| r.software ? link_to(r.software.title, admin_software_path(r.software)) : "-" }
|
||||
column(:active) { |r| status_tag(r.active ? "active" : "inactive", class: r.active ? "ok" : "warning") }
|
||||
column(:active) { |r| status_tag(r.active ? "active" : "inactive", class: r.active ? "yes" : "no") }
|
||||
column("Pipeline") { |r|
|
||||
if r.last_pipeline_status
|
||||
status_tag r.last_pipeline_status,
|
||||
class: r.last_pipeline_status == "success" ? "ok" : "error"
|
||||
class: r.last_pipeline_status == "success" ? "yes" : "no"
|
||||
else
|
||||
"-"
|
||||
end
|
||||
}
|
||||
column :last_pipeline_at
|
||||
actions defaults: true do |repo|
|
||||
if repo.active && WarpEngine.woodpecker_configured?
|
||||
item "Trigger", trigger_admin_ci_repository_path(repo), method: :post, class: "member_link"
|
||||
actions defaults: true do |pipeline|
|
||||
if pipeline.active && WarpEngine.woodpecker_configured?
|
||||
item "Trigger", trigger_admin_pipeline_path(pipeline), method: :post, class: "member_link"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -51,32 +51,40 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
|
||||
f.actions
|
||||
end
|
||||
|
||||
show do
|
||||
attributes_table do
|
||||
sidebar "Details", only: :show do
|
||||
attributes_table_for resource do
|
||||
row :id
|
||||
row :woodpecker_repo_id
|
||||
row :repo_owner
|
||||
row :repo_name
|
||||
row :platform
|
||||
row("Software") { |r| r.software ? link_to(r.software.title, admin_software_path(r.software)) : "-" }
|
||||
row(:active) { |r| status_tag(r.active ? "active" : "inactive") }
|
||||
row(:active) { |r| status_tag(r.active ? "active" : "inactive", class: r.active ? "yes" : "no") }
|
||||
row :last_pipeline_status
|
||||
row :last_pipeline_at
|
||||
row :created_at
|
||||
row :updated_at
|
||||
end
|
||||
end
|
||||
|
||||
if WarpEngine.woodpecker_configured? && resource.active
|
||||
panel "Recent Pipelines" do
|
||||
show do
|
||||
panel "Pipelines" do
|
||||
if !WarpEngine.woodpecker_configured?
|
||||
para "Woodpecker is not configured. Set woodpecker_url and woodpecker_api_token in the WarpEngine initializer.",
|
||||
style: "color:#999;"
|
||||
elsif !resource.active
|
||||
para "This repository is inactive.", style: "color:#999;"
|
||||
else
|
||||
begin
|
||||
pipelines = WarpEngine::CiPipelineService.new.list_pipelines(resource, page: 1)
|
||||
pipelines = WarpEngine::PipelineService.new.list_pipelines(resource, page: 1)
|
||||
if pipelines.is_a?(Array) && pipelines.any?
|
||||
table_for pipelines.first(10) do
|
||||
column("Number") { |p| p["number"] }
|
||||
column("Status") { |p| status_tag p["status"], class: p["status"] == "success" ? "ok" : "error" }
|
||||
column("Status") { |p| status_tag p["status"], class: p["status"] == "success" ? "yes" : "no" }
|
||||
column("Branch") { |p| p["branch"] }
|
||||
column("Message") { |p| p["message"]&.truncate(60) }
|
||||
column("Created") { |p| p["created_at"] }
|
||||
# Woodpecker returns unix epoch seconds in "created"
|
||||
column("Created") { |p| p["created"] ? Time.zone.at(p["created"]).strftime("%Y-%m-%d %H:%M") : "-" }
|
||||
end
|
||||
else
|
||||
para "No pipelines found.", style: "color:#999;"
|
||||
@@ -89,15 +97,15 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
|
||||
end
|
||||
|
||||
member_action :trigger, method: :post do
|
||||
repo = WarpEngine::CiRepository.find(params[:id])
|
||||
WarpEngine::CiPipelineService.new.trigger(repo)
|
||||
redirect_to resource_path(repo), notice: "Pipeline triggered for #{repo.full_name}"
|
||||
pipeline = WarpEngine::Pipeline.find(params[:id])
|
||||
WarpEngine::PipelineService.new.trigger(pipeline)
|
||||
redirect_to resource_path(pipeline), notice: "Pipeline triggered for #{pipeline.full_name}"
|
||||
rescue => e
|
||||
redirect_to resource_path(repo), alert: "Trigger failed: #{e.message}"
|
||||
redirect_to resource_path(pipeline), alert: "Trigger failed: #{e.message}"
|
||||
end
|
||||
|
||||
collection_action :sync, method: :post do
|
||||
result = WarpEngine::CiRepoSyncService.new.sync_all
|
||||
result = WarpEngine::PipelineSyncService.new.sync_all
|
||||
redirect_to collection_path,
|
||||
notice: "Synced: #{result[:created].size} new, #{result[:updated].size} updated, #{result[:deactivated].size} deactivated"
|
||||
rescue => e
|
||||
@@ -106,7 +114,7 @@ ActiveAdmin.register WarpEngine::CiRepository, as: "CI Repository" do
|
||||
|
||||
action_item :sync_repos, only: :index do
|
||||
if WarpEngine.woodpecker_configured?
|
||||
link_to "Sync from Woodpecker", sync_admin_ci_repositories_path, method: :post
|
||||
link_to "Sync from Woodpecker", sync_admin_pipelines_path, method: :post
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,6 +52,15 @@ ActiveAdmin.register WarpEngine::Software, as: "Software" do
|
||||
text_node "View on site"
|
||||
end
|
||||
end
|
||||
|
||||
if resource.pipeline
|
||||
div style: "margin-bottom:8px;" do
|
||||
a href: admin_pipeline_path(resource.pipeline), style: "display:inline-flex;align-items:center;gap:6px;font-weight:bold;color:#5850ec;" do
|
||||
span "🚀", style: "font-size:16px;"
|
||||
text_node "Pipelines"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
sidebar "Download Statistics", only: :show do
|
||||
|
||||
@@ -6,36 +6,36 @@ module WarpEngine
|
||||
before_action :require_woodpecker!
|
||||
|
||||
resource_description do
|
||||
short "CI repository and pipeline management"
|
||||
short "CI pipeline management"
|
||||
end
|
||||
|
||||
api :GET, "/api/ci/repos", "List active CI repositories"
|
||||
returns code: 200, desc: "JSON array of tracked repos"
|
||||
api :GET, "/api/ci/pipelines", "List active pipelines"
|
||||
returns code: 200, desc: "JSON array of tracked pipelines"
|
||||
error code: 503, desc: "Woodpecker not configured"
|
||||
def repos
|
||||
records = CiRepository.active.includes(:software)
|
||||
render json: records.map { |r| repo_json(r) }
|
||||
def pipelines
|
||||
records = Pipeline.active.includes(:software)
|
||||
render json: records.map { |p| pipeline_json(p) }
|
||||
end
|
||||
|
||||
api :GET, "/api/ci/repos/:id/status", "Get a CI repository with its latest pipeline"
|
||||
param :id, :number, required: true, desc: "CiRepository id"
|
||||
returns code: 200, desc: "JSON with repo and pipeline data"
|
||||
api :GET, "/api/ci/pipelines/:id/status", "Get a pipeline with its latest run"
|
||||
param :id, :number, required: true, desc: "Pipeline id"
|
||||
returns code: 200, desc: "JSON with pipeline and latest run data"
|
||||
error code: 503, desc: "Woodpecker not configured"
|
||||
def status
|
||||
repo = CiRepository.find(params[:id])
|
||||
pipeline = begin
|
||||
CiPipelineService.new.pipeline_detail(repo, "latest")
|
||||
pipeline = Pipeline.find(params[:id])
|
||||
latest_run = begin
|
||||
PipelineService.new.pipeline_detail(pipeline, "latest")
|
||||
rescue WoodpeckerClient::ApiError
|
||||
nil
|
||||
end
|
||||
render json: { repo: repo_json(repo), pipeline: pipeline }
|
||||
render json: { pipeline: pipeline_json(pipeline), latest_run: latest_run }
|
||||
end
|
||||
|
||||
api :POST, "/api/ci/repos/:id/trigger", "Trigger a pipeline for a CI repository"
|
||||
api :POST, "/api/ci/pipelines/:id/trigger", "Trigger a pipeline"
|
||||
header "X-Update-Secret", "Shared secret or application token (update scope)", required: true
|
||||
param :id, :number, required: true, desc: "CiRepository id"
|
||||
param :id, :number, required: true, desc: "Pipeline id"
|
||||
param :branch, String, required: false, desc: "Branch to build (default: main)"
|
||||
returns code: 200, desc: "JSON with triggered pipeline data"
|
||||
returns code: 200, desc: "JSON with triggered run data"
|
||||
error code: 401, desc: "Invalid secret"
|
||||
error code: 503, desc: "Woodpecker not configured"
|
||||
def trigger
|
||||
@@ -43,8 +43,8 @@ module WarpEngine
|
||||
return render json: { error: "Unauthorized" }, status: :unauthorized
|
||||
end
|
||||
|
||||
repo = CiRepository.find(params[:id])
|
||||
result = CiPipelineService.new.trigger(repo, branch: params[:branch] || "main")
|
||||
pipeline = Pipeline.find(params[:id])
|
||||
result = PipelineService.new.trigger(pipeline, branch: params[:branch] || "main")
|
||||
render json: { triggered: true, pipeline: result }
|
||||
end
|
||||
|
||||
@@ -56,17 +56,17 @@ module WarpEngine
|
||||
render json: { error: "Woodpecker not configured" }, status: :service_unavailable
|
||||
end
|
||||
|
||||
def repo_json(repo)
|
||||
def pipeline_json(pipeline)
|
||||
{
|
||||
id: repo.id,
|
||||
woodpecker_repo_id: repo.woodpecker_repo_id,
|
||||
repo_owner: repo.repo_owner,
|
||||
repo_name: repo.repo_name,
|
||||
platform: repo.platform,
|
||||
active: repo.active,
|
||||
software_name: repo.software&.name,
|
||||
last_pipeline_status: repo.last_pipeline_status,
|
||||
last_pipeline_at: repo.last_pipeline_at
|
||||
id: pipeline.id,
|
||||
woodpecker_repo_id: pipeline.woodpecker_repo_id,
|
||||
repo_owner: pipeline.repo_owner,
|
||||
repo_name: pipeline.repo_name,
|
||||
platform: pipeline.platform,
|
||||
active: pipeline.active,
|
||||
software_name: pipeline.software&.name,
|
||||
last_pipeline_status: pipeline.last_pipeline_status,
|
||||
last_pipeline_at: pipeline.last_pipeline_at
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,23 +8,26 @@ module WarpEngine
|
||||
api :GET, "/api/download", "Download a file by path"
|
||||
param :path, String, required: true, desc: "File path to download"
|
||||
returns code: 200, desc: "File binary data"
|
||||
returns code: 302, desc: "Redirect to the storage location (non-local storage adapter)"
|
||||
error code: 400, desc: "Path is blank"
|
||||
error code: 404, desc: "File not found"
|
||||
def show
|
||||
path = params[:path]
|
||||
return render(json: { error: "Path is required" }, status: :bad_request) if path.blank?
|
||||
|
||||
full_path = WarpEngine::DownloadService.new.create(
|
||||
location = WarpEngine::DownloadService.new.locate(
|
||||
path: path,
|
||||
ip: request.remote_ip,
|
||||
user_agent: request.user_agent,
|
||||
referer: request.referer
|
||||
)
|
||||
|
||||
if full_path
|
||||
send_file full_path, disposition: "attachment", type: resolve_mime(full_path)
|
||||
else
|
||||
if location.nil?
|
||||
render json: { error: "Not found" }, status: :not_found
|
||||
elsif location.redirect?
|
||||
redirect_to location.url, allow_other_host: true
|
||||
else
|
||||
send_file location.path, disposition: "attachment", type: resolve_mime(location.path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
module WarpEngine
|
||||
class CiRepoSyncJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform
|
||||
CiRepoSyncService.new.sync_all
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
module WarpEngine
|
||||
class PipelineSyncJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform
|
||||
PipelineSyncService.new.sync_all
|
||||
end
|
||||
end
|
||||
end
|
||||
+8
-4
@@ -1,6 +1,10 @@
|
||||
module WarpEngine
|
||||
class CiRepository < ApplicationRecord
|
||||
self.table_name = "ci_repositories"
|
||||
class Pipeline < ApplicationRecord
|
||||
self.table_name = "pipelines"
|
||||
|
||||
# Repos synced from Woodpecker without a matching Software land here
|
||||
# until a platform is assigned by hand.
|
||||
UNKNOWN_PLATFORM = "unknown".freeze
|
||||
|
||||
belongs_to :software, class_name: "WarpEngine::Software", optional: true
|
||||
|
||||
@@ -10,7 +14,7 @@ module WarpEngine
|
||||
validates :repo_owner, presence: true
|
||||
validates :repo_name, presence: true
|
||||
validates :platform, presence: true,
|
||||
inclusion: { in: WarpEngine::PlatformLink::SUPPORTED_PLATFORMS }
|
||||
inclusion: { in: WarpEngine::PlatformLink::SUPPORTED_PLATFORMS + [ UNKNOWN_PLATFORM ] }
|
||||
|
||||
scope :active, -> { where(active: true) }
|
||||
|
||||
@@ -27,6 +31,6 @@ module WarpEngine
|
||||
%w[software]
|
||||
end
|
||||
|
||||
ActiveSupport.run_load_hooks(:warp_engine_ci_repository, self)
|
||||
ActiveSupport.run_load_hooks(:warp_engine_pipeline, self)
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
module WarpEngine
|
||||
class ReleaseAsset < ApplicationRecord
|
||||
KINDS = %w[cartridge source html docs
|
||||
win_x86 win_x64 linux_x86 linux_x64
|
||||
win_x86 win_x64 linux_x86 linux_x64 linux_arm64
|
||||
mac_x64 mac_arm64 mac_universal].freeze
|
||||
|
||||
belongs_to :release
|
||||
|
||||
@@ -11,7 +11,7 @@ module WarpEngine
|
||||
has_many :releases, foreign_key: :software_id
|
||||
has_many :downloads, through: :releases
|
||||
has_many :external_links, foreign_key: :software_id
|
||||
has_one :ci_repository, foreign_key: :software_id
|
||||
has_one :pipeline, foreign_key: :software_id
|
||||
|
||||
accepts_nested_attributes_for :software_images, allow_destroy: true
|
||||
accepts_nested_attributes_for :external_links, allow_destroy: true
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
module WarpEngine
|
||||
module Platforms
|
||||
module Builds
|
||||
# Linux on 64-bit ARM: Raspberry Pi 4/5, Odroid, and the retro handhelds.
|
||||
# Batocera and the ES-family distributions run on these as much as on
|
||||
# x86_64, and an x64 binary installs there but will not start — which is
|
||||
# why this is a separate kind rather than something linux_x64 can cover.
|
||||
#
|
||||
# Include this in a platform service only once its pipeline actually
|
||||
# produces the artifact: registering the kind makes /api/builds report it
|
||||
# as missing for every release until then.
|
||||
module BuildLinuxArm64
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
register_expected_kind "linux_arm64"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def linux_arm64_asset_path(versioned)
|
||||
path = full_path("#{versioned}-linux-arm64.zip")
|
||||
{ "linux_arm64" => path } if File.file?(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,38 +0,0 @@
|
||||
module WarpEngine
|
||||
class CiPipelineService
|
||||
def initialize(client: WoodpeckerClient.new)
|
||||
@client = client
|
||||
end
|
||||
|
||||
def dashboard
|
||||
CiRepository.active.includes(:software).map do |repo|
|
||||
pipeline = begin
|
||||
@client.latest_pipeline(repo.woodpecker_repo_id)
|
||||
rescue WoodpeckerClient::ApiError
|
||||
nil
|
||||
end
|
||||
|
||||
if pipeline
|
||||
repo.update_columns(
|
||||
last_pipeline_status: pipeline["status"],
|
||||
last_pipeline_at: pipeline["created_at"]
|
||||
)
|
||||
end
|
||||
|
||||
{ repo: repo, pipeline: pipeline }
|
||||
end
|
||||
end
|
||||
|
||||
def trigger(repo, branch: "main")
|
||||
@client.trigger_pipeline(repo.woodpecker_repo_id, branch: branch)
|
||||
end
|
||||
|
||||
def list_pipelines(repo, page: 1)
|
||||
@client.list_pipelines(repo.woodpecker_repo_id, page: page)
|
||||
end
|
||||
|
||||
def pipeline_detail(repo, number)
|
||||
@client.get_pipeline(repo.woodpecker_repo_id, number)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -9,26 +9,45 @@ module WarpEngine
|
||||
Pathname.new(container_base).realpath
|
||||
end
|
||||
|
||||
def create(path:, ip:, user_agent:, referer:)
|
||||
sanitized = path.to_s
|
||||
base_path = self.class.base_path
|
||||
full_path = base_path.join(sanitized).realpath
|
||||
return nil unless full_path.to_s.start_with?(base_path.to_s)
|
||||
return nil unless File.file?(full_path)
|
||||
# A letöltés helyét adja vissza (fájl vagy aláírt URL) és naplózza a
|
||||
# letöltést. A hely feloldása a storage adapteren megy — alapból :local,
|
||||
# tehát változatlanul lemezről.
|
||||
def locate(path:, ip:, user_agent:, referer:)
|
||||
relative = path.to_s
|
||||
return nil unless storage.file?(relative)
|
||||
|
||||
escaped = sanitized.gsub("%", "\\%").gsub("_", "\\_")
|
||||
asset = WarpEngine::ReleaseAsset.find_by(path: File.join(self.class.container_base, sanitized)) ||
|
||||
log_download(relative, ip: ip, user_agent: user_agent, referer: referer)
|
||||
|
||||
storage.locate(relative, filename: File.basename(relative))
|
||||
end
|
||||
|
||||
# Visszafelé kompatibilis felület: az abszolút fájlútvonalat adja vissza
|
||||
# (vagy nil-t). Nem lemezes adapternél nincs útvonal — ott a #locate való.
|
||||
def create(path:, ip:, user_agent:, referer:)
|
||||
location = locate(path: path, ip: ip, user_agent: user_agent, referer: referer)
|
||||
return nil if location.nil?
|
||||
|
||||
location.file? ? location.path : nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def storage
|
||||
WarpEngine.storage
|
||||
end
|
||||
|
||||
def log_download(relative, ip:, user_agent:, referer:)
|
||||
escaped = relative.gsub("%", "\\%").gsub("_", "\\_")
|
||||
asset = WarpEngine::ReleaseAsset.find_by(path: File.join(self.class.container_base, relative)) ||
|
||||
WarpEngine::ReleaseAsset.where("path LIKE ?", "%#{escaped}%").first
|
||||
|
||||
WarpEngine::Download.create!(
|
||||
file_path: sanitized,
|
||||
file_path: relative,
|
||||
release: asset&.release,
|
||||
ip_address: ip,
|
||||
user_agent: user_agent&.truncate(500),
|
||||
referer: referer&.truncate(500)
|
||||
)
|
||||
|
||||
full_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,31 +5,32 @@ module WarpEngine
|
||||
Pathname.new(WarpEngine.config.file_container_path).realpath
|
||||
end
|
||||
|
||||
# A fájlok helyét a storage adapter adja (alapból :local, azaz a lemez) —
|
||||
# így a host az objektumtárból is kiszolgálhat anélkül, hogy az engine-t
|
||||
# patchelné. Lásd WarpEngine::Storage.
|
||||
def show(input)
|
||||
full_path = base_path.join(input.path.to_s)
|
||||
return FileResultDto.not_found unless safe_path?(full_path)
|
||||
relative = input.path.to_s
|
||||
|
||||
if File.directory?(full_path)
|
||||
index_path = full_path.join("index.html")
|
||||
return FileResultDto.not_found unless File.file?(index_path)
|
||||
return FileResultDto.redirect("/file/#{input.path.to_s.chomp("/")}/index.html")
|
||||
if storage.directory?(relative)
|
||||
index = File.join(relative.chomp("/"), "index.html")
|
||||
return FileResultDto.not_found unless storage.file?(index)
|
||||
|
||||
return FileResultDto.redirect("/file/#{index}")
|
||||
end
|
||||
|
||||
if File.file?(full_path)
|
||||
FileResultDto.file(full_path)
|
||||
else
|
||||
FileResultDto.not_found
|
||||
end
|
||||
return FileResultDto.not_found unless storage.file?(relative)
|
||||
|
||||
to_result(storage.locate(relative, filename: File.basename(relative)))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def base_path
|
||||
@base_path ||= self.class.base_path
|
||||
def storage
|
||||
WarpEngine.storage
|
||||
end
|
||||
|
||||
def safe_path?(path)
|
||||
File.exist?(path) && Pathname.new(path).realpath.to_s.start_with?(base_path.to_s)
|
||||
def to_result(location)
|
||||
location.redirect? ? FileResultDto.redirect(location.url) : FileResultDto.file(location.path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
module WarpEngine
|
||||
class PipelineService
|
||||
def initialize(client: WoodpeckerClient.new)
|
||||
@client = client
|
||||
end
|
||||
|
||||
def trigger(pipeline, branch: "main")
|
||||
@client.trigger_pipeline(pipeline.woodpecker_repo_id, branch: branch)
|
||||
end
|
||||
|
||||
# Fetches one page of a pipeline's runs; the newest one refreshes the
|
||||
# cached last_pipeline_* columns (Pipelines index and the CI API).
|
||||
def list_pipelines(pipeline, page: 1)
|
||||
runs = @client.list_pipelines(pipeline.woodpecker_repo_id, page: page)
|
||||
refresh_last_pipeline(pipeline, runs.first) if page == 1 && runs.is_a?(Array)
|
||||
runs
|
||||
end
|
||||
|
||||
def pipeline_detail(pipeline, number)
|
||||
@client.get_pipeline(pipeline.woodpecker_repo_id, number)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Woodpecker returns unix epoch seconds in "created".
|
||||
def refresh_last_pipeline(pipeline, run)
|
||||
return unless run && pipeline.persisted?
|
||||
|
||||
pipeline.update_columns(
|
||||
last_pipeline_status: run["status"],
|
||||
last_pipeline_at: run["created"] ? Time.zone.at(run["created"]) : nil
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
+8
-8
@@ -1,5 +1,5 @@
|
||||
module WarpEngine
|
||||
class CiRepoSyncService
|
||||
class PipelineSyncService
|
||||
def initialize(client: WoodpeckerClient.new)
|
||||
@client = client
|
||||
end
|
||||
@@ -10,7 +10,7 @@ module WarpEngine
|
||||
remote_ids = remote_repos.map { |r| r["id"] }
|
||||
|
||||
remote_repos.each do |remote|
|
||||
record = CiRepository.unscoped.find_or_initialize_by(
|
||||
record = Pipeline.unscoped.find_or_initialize_by(
|
||||
woodpecker_repo_id: remote["id"]
|
||||
)
|
||||
|
||||
@@ -22,9 +22,9 @@ module WarpEngine
|
||||
deleted_at: nil
|
||||
)
|
||||
|
||||
if record.platform.blank? || record.platform == "unknown"
|
||||
if record.platform.blank? || record.platform == Pipeline::UNKNOWN_PLATFORM
|
||||
sw = Software.find_by(name: remote["name"])
|
||||
record.platform = sw&.platform || "unknown"
|
||||
record.platform = sw&.platform || Pipeline::UNKNOWN_PLATFORM
|
||||
record.software = sw if sw
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ module WarpEngine
|
||||
results[was_new ? :created : :updated] << record
|
||||
end
|
||||
|
||||
CiRepository.where.not(woodpecker_repo_id: remote_ids).find_each do |orphan|
|
||||
Pipeline.where.not(woodpecker_repo_id: remote_ids).find_each do |orphan|
|
||||
orphan.update!(active: false) if orphan.active?
|
||||
results[:deactivated] << orphan
|
||||
end
|
||||
@@ -48,7 +48,7 @@ module WarpEngine
|
||||
|
||||
def deactivate(repo_id)
|
||||
@client.deactivate_repo(repo_id)
|
||||
record = CiRepository.find_by!(woodpecker_repo_id: repo_id)
|
||||
record = Pipeline.find_by!(woodpecker_repo_id: repo_id)
|
||||
record.update!(active: false)
|
||||
end
|
||||
|
||||
@@ -56,14 +56,14 @@ module WarpEngine
|
||||
|
||||
def sync_single(repo_id)
|
||||
remote = @client.get_repo(repo_id)
|
||||
record = CiRepository.unscoped.find_or_initialize_by(woodpecker_repo_id: repo_id)
|
||||
record = Pipeline.unscoped.find_or_initialize_by(woodpecker_repo_id: repo_id)
|
||||
record.assign_attributes(
|
||||
repo_name: remote["name"], repo_owner: remote["owner"],
|
||||
active: remote["active"], deleted_at: nil
|
||||
)
|
||||
if record.platform.blank?
|
||||
sw = Software.find_by(name: remote["name"])
|
||||
record.platform = sw&.platform || "unknown"
|
||||
record.platform = sw&.platform || Pipeline::UNKNOWN_PLATFORM
|
||||
record.software = sw if sw
|
||||
end
|
||||
record.save!
|
||||
@@ -65,6 +65,15 @@ steps:
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \
|
||||
cargo build --release --target x86_64-pc-windows-gnu
|
||||
pack_binary "win-x64" "target/x86_64-pc-windows-gnu/release/<%= name %>.exe" "<%= name %>.exe"
|
||||
# linux-arm64: Raspberry Pi, Odroid, retro handhelds. pkg-config has to
|
||||
# be told it may cross, and pointed at the arm64 .pc files, otherwise
|
||||
# alsa-sys/libudev-sys pick up the host x86_64 libraries.
|
||||
echo "==> Building linux-arm64 binary"
|
||||
PKG_CONFIG_ALLOW_CROSS=1 \
|
||||
PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig \
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
||||
cargo build --release --target aarch64-unknown-linux-gnu
|
||||
pack_binary "linux-arm64" "target/aarch64-unknown-linux-gnu/release/<%= name %>" "<%= name %>"
|
||||
|
||||
- name: upload
|
||||
image: alpine
|
||||
@@ -81,7 +90,7 @@ steps:
|
||||
META_DST="<%= name %>-$VERSION.metadata.json"
|
||||
cp $META_SRC $META_DST
|
||||
BINS=""
|
||||
for slug in win-x64 linux-x64; do
|
||||
for slug in win-x64 linux-x64 linux-arm64; do
|
||||
[ -f "<%= name %>-$VERSION-$slug.zip" ] && BINS="$BINS <%= name %>-$VERSION-$slug.zip"
|
||||
done
|
||||
for f in $FILE $META_DST $BINS; do
|
||||
|
||||
@@ -6,6 +6,7 @@ module WarpEngine
|
||||
include Builds::BuildWeb
|
||||
include Builds::BuildWinX64
|
||||
include Builds::BuildLinuxX64
|
||||
include Builds::BuildLinuxArm64
|
||||
|
||||
label "Bevy"
|
||||
end
|
||||
|
||||
+8
-2
@@ -44,11 +44,14 @@ steps:
|
||||
# helper: builds one target + zips it with a single root folder
|
||||
# (unix zip keeps the executable bit)
|
||||
binary_build() {
|
||||
B_GOOS="$1"; B_GOARCH="$2"; B_CGO="$3"; B_EXT="$4"; B_TARGET="$5"
|
||||
B_GOOS="$1"; B_GOARCH="$2"; B_CGO="$3"; B_EXT="$4"; B_TARGET="$5"; B_CC="$6"
|
||||
PKG_DIR="<%= name %>-$VERSION-$B_TARGET"
|
||||
echo "==> Building $PKG_DIR"
|
||||
rm -rf "$PKG_DIR" "$PKG_DIR.zip"
|
||||
mkdir -p "$PKG_DIR"
|
||||
# cgo cross-compile needs an explicit cross gcc; a native build must
|
||||
# not see CC at all, otherwise go picks the wrong compiler
|
||||
if [ -n "$B_CC" ]; then export CC="$B_CC"; else unset CC; fi
|
||||
CGO_ENABLED=$B_CGO GOOS=$B_GOOS GOARCH=$B_GOARCH go build -o "$PKG_DIR/<%= name %>$B_EXT" .
|
||||
if [ -f LICENSE ]; then cp LICENSE "$PKG_DIR/"; fi
|
||||
if [ -f README.md ]; then cp README.md "$PKG_DIR/"; fi
|
||||
@@ -56,10 +59,13 @@ steps:
|
||||
rm -rf "$PKG_DIR"
|
||||
echo "==> $PKG_DIR.zip kesz"
|
||||
}
|
||||
# CI (linux builder) builds these three:
|
||||
# CI (linux builder) builds these four:
|
||||
binary_build "windows" "386" "0" ".exe" "win-x86"
|
||||
binary_build "windows" "amd64" "0" ".exe" "win-x64"
|
||||
binary_build "linux" "amd64" "1" "" "linux-x64"
|
||||
# linux-arm64: Raspberry Pi, Odroid, retro handhelds — cgo cross-build
|
||||
# against the arm64 X11/GL/ALSA headers in the builder image
|
||||
binary_build "linux" "arm64" "1" "" "linux-arm64" "aarch64-linux-gnu-gcc"
|
||||
|
||||
- name: artifact
|
||||
image: alpine
|
||||
|
||||
@@ -7,6 +7,7 @@ module WarpEngine
|
||||
include Builds::BuildWinX86
|
||||
include Builds::BuildWinX64
|
||||
include Builds::BuildLinuxX64
|
||||
include Builds::BuildLinuxArm64
|
||||
include Builds::BuildMacX64
|
||||
include Builds::BuildMacArm64
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ steps:
|
||||
- |
|
||||
VERSION=$(cat .version)
|
||||
echo "==> Checking JS syntax"
|
||||
for f in src/*.js; do node --check $f; done
|
||||
for f in src/*.js; do [ -e "$f" ] || continue; node --check "$f"; done
|
||||
mkdir -p dist/web
|
||||
echo "==> Downloading Phaser 3.90.0"
|
||||
curl -sSL https://cdn.jsdelivr.net/npm/phaser@3.90.0/dist/phaser.min.js -o dist/web/phaser.min.js
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
module WarpEngine
|
||||
class PublishService
|
||||
# Az esemény neve, amit a host lehallgathat. A payload:
|
||||
# platform: String, name: String, version: String,
|
||||
# software: WarpEngine::Software, release: WarpEngine::Release
|
||||
NOTIFICATION = "warp_engine.publish".freeze
|
||||
|
||||
def publish(input)
|
||||
unless WarpEngine::PlatformLink::SUPPORTED_PLATFORMS.include?(input.platform)
|
||||
raise ArgumentError, "Unsupported platform: #{input.platform}"
|
||||
end
|
||||
|
||||
"WarpEngine::Platforms::#{input.platform.camelize}::Service".constantize.new.update(input.name, input.version)
|
||||
release = "WarpEngine::Platforms::#{input.platform.camelize}::Service".constantize
|
||||
.new.update(input.name, input.version)
|
||||
|
||||
# A publikálás az egyetlen pont, ahol új build kerül a katalógusba —
|
||||
# a host innen tud rá reagálni (értesítés, feed, csatorna-előléptetés)
|
||||
# anélkül, hogy modell-callbackre kellene kapaszkodnia.
|
||||
ActiveSupport::Notifications.instrument(
|
||||
NOTIFICATION,
|
||||
platform: input.platform,
|
||||
name: input.name,
|
||||
version: input.version,
|
||||
software: release.respond_to?(:software) ? release.software : nil,
|
||||
release: release
|
||||
)
|
||||
|
||||
release
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+19
-19
@@ -1,40 +1,40 @@
|
||||
module WarpEngine
|
||||
class CiSecretSyncService
|
||||
class SecretSyncService
|
||||
SECRET_NAME = "application_token".freeze
|
||||
|
||||
def initialize(client: WoodpeckerClient.new)
|
||||
@client = client
|
||||
end
|
||||
|
||||
def provision(plain_token, repos:)
|
||||
def provision(plain_token, pipelines:)
|
||||
results = { synced: [], failed: [] }
|
||||
|
||||
repos.each do |repo|
|
||||
if secret_exists?(repo.woodpecker_repo_id)
|
||||
@client.update_secret(repo.woodpecker_repo_id, SECRET_NAME, value: plain_token)
|
||||
pipelines.each do |pipeline|
|
||||
if secret_exists?(pipeline.woodpecker_repo_id)
|
||||
@client.update_secret(pipeline.woodpecker_repo_id, SECRET_NAME, value: plain_token)
|
||||
else
|
||||
@client.create_secret(repo.woodpecker_repo_id, name: SECRET_NAME, value: plain_token)
|
||||
@client.create_secret(pipeline.woodpecker_repo_id, name: SECRET_NAME, value: plain_token)
|
||||
end
|
||||
results[:synced] << repo
|
||||
results[:synced] << pipeline
|
||||
rescue WoodpeckerClient::ApiError, WoodpeckerClient::ConnectionError => e
|
||||
Rails.logger.error("[CiSecretSyncService] failed for #{repo.full_name}: #{e.message}")
|
||||
results[:failed] << { repo: repo, error: e.message }
|
||||
Rails.logger.error("[SecretSyncService] failed for #{pipeline.full_name}: #{e.message}")
|
||||
results[:failed] << { pipeline: pipeline, error: e.message }
|
||||
end
|
||||
|
||||
results
|
||||
end
|
||||
|
||||
def deprovision(application_token)
|
||||
repos_for_token(application_token).each do |repo|
|
||||
@client.delete_secret(repo.woodpecker_repo_id, SECRET_NAME)
|
||||
pipelines_for_token(application_token).each do |pipeline|
|
||||
@client.delete_secret(pipeline.woodpecker_repo_id, SECRET_NAME)
|
||||
rescue WoodpeckerClient::ApiError => e
|
||||
Rails.logger.warn("[CiSecretSyncService] delete failed for #{repo.full_name}: #{e.message}")
|
||||
Rails.logger.warn("[SecretSyncService] delete failed for #{pipeline.full_name}: #{e.message}")
|
||||
end
|
||||
end
|
||||
|
||||
def rotate(application_token)
|
||||
repos = repos_for_token(application_token)
|
||||
return { rotated: false, reason: "no repos" } if repos.empty?
|
||||
pipelines = pipelines_for_token(application_token)
|
||||
return { rotated: false, reason: "no pipelines" } if pipelines.empty?
|
||||
|
||||
new_token = ApplicationToken.create!(
|
||||
name: "#{application_token.name} (rotated #{Date.current})",
|
||||
@@ -45,26 +45,26 @@ module WarpEngine
|
||||
unrestricted: application_token.unrestricted?
|
||||
)
|
||||
|
||||
result = provision(new_token.plain_token, repos: repos)
|
||||
result = provision(new_token.plain_token, pipelines: pipelines)
|
||||
|
||||
if result[:synced].any?
|
||||
application_token.revoke!
|
||||
{ rotated: true, new_token: new_token, sync_result: result }
|
||||
else
|
||||
new_token.revoke!
|
||||
{ rotated: false, reason: "all repos failed", sync_result: result }
|
||||
{ rotated: false, reason: "all pipelines failed", sync_result: result }
|
||||
end
|
||||
end
|
||||
|
||||
def repos_for_token(application_token)
|
||||
def pipelines_for_token(application_token)
|
||||
if application_token.unrestricted?
|
||||
CiRepository.active.to_a
|
||||
Pipeline.active.to_a
|
||||
else
|
||||
software_ids = Software.where(
|
||||
owner_type: application_token.owner_type,
|
||||
owner_id: application_token.owner_id
|
||||
).pluck(:id)
|
||||
CiRepository.active.where(software_id: software_ids).to_a
|
||||
Pipeline.active.where(software_id: software_ids).to_a
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,9 +7,9 @@ WarpEngine::Engine.routes.draw do
|
||||
get "builds", to: "builds#index"
|
||||
get "softwares/:name/builds", to: "software_builds#show"
|
||||
|
||||
get "ci/repos", to: "ci#repos"
|
||||
get "ci/repos/:id/status", to: "ci#status"
|
||||
post "ci/repos/:id/trigger", to: "ci#trigger"
|
||||
get "ci/pipelines", to: "ci#pipelines"
|
||||
get "ci/pipelines/:id/status", to: "ci#status"
|
||||
post "ci/pipelines/:id/trigger", to: "ci#trigger"
|
||||
end
|
||||
|
||||
post "build/upload", to: "build/uploads#create"
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class RenameCiRepositoriesToPipelines < ActiveRecord::Migration[8.1]
|
||||
def change
|
||||
rename_table :ci_repositories, :pipelines
|
||||
|
||||
rename_index :pipelines, "idx_ci_repos_deleted", "idx_pipelines_deleted"
|
||||
rename_index :pipelines, "idx_ci_repos_owner_name", "idx_pipelines_owner_name"
|
||||
rename_index :pipelines, "idx_ci_repos_software", "idx_pipelines_software"
|
||||
rename_index :pipelines, "idx_ci_repos_wp_id", "idx_pipelines_wp_id"
|
||||
|
||||
remove_foreign_key :pipelines, :softwares,
|
||||
column: :software_id, name: "fk_ci_repos_software", on_delete: :nullify
|
||||
add_foreign_key :pipelines, :softwares,
|
||||
column: :software_id, name: "fk_pipelines_software", on_delete: :nullify
|
||||
end
|
||||
end
|
||||
@@ -1,8 +1,15 @@
|
||||
# Az engine ActiveJob-ra épülő jobot szállít (PipelineSyncJob), ezért a
|
||||
# framework betöltése a mi dolgunk: a host application.rb-je nem feltétlenül
|
||||
# require-öli az active_job/railtie-t, és eager loadnál (production) a
|
||||
# WarpEngine::ApplicationJob különben uninitialized constant-tal elszáll.
|
||||
require "active_job/railtie"
|
||||
|
||||
require "blueprinter"
|
||||
require "apipie-rails"
|
||||
|
||||
require "warp_engine/version"
|
||||
require "warp_engine/configuration"
|
||||
require "warp_engine/storage"
|
||||
|
||||
module WarpEngine
|
||||
# A tábláink prefix nélküliek (softwares, releases, ...) — az isolate_namespace
|
||||
@@ -23,6 +30,18 @@ module WarpEngine
|
||||
def self.woodpecker_configured?
|
||||
config.woodpecker_url.present? && config.woodpecker_api_token.present?
|
||||
end
|
||||
|
||||
# A host innen tudja, hogy a publikálás ActiveSupport::Notifications-t szór
|
||||
# ("warp_engine.publish"), és nem kell modell-callbackre kapaszkodnia.
|
||||
# Régebbi engine-verziókon a metódus nem létezik, ezért a hívó oldalon
|
||||
# respond_to?-val kérdezendő.
|
||||
def self.instruments_publish?
|
||||
true
|
||||
end
|
||||
|
||||
def self.storage
|
||||
Storage.adapter
|
||||
end
|
||||
end
|
||||
|
||||
require "warp_engine/engine"
|
||||
|
||||
@@ -9,6 +9,12 @@ module WarpEngine
|
||||
# :database — only WarpEngine::ApplicationToken is accepted, the shared secret is not
|
||||
# application_token_owner_class: class name of the mandatory token owner
|
||||
# (e.g. "AdminUser"); nil makes :database mode reject every request.
|
||||
# storage_adapter: where build artifacts are served from.
|
||||
# :local (default) — the local filesystem under file_container_path,
|
||||
# byte for byte the previous behaviour;
|
||||
# any object — must answer file?/directory?/locate, see
|
||||
# WarpEngine::Storage. Serving only: uploads and
|
||||
# archive extraction still write to the local disk.
|
||||
# max_upload_size: file size cap in bytes for /build/upload (and the admin file manager).
|
||||
# enforce_software_ownership: when true, a DB token may only upload/publish
|
||||
# its own owner's softwares (unrestricted tokens are exempt).
|
||||
@@ -37,7 +43,8 @@ module WarpEngine
|
||||
:woodpecker_url,
|
||||
:woodpecker_api_token,
|
||||
:woodpecker_repo_owner,
|
||||
:image_owners
|
||||
:image_owners,
|
||||
:storage_adapter
|
||||
|
||||
def initialize
|
||||
@file_container_path = ENV.fetch("FILE_CONTAINER_PATH", "/softwares")
|
||||
@@ -55,6 +62,7 @@ module WarpEngine
|
||||
@woodpecker_api_token = ENV["WOODPECKER_API_TOKEN"]
|
||||
@woodpecker_repo_owner = ENV["WOODPECKER_REPO_OWNER"]
|
||||
@image_owners = []
|
||||
@storage_adapter = :local
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
module WarpEngine
|
||||
# Where the artifacts physically live.
|
||||
#
|
||||
# Until now every path in the engine was a local filesystem path. This module
|
||||
# is the seam a host needs to serve builds from somewhere else (an object
|
||||
# store behind a CDN, for example) without patching the engine.
|
||||
#
|
||||
# The default adapter is :local and behaves exactly as before - same paths,
|
||||
# same traversal protection, same File.file? checks.
|
||||
#
|
||||
# A custom adapter is any object answering to this contract:
|
||||
#
|
||||
# file?(relative_path) -> true/false
|
||||
# directory?(relative_path) -> true/false
|
||||
# locate(relative_path, filename: nil, expires_in: nil) -> Location
|
||||
#
|
||||
# It is set on the configuration:
|
||||
#
|
||||
# c.storage_adapter = MyObjectStore.new # or :local (default)
|
||||
#
|
||||
# NOTE: ingestion (build/upload, archive extraction, the admin file manager)
|
||||
# still writes to the local filesystem. A remote adapter therefore needs its
|
||||
# own upload path today; the serving side is what this seam covers.
|
||||
module Storage
|
||||
Location = Struct.new(:kind, :path, :url, keyword_init: true) do
|
||||
def file? = kind == :file
|
||||
def redirect? = kind == :redirect
|
||||
|
||||
def self.file(path) = new(kind: :file, path: path)
|
||||
def self.redirect(url) = new(kind: :redirect, url: url)
|
||||
end
|
||||
|
||||
# The local filesystem, rooted at config.file_container_path.
|
||||
class LocalAdapter
|
||||
def base_path
|
||||
Pathname.new(WarpEngine.config.file_container_path)
|
||||
end
|
||||
|
||||
def absolute_path(relative_path)
|
||||
base_path.join(relative_path.to_s)
|
||||
end
|
||||
|
||||
def file?(relative_path)
|
||||
path = absolute_path(relative_path)
|
||||
File.file?(path) && inside_base?(path)
|
||||
end
|
||||
|
||||
def directory?(relative_path)
|
||||
path = absolute_path(relative_path)
|
||||
File.directory?(path) && inside_base?(path)
|
||||
end
|
||||
|
||||
# expires_in is part of the contract for signing adapters; the local
|
||||
# filesystem has nothing to sign, so it is ignored here.
|
||||
def locate(relative_path, filename: nil, expires_in: nil)
|
||||
Location.file(absolute_path(relative_path).to_s)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Path traversal guard: the resolved path must stay under the container.
|
||||
def inside_base?(path)
|
||||
root = base_path.realpath.to_s
|
||||
Pathname.new(path).realpath.to_s.start_with?(root)
|
||||
rescue Errno::ENOENT
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
def adapter
|
||||
configured = WarpEngine.config.storage_adapter
|
||||
|
||||
case configured
|
||||
when nil, :local, "local" then local_adapter
|
||||
else configured
|
||||
end
|
||||
end
|
||||
|
||||
def local? = adapter.is_a?(LocalAdapter)
|
||||
|
||||
def local_adapter
|
||||
@local_adapter ||= LocalAdapter.new
|
||||
end
|
||||
|
||||
# Tests and hosts that swap the configuration at runtime.
|
||||
def reset!
|
||||
@local_adapter = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,3 +1,3 @@
|
||||
module WarpEngine
|
||||
VERSION = "0.1.0"
|
||||
VERSION = "0.3.0"
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_05_000003) do
|
||||
ActiveRecord::Schema[8.1].define(version: 2026_08_06_000002) do
|
||||
create_table "application_tokens", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
@@ -64,6 +64,24 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_05_000003) do
|
||||
t.index ["deleted_at"], name: "idx_images_deleted_at"
|
||||
end
|
||||
|
||||
create_table "pipelines", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.boolean "active", default: true, null: false
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
t.datetime "last_pipeline_at", precision: 3
|
||||
t.string "last_pipeline_status", limit: 32
|
||||
t.string "platform", limit: 32, null: false
|
||||
t.string "repo_name", limit: 128, null: false
|
||||
t.string "repo_owner", limit: 128, null: false
|
||||
t.bigint "software_id", unsigned: true
|
||||
t.datetime "updated_at", precision: 3
|
||||
t.bigint "woodpecker_repo_id", null: false, unsigned: true
|
||||
t.index ["deleted_at"], name: "idx_pipelines_deleted"
|
||||
t.index ["repo_owner", "repo_name"], name: "idx_pipelines_owner_name", unique: true
|
||||
t.index ["software_id"], name: "idx_pipelines_software"
|
||||
t.index ["woodpecker_repo_id"], name: "idx_pipelines_wp_id", unique: true
|
||||
end
|
||||
|
||||
create_table "platform_links", id: { type: :bigint, unsigned: true }, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", precision: 3
|
||||
t.datetime "deleted_at", precision: 3
|
||||
@@ -139,6 +157,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_08_05_000003) do
|
||||
|
||||
add_foreign_key "downloads", "releases", name: "fk_downloads_release", on_delete: :nullify
|
||||
add_foreign_key "external_links", "softwares", name: "fk_softwares_external_links", on_delete: :cascade
|
||||
add_foreign_key "pipelines", "softwares", name: "fk_pipelines_software", on_delete: :nullify
|
||||
add_foreign_key "release_assets", "releases", name: "fk_releases_release_assets", on_delete: :cascade
|
||||
add_foreign_key "releases", "softwares", name: "fk_softwares_releases", on_delete: :cascade
|
||||
add_foreign_key "software_images", "images"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FactoryBot.define do
|
||||
factory :ci_repository, class: "WarpEngine::CiRepository" do
|
||||
factory :pipeline, class: "WarpEngine::Pipeline" do
|
||||
sequence(:woodpecker_repo_id) { |n| n }
|
||||
repo_owner { "testorg" }
|
||||
sequence(:repo_name) { |n| "game-#{n}" }
|
||||
@@ -0,0 +1,59 @@
|
||||
require "rails_helper"
|
||||
require "tmpdir"
|
||||
|
||||
RSpec.describe WarpEngine::Storage do
|
||||
let(:tmpdir) { Dir.mktmpdir }
|
||||
|
||||
before do
|
||||
allow(WarpEngine.config).to receive(:file_container_path).and_return(tmpdir)
|
||||
WarpEngine::Storage.reset!
|
||||
end
|
||||
|
||||
after { FileUtils.rm_rf(tmpdir) }
|
||||
|
||||
describe ".adapter" do
|
||||
it "defaults to the local filesystem" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(:local)
|
||||
|
||||
expect(described_class.adapter).to be_a(described_class::LocalAdapter)
|
||||
expect(described_class).to be_local
|
||||
end
|
||||
|
||||
it "returns whatever object the host configured" do
|
||||
custom = Object.new
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(custom)
|
||||
|
||||
expect(described_class.adapter).to eq(custom)
|
||||
expect(described_class).not_to be_local
|
||||
end
|
||||
end
|
||||
|
||||
describe described_class::LocalAdapter do
|
||||
subject(:adapter) { described_class.new }
|
||||
|
||||
before { File.write(File.join(tmpdir, "game-1.0.zip"), "zip") }
|
||||
|
||||
it "sees files and directories under the container" do
|
||||
FileUtils.mkdir_p(File.join(tmpdir, "game-1.0"))
|
||||
|
||||
expect(adapter.file?("game-1.0.zip")).to be(true)
|
||||
expect(adapter.directory?("game-1.0")).to be(true)
|
||||
expect(adapter.file?("missing.zip")).to be(false)
|
||||
end
|
||||
|
||||
# The path traversal guard has to survive the move behind the adapter.
|
||||
it "refuses paths escaping the container" do
|
||||
outside = File.join(Dir.mktmpdir, "secret.txt")
|
||||
File.write(outside, "nope")
|
||||
|
||||
expect(adapter.file?("../#{File.basename(File.dirname(outside))}/secret.txt")).to be(false)
|
||||
end
|
||||
|
||||
it "locates a file as an absolute path" do
|
||||
location = adapter.locate("game-1.0.zip")
|
||||
|
||||
expect(location).to be_file
|
||||
expect(location.path).to eq(File.join(tmpdir, "game-1.0.zip"))
|
||||
end
|
||||
end
|
||||
end
|
||||
+13
-8
@@ -1,8 +1,8 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe WarpEngine::CiRepository do
|
||||
RSpec.describe WarpEngine::Pipeline do
|
||||
describe "validations" do
|
||||
subject { build(:ci_repository) }
|
||||
subject { build(:pipeline) }
|
||||
|
||||
it { is_expected.to validate_presence_of(:woodpecker_repo_id) }
|
||||
it { is_expected.to validate_uniqueness_of(:woodpecker_repo_id) }
|
||||
@@ -11,29 +11,34 @@ RSpec.describe WarpEngine::CiRepository do
|
||||
it { is_expected.to validate_presence_of(:platform) }
|
||||
|
||||
it "rejects unsupported platforms" do
|
||||
repo = build(:ci_repository, platform: "amiga")
|
||||
repo = build(:pipeline, platform: "amiga")
|
||||
expect(repo).not_to be_valid
|
||||
expect(repo.errors[:platform]).to be_present
|
||||
end
|
||||
|
||||
WarpEngine::PlatformLink::SUPPORTED_PLATFORMS.each do |p|
|
||||
it "accepts #{p}" do
|
||||
repo = build(:ci_repository, platform: p)
|
||||
repo = build(:pipeline, platform: p)
|
||||
expect(repo).to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
it "accepts the unknown placeholder platform" do
|
||||
repo = build(:pipeline, platform: WarpEngine::Pipeline::UNKNOWN_PLATFORM)
|
||||
expect(repo).to be_valid
|
||||
end
|
||||
end
|
||||
|
||||
describe "#full_name" do
|
||||
it "returns owner/name" do
|
||||
repo = build(:ci_repository, repo_owner: "games", repo_name: "mygame")
|
||||
repo = build(:pipeline, repo_owner: "games", repo_name: "mygame")
|
||||
expect(repo.full_name).to eq("games/mygame")
|
||||
end
|
||||
end
|
||||
|
||||
describe "default_scope" do
|
||||
it "excludes soft-deleted records" do
|
||||
repo = create(:ci_repository)
|
||||
repo = create(:pipeline)
|
||||
repo.update_column(:deleted_at, Time.current)
|
||||
|
||||
expect(described_class.all).not_to include(repo)
|
||||
@@ -43,8 +48,8 @@ RSpec.describe WarpEngine::CiRepository do
|
||||
|
||||
describe ".active" do
|
||||
it "returns only active repos" do
|
||||
active = create(:ci_repository, active: true)
|
||||
inactive = create(:ci_repository, active: false)
|
||||
active = create(:pipeline, active: true)
|
||||
inactive = create(:pipeline, active: false)
|
||||
|
||||
expect(described_class.active).to include(active)
|
||||
expect(described_class.active).not_to include(inactive)
|
||||
@@ -7,11 +7,11 @@ RSpec.describe "CI API", type: :request do
|
||||
allow(WarpEngine.config).to receive(:update_secret).and_return("s3cret")
|
||||
end
|
||||
|
||||
describe "GET /api/ci/repos" do
|
||||
describe "GET /api/ci/pipelines" do
|
||||
it "returns active repos" do
|
||||
repo = create(:ci_repository, repo_name: "mygame", platform: "tic80")
|
||||
repo = create(:pipeline, repo_name: "mygame", platform: "tic80")
|
||||
|
||||
get "/api/ci/repos"
|
||||
get "/api/ci/pipelines"
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
json = JSON.parse(response.body)
|
||||
@@ -22,45 +22,45 @@ RSpec.describe "CI API", type: :request do
|
||||
it "returns 503 when woodpecker not configured" do
|
||||
allow(WarpEngine.config).to receive(:woodpecker_url).and_return(nil)
|
||||
|
||||
get "/api/ci/repos"
|
||||
get "/api/ci/pipelines"
|
||||
|
||||
expect(response).to have_http_status(:service_unavailable)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /api/ci/repos/:id/status" do
|
||||
describe "GET /api/ci/pipelines/:id/status" do
|
||||
it "returns repo with pipeline status" do
|
||||
repo = create(:ci_repository, repo_owner: "org", repo_name: "game")
|
||||
repo = create(:pipeline, repo_owner: "org", repo_name: "game")
|
||||
client = instance_double(WarpEngine::WoodpeckerClient)
|
||||
allow(WarpEngine::WoodpeckerClient).to receive(:new).and_return(client)
|
||||
allow(client).to receive(:get_pipeline)
|
||||
.and_return({ "number" => 1, "status" => "success" })
|
||||
|
||||
get "/api/ci/repos/#{repo.id}/status"
|
||||
get "/api/ci/pipelines/#{repo.id}/status"
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
json = JSON.parse(response.body)
|
||||
expect(json["repo"]["repo_name"]).to eq("game")
|
||||
expect(json["pipeline"]["repo_name"]).to eq("game")
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /api/ci/repos/:id/trigger" do
|
||||
describe "POST /api/ci/pipelines/:id/trigger" do
|
||||
it "requires authentication" do
|
||||
repo = create(:ci_repository)
|
||||
repo = create(:pipeline)
|
||||
|
||||
post "/api/ci/repos/#{repo.id}/trigger"
|
||||
post "/api/ci/pipelines/#{repo.id}/trigger"
|
||||
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
end
|
||||
|
||||
it "triggers a pipeline with valid secret" do
|
||||
repo = create(:ci_repository, repo_owner: "org", repo_name: "game")
|
||||
repo = create(:pipeline, repo_owner: "org", repo_name: "game")
|
||||
client = instance_double(WarpEngine::WoodpeckerClient)
|
||||
allow(WarpEngine::WoodpeckerClient).to receive(:new).and_return(client)
|
||||
allow(client).to receive(:trigger_pipeline)
|
||||
.and_return({ "number" => 7, "status" => "pending" })
|
||||
|
||||
post "/api/ci/repos/#{repo.id}/trigger",
|
||||
post "/api/ci/pipelines/#{repo.id}/trigger",
|
||||
headers: { "X-Update-Secret" => "s3cret" }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe WarpEngine::CiPipelineService do
|
||||
let(:client) { instance_double(WarpEngine::WoodpeckerClient) }
|
||||
let(:service) { described_class.new(client: client) }
|
||||
|
||||
describe "#dashboard" do
|
||||
it "returns latest pipeline for each active repo" do
|
||||
repo = create(:ci_repository, repo_owner: "org", repo_name: "game")
|
||||
pipeline = { "number" => 5, "status" => "success", "created_at" => "2026-08-06T12:00:00Z" }
|
||||
allow(client).to receive(:latest_pipeline).with(repo.woodpecker_repo_id).and_return(pipeline)
|
||||
|
||||
entries = service.dashboard
|
||||
|
||||
expect(entries.size).to eq(1)
|
||||
expect(entries.first[:pipeline]["status"]).to eq("success")
|
||||
expect(repo.reload.last_pipeline_status).to eq("success")
|
||||
end
|
||||
|
||||
it "handles API errors gracefully per repo" do
|
||||
create(:ci_repository, repo_owner: "org", repo_name: "broken")
|
||||
allow(client).to receive(:latest_pipeline)
|
||||
.and_raise(WarpEngine::WoodpeckerClient::ApiError.new("fail", status: 500))
|
||||
|
||||
entries = service.dashboard
|
||||
|
||||
expect(entries.size).to eq(1)
|
||||
expect(entries.first[:pipeline]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "#trigger" do
|
||||
it "delegates to client" do
|
||||
repo = build(:ci_repository, repo_owner: "org", repo_name: "game")
|
||||
allow(client).to receive(:trigger_pipeline).and_return({ "number" => 6 })
|
||||
|
||||
result = service.trigger(repo, branch: "main")
|
||||
|
||||
expect(result["number"]).to eq(6)
|
||||
expect(client).to have_received(:trigger_pipeline).with(repo.woodpecker_repo_id, branch: "main")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#list_pipelines" do
|
||||
it "returns paginated pipelines" do
|
||||
repo = build(:ci_repository, repo_owner: "org", repo_name: "game")
|
||||
pipelines = [{ "number" => 1 }, { "number" => 2 }]
|
||||
allow(client).to receive(:list_pipelines).with(repo.woodpecker_repo_id, page: 1).and_return(pipelines)
|
||||
|
||||
expect(service.list_pipelines(repo)).to eq(pipelines)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe WarpEngine::PipelineService do
|
||||
let(:client) { instance_double(WarpEngine::WoodpeckerClient) }
|
||||
let(:service) { described_class.new(client: client) }
|
||||
|
||||
describe "#trigger" do
|
||||
it "delegates to client" do
|
||||
repo = build(:pipeline, repo_owner: "org", repo_name: "game")
|
||||
allow(client).to receive(:trigger_pipeline).and_return({ "number" => 6 })
|
||||
|
||||
result = service.trigger(repo, branch: "main")
|
||||
|
||||
expect(result["number"]).to eq(6)
|
||||
expect(client).to have_received(:trigger_pipeline).with(repo.woodpecker_repo_id, branch: "main")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#list_pipelines" do
|
||||
it "returns paginated pipelines and refreshes the repo's cached last pipeline" do
|
||||
repo = create(:pipeline, repo_owner: "org", repo_name: "game")
|
||||
pipelines = [
|
||||
{ "number" => 2, "status" => "failure", "created" => 1_754_500_000 },
|
||||
{ "number" => 1, "status" => "success", "created" => 1_754_400_000 }
|
||||
]
|
||||
allow(client).to receive(:list_pipelines).with(repo.woodpecker_repo_id, page: 1).and_return(pipelines)
|
||||
|
||||
expect(service.list_pipelines(repo)).to eq(pipelines)
|
||||
|
||||
repo.reload
|
||||
expect(repo.last_pipeline_status).to eq("failure")
|
||||
expect(repo.last_pipeline_at).to eq(Time.zone.at(1_754_500_000))
|
||||
end
|
||||
|
||||
it "does not touch the cache on later pages" do
|
||||
repo = create(:pipeline, repo_owner: "org", repo_name: "game",
|
||||
last_pipeline_status: "success")
|
||||
allow(client).to receive(:list_pipelines).with(repo.woodpecker_repo_id, page: 2)
|
||||
.and_return([{ "number" => 1, "status" => "failure", "created" => 1_754_400_000 }])
|
||||
|
||||
service.list_pipelines(repo, page: 2)
|
||||
|
||||
expect(repo.reload.last_pipeline_status).to eq("success")
|
||||
end
|
||||
|
||||
it "leaves the cache alone when the repo has no pipelines" do
|
||||
repo = create(:pipeline, repo_owner: "org", repo_name: "game",
|
||||
last_pipeline_status: "success")
|
||||
allow(client).to receive(:list_pipelines).and_return([])
|
||||
|
||||
expect(service.list_pipelines(repo)).to eq([])
|
||||
expect(repo.reload.last_pipeline_status).to eq("success")
|
||||
end
|
||||
end
|
||||
end
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe WarpEngine::CiRepoSyncService do
|
||||
RSpec.describe WarpEngine::PipelineSyncService do
|
||||
let(:client) { instance_double(WarpEngine::WoodpeckerClient) }
|
||||
let(:service) { described_class.new(client: client) }
|
||||
|
||||
describe "#sync_all" do
|
||||
it "creates new CiRepository records from Woodpecker" do
|
||||
it "creates new Pipeline records from Woodpecker" do
|
||||
allow(client).to receive(:list_repos).and_return([
|
||||
{ "id" => 1, "name" => "mygame", "owner" => "org", "active" => true }
|
||||
])
|
||||
@@ -20,7 +20,7 @@ RSpec.describe WarpEngine::CiRepoSyncService do
|
||||
end
|
||||
|
||||
it "updates existing records" do
|
||||
existing = create(:ci_repository, woodpecker_repo_id: 1, repo_name: "old", platform: "tic80")
|
||||
existing = create(:pipeline, woodpecker_repo_id: 1, repo_name: "old", platform: "tic80")
|
||||
allow(client).to receive(:list_repos).and_return([
|
||||
{ "id" => 1, "name" => "newname", "owner" => "org", "active" => true }
|
||||
])
|
||||
@@ -32,7 +32,7 @@ RSpec.describe WarpEngine::CiRepoSyncService do
|
||||
end
|
||||
|
||||
it "deactivates repos missing from Woodpecker" do
|
||||
orphan = create(:ci_repository, woodpecker_repo_id: 99, active: true)
|
||||
orphan = create(:pipeline, woodpecker_repo_id: 99, active: true)
|
||||
allow(client).to receive(:list_repos).and_return([])
|
||||
|
||||
result = service.sync_all
|
||||
@@ -70,7 +70,7 @@ RSpec.describe WarpEngine::CiRepoSyncService do
|
||||
|
||||
describe "#deactivate" do
|
||||
it "calls client and marks repo inactive" do
|
||||
repo = create(:ci_repository, woodpecker_repo_id: 42, active: true)
|
||||
repo = create(:pipeline, woodpecker_repo_id: 42, active: true)
|
||||
allow(client).to receive(:deactivate_repo).with(42)
|
||||
|
||||
service.deactivate(42)
|
||||
@@ -55,5 +55,38 @@ RSpec.describe WarpEngine::PublishService do
|
||||
|
||||
expect(mock_service).to have_received(:update).with("game", "1.0")
|
||||
end
|
||||
describe "instrumentation" do
|
||||
let(:input) { WarpEngine::PublishInputDto.new(platform: "tic80", name: "game", version: "1.0") }
|
||||
let(:release) { WarpEngine::Release.new(version: "1.0") }
|
||||
|
||||
before do
|
||||
mock_service = instance_double(WarpEngine::Platforms::Tic80::Service, update: release)
|
||||
allow(WarpEngine::Platforms::Tic80::Service).to receive(:new).and_return(mock_service)
|
||||
end
|
||||
|
||||
# The host reacts to a new build through this event instead of hanging a
|
||||
# callback on the Release model.
|
||||
it "emits warp_engine.publish with the release in the payload" do
|
||||
payloads = []
|
||||
ActiveSupport::Notifications.subscribe(described_class::NOTIFICATION) do |*, payload|
|
||||
payloads << payload
|
||||
end
|
||||
|
||||
described_class.new.publish(input)
|
||||
|
||||
expect(payloads.size).to eq(1)
|
||||
expect(payloads.first).to include(platform: "tic80", name: "game", version: "1.0", release: release)
|
||||
ensure
|
||||
ActiveSupport::Notifications.unsubscribe(described_class::NOTIFICATION)
|
||||
end
|
||||
|
||||
it "returns the release" do
|
||||
expect(described_class.new.publish(input)).to eq(release)
|
||||
end
|
||||
|
||||
it "advertises the feature so older hosts can feature-detect" do
|
||||
expect(WarpEngine.instruments_publish?).to be(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+18
-18
@@ -1,6 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
RSpec.describe WarpEngine::SecretSyncService do
|
||||
let(:client) { instance_double(WarpEngine::WoodpeckerClient) }
|
||||
let(:service) { described_class.new(client: client) }
|
||||
|
||||
@@ -11,11 +11,11 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
|
||||
describe "#provision" do
|
||||
it "creates secrets on repos that don't have one" do
|
||||
repo = create(:ci_repository)
|
||||
repo = create(:pipeline)
|
||||
allow(client).to receive(:list_secrets).with(repo.woodpecker_repo_id).and_return([])
|
||||
allow(client).to receive(:create_secret)
|
||||
|
||||
result = service.provision("plaintoken", repos: [ repo ])
|
||||
result = service.provision("plaintoken", pipelines: [ repo ])
|
||||
|
||||
expect(result[:synced]).to eq([ repo ])
|
||||
expect(client).to have_received(:create_secret).with(
|
||||
@@ -24,12 +24,12 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
end
|
||||
|
||||
it "updates secrets on repos that already have one" do
|
||||
repo = create(:ci_repository)
|
||||
repo = create(:pipeline)
|
||||
allow(client).to receive(:list_secrets).with(repo.woodpecker_repo_id)
|
||||
.and_return([ { "name" => "application_token" } ])
|
||||
allow(client).to receive(:update_secret)
|
||||
|
||||
result = service.provision("newtoken", repos: [ repo ])
|
||||
result = service.provision("newtoken", pipelines: [ repo ])
|
||||
|
||||
expect(result[:synced]).to eq([ repo ])
|
||||
expect(client).to have_received(:update_secret).with(
|
||||
@@ -38,12 +38,12 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
end
|
||||
|
||||
it "records failed repos without raising" do
|
||||
repo = create(:ci_repository)
|
||||
repo = create(:pipeline)
|
||||
allow(client).to receive(:list_secrets).and_raise(
|
||||
WarpEngine::WoodpeckerClient::ConnectionError, "unreachable"
|
||||
)
|
||||
|
||||
result = service.provision("tok", repos: [ repo ])
|
||||
result = service.provision("tok", pipelines: [ repo ])
|
||||
|
||||
expect(result[:synced]).to be_empty
|
||||
expect(result[:failed].size).to eq(1)
|
||||
@@ -54,7 +54,7 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
it "deletes secrets from all relevant repos" do
|
||||
token = create(:application_token)
|
||||
sw = create(:software, name: "game1", owner: token.owner)
|
||||
repo = create(:ci_repository, :with_software, software: sw)
|
||||
repo = create(:pipeline, :with_software, software: sw)
|
||||
|
||||
allow(client).to receive(:delete_secret)
|
||||
|
||||
@@ -68,7 +68,7 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
it "creates new token, provisions, revokes old" do
|
||||
token = create(:application_token)
|
||||
sw = create(:software, name: "game1", owner: token.owner)
|
||||
repo = create(:ci_repository, :with_software, software: sw)
|
||||
repo = create(:pipeline, :with_software, software: sw)
|
||||
|
||||
allow(client).to receive(:list_secrets).and_return([])
|
||||
allow(client).to receive(:create_secret)
|
||||
@@ -83,7 +83,7 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
it "rolls back if all repos fail" do
|
||||
token = create(:application_token)
|
||||
sw = create(:software, name: "game1", owner: token.owner)
|
||||
create(:ci_repository, :with_software, software: sw)
|
||||
create(:pipeline, :with_software, software: sw)
|
||||
|
||||
allow(client).to receive(:list_secrets).and_raise(
|
||||
WarpEngine::WoodpeckerClient::ConnectionError, "down"
|
||||
@@ -101,17 +101,17 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
result = service.rotate(token)
|
||||
|
||||
expect(result[:rotated]).to be false
|
||||
expect(result[:reason]).to eq("no repos")
|
||||
expect(result[:reason]).to eq("no pipelines")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#repos_for_token" do
|
||||
describe "#pipelines_for_token" do
|
||||
it "returns all active repos for unrestricted tokens" do
|
||||
token = create(:application_token, :unrestricted)
|
||||
repo1 = create(:ci_repository)
|
||||
create(:ci_repository, :inactive)
|
||||
repo1 = create(:pipeline)
|
||||
create(:pipeline, :inactive)
|
||||
|
||||
repos = service.repos_for_token(token)
|
||||
repos = service.pipelines_for_token(token)
|
||||
|
||||
expect(repos).to eq([ repo1 ])
|
||||
end
|
||||
@@ -120,10 +120,10 @@ RSpec.describe WarpEngine::CiSecretSyncService do
|
||||
token = create(:application_token)
|
||||
own_sw = create(:software, name: "mine", owner: token.owner)
|
||||
other_sw = create(:software, name: "theirs", owner: create(:test_owner))
|
||||
own_repo = create(:ci_repository, :with_software, software: own_sw)
|
||||
create(:ci_repository, :with_software, software: other_sw)
|
||||
own_repo = create(:pipeline, :with_software, software: own_sw)
|
||||
create(:pipeline, :with_software, software: other_sw)
|
||||
|
||||
repos = service.repos_for_token(token)
|
||||
repos = service.pipelines_for_token(token)
|
||||
|
||||
expect(repos).to eq([ own_repo ])
|
||||
end
|
||||
@@ -0,0 +1,98 @@
|
||||
require "rails_helper"
|
||||
require "tmpdir"
|
||||
|
||||
# The serving side (FileService, DownloadService) goes through the storage
|
||||
# adapter. With :local nothing changes; with a custom adapter the same call
|
||||
# can hand back a redirect instead of a file.
|
||||
RSpec.describe "Serving through the storage adapter" do
|
||||
let(:tmpdir) { Dir.mktmpdir }
|
||||
|
||||
# Minimal adapter answering the documented contract.
|
||||
let(:signing_adapter) do
|
||||
Class.new do
|
||||
def file?(_relative) = true
|
||||
def directory?(_relative) = false
|
||||
|
||||
def locate(relative, filename: nil, expires_in: nil)
|
||||
WarpEngine::Storage::Location.redirect("https://cdn.example/#{relative}?signed=1")
|
||||
end
|
||||
end.new
|
||||
end
|
||||
|
||||
before do
|
||||
allow(WarpEngine.config).to receive(:file_container_path).and_return(tmpdir)
|
||||
WarpEngine::Storage.reset!
|
||||
File.write(File.join(tmpdir, "game-1.0.zip"), "zip")
|
||||
end
|
||||
|
||||
after { FileUtils.rm_rf(tmpdir) }
|
||||
|
||||
describe WarpEngine::FileService do
|
||||
it "serves a local file (default adapter)" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(:local)
|
||||
|
||||
result = described_class.new.show(WarpEngine::FileShowInputDto.new(path: "game-1.0.zip"))
|
||||
|
||||
expect(result.type).to eq(:file)
|
||||
expect(result.path).to eq(File.join(tmpdir, "game-1.0.zip"))
|
||||
end
|
||||
|
||||
it "redirects a directory to its index.html" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(:local)
|
||||
FileUtils.mkdir_p(File.join(tmpdir, "game-1.0"))
|
||||
File.write(File.join(tmpdir, "game-1.0", "index.html"), "<h1>hi</h1>")
|
||||
|
||||
result = described_class.new.show(WarpEngine::FileShowInputDto.new(path: "game-1.0"))
|
||||
|
||||
expect(result.type).to eq(:redirect)
|
||||
expect(result.url).to eq("/file/game-1.0/index.html")
|
||||
end
|
||||
|
||||
it "hands back the adapter's redirect when storage is remote" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(signing_adapter)
|
||||
|
||||
result = described_class.new.show(WarpEngine::FileShowInputDto.new(path: "game-1.0.zip"))
|
||||
|
||||
expect(result.type).to eq(:redirect)
|
||||
expect(result.url).to eq("https://cdn.example/game-1.0.zip?signed=1")
|
||||
end
|
||||
|
||||
it "reports a missing file" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(:local)
|
||||
|
||||
result = described_class.new.show(WarpEngine::FileShowInputDto.new(path: "nope.zip"))
|
||||
|
||||
expect(result.type).to eq(:not_found)
|
||||
end
|
||||
end
|
||||
|
||||
describe WarpEngine::DownloadService do
|
||||
let(:args) { { ip: "127.0.0.1", user_agent: "rspec", referer: nil } }
|
||||
|
||||
it "keeps returning an absolute path from #create (backward compatible)" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(:local)
|
||||
|
||||
path = described_class.new.create(path: "game-1.0.zip", **args)
|
||||
|
||||
expect(path).to eq(File.join(tmpdir, "game-1.0.zip"))
|
||||
expect(WarpEngine::Download.count).to eq(1)
|
||||
end
|
||||
|
||||
it "returns nil from #create for a missing file" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(:local)
|
||||
|
||||
expect(described_class.new.create(path: "nope.zip", **args)).to be_nil
|
||||
expect(WarpEngine::Download.count).to eq(0)
|
||||
end
|
||||
|
||||
it "returns a location from #locate and logs the download" do
|
||||
allow(WarpEngine.config).to receive(:storage_adapter).and_return(signing_adapter)
|
||||
|
||||
location = described_class.new.locate(path: "game-1.0.zip", **args)
|
||||
|
||||
expect(location).to be_redirect
|
||||
expect(location.url).to include("signed=1")
|
||||
expect(WarpEngine::Download.count).to eq(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -13,7 +13,11 @@ Gem::Specification.new do |spec|
|
||||
|
||||
spec.required_ruby_version = ">= 3.2"
|
||||
|
||||
spec.metadata["allowed_push_host"] = "https://git.teletypegames.org"
|
||||
# Must match the --host passed to `gem push`; the forge serves one RubyGems
|
||||
# registry per org, and the engine lives in `engines`.
|
||||
spec.metadata["allowed_push_host"] = "https://git.teletypegames.org/api/packages/engines/rubygems"
|
||||
spec.metadata["source_code_uri"] = "https://git.teletypegames.org/engines/warp_engine"
|
||||
spec.metadata["documentation_uri"] = "https://wiki.teletypegames.org/infrastructure/warp-engine"
|
||||
|
||||
spec.files = Dir["{app,config,db,lib}/**/*", "README.md"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user