Skip to content

Commit 3a97632

Browse files
authored
Merge pull request #598 from sij411/feat/smoke
Add interoperability smoke tests for Mastodon (non-strict)
2 parents ef4f86d + 2392533 commit 3a97632

15 files changed

Lines changed: 1683 additions & 677 deletions
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
#
3+
# Interoperability smoke tests.
4+
# Spins up a Mastodon instance via Docker Compose and verifies that Fedify
5+
# can correctly exchange ActivityPub messages with it.
6+
# See: https://github.com/fedify-dev/fedify/issues/481
7+
name: smoke-mastodon
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
- next
14+
- "*.*-maintenance"
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
smoke:
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 25
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: ./.github/actions/setup-mise
30+
31+
- name: Generate Mastodon secrets
32+
run: |
33+
IMAGE=ghcr.io/mastodon/mastodon:v4.3.9
34+
docker pull "$IMAGE"
35+
36+
SECRET1=$(docker run --rm "$IMAGE" bundle exec rails secret)
37+
SECRET2=$(docker run --rm "$IMAGE" bundle exec rails secret)
38+
39+
{
40+
echo "SECRET_KEY_BASE=$SECRET1"
41+
echo "OTP_SECRET=$SECRET2"
42+
docker run --rm "$IMAGE" bundle exec rails mastodon:webpush:generate_vapid_key \
43+
| grep -E '^[A-Z_]+=.+'
44+
docker run --rm "$IMAGE" bundle exec rails db:encryption:init \
45+
| grep -E '^[A-Z_]+=.+'
46+
} >> test/smoke/mastodon/mastodon.env
47+
48+
- name: Start database and redis
49+
run: |
50+
docker compose -f test/smoke/mastodon/docker-compose.yml up -d db redis
51+
docker compose -f test/smoke/mastodon/docker-compose.yml exec -T db \
52+
sh -c 'until pg_isready -U mastodon; do sleep 1; done'
53+
54+
- name: Run DB setup and migrations
55+
run: |
56+
docker compose -f test/smoke/mastodon/docker-compose.yml run --rm -T \
57+
mastodon-web bundle exec rails db:setup
58+
timeout-minutes: 5
59+
60+
- name: Start Mastodon stack
61+
run: docker compose -f test/smoke/mastodon/docker-compose.yml up --wait
62+
timeout-minutes: 12
63+
64+
- name: Provision Mastodon
65+
run: bash test/smoke/mastodon/provision.sh
66+
67+
- name: Verify connectivity
68+
run: |
69+
echo "=== Harness health (from mastodon-web) ==="
70+
docker compose -f test/smoke/mastodon/docker-compose.yml exec -T mastodon-web \
71+
curl -sf http://fedify-harness:3001/_test/health
72+
echo " OK"
73+
74+
echo "=== Harness health (from mastodon-sidekiq) ==="
75+
docker compose -f test/smoke/mastodon/docker-compose.yml exec -T mastodon-sidekiq \
76+
curl -sf http://fedify-harness:3001/_test/health
77+
echo " OK"
78+
79+
- name: Run smoke tests
80+
run: |
81+
set -a && source test/smoke/.env.test && set +a
82+
deno run --allow-net --allow-env --unstable-temporal \
83+
test/smoke/orchestrator.ts
84+
85+
- name: Collect logs on failure
86+
if: failure()
87+
run: |
88+
echo "=== Docker Compose logs ==="
89+
docker compose -f test/smoke/mastodon/docker-compose.yml logs --tail=500
90+
91+
- name: Teardown
92+
if: always()
93+
run: docker compose -f test/smoke/mastodon/docker-compose.yml down -v

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ dist-tests/
77
node_modules/
88
package-lock.json
99
repomix-output.xml
10+
test/smoke/.env.test
11+
test/smoke/mastodon/mastodon.env
12+
smoke.log
1013
t.ts
1114
t2.ts
1215
plan.md

deno.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"./examples/astro",
3131
"./examples/fresh",
3232
"./examples/hono-sample",
33-
"./examples/rfc-9421-test"
33+
"./examples/rfc-9421-test",
34+
"./test/smoke/harness"
3435
],
3536
"imports": {
3637
"@cloudflare/workers-types": "npm:@cloudflare/workers-types@^4.20250529.0",

0 commit comments

Comments
 (0)