|
| 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 |
0 commit comments