summaryrefslogtreecommitdiff
path: root/packages/backend/test-federation/compose.yml
blob: 4df4ced365b9c51ffeba3e1d4fe3b3d0d4cfaa65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
include:
  - ./compose.a.yml
  - ./compose.b.yml

services:
  setup:
    extends:
      file: ./compose.tpl.yml
      service: misskey
    command: >
      bash -c "
        npm install -g pnpm
        pnpm -F backend i
        pnpm -F misskey-js i
        pnpm -F misskey-reversi i
      "

  tester:
    image: node:20
    depends_on:
      a.test:
        condition: service_healthy
      misskey.a.test:
        condition: service_healthy
      b.test:
        condition: service_healthy
      misskey.b.test:
        condition: service_healthy
    environment:
      - NODE_ENV=development
      - NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/rootCA.crt
    volumes:
      - type: bind
        source: ../package.json
        target: /misskey/packages/backend/package.json
        read_only: true
      - type: bind
        source: ../test/resources
        target: /misskey/packages/backend/test/resources
        read_only: true
      - type: bind
        source: ./test
        target: /misskey/packages/backend/test-federation/test
        read_only: true
      - type: bind
        source: ../jest.config.cjs
        target: /misskey/packages/backend/jest.config.cjs
        read_only: true
      - type: bind
        source: ../jest.config.fed.cjs
        target: /misskey/packages/backend/jest.config.fed.cjs
        read_only: true
      - type: bind
        source: ../../misskey-js/built
        target: /misskey/packages/misskey-js/built
        read_only: true
      - type: bind
        source: ../../misskey-js/package.json
        target: /misskey/packages/misskey-js/package.json
        read_only: true
      - type: bind
        source: ../../../package.json
        target: /misskey/package.json
        read_only: true
      - type: bind
        source: ../../../pnpm-lock.yaml
        target: /misskey/pnpm-lock.yaml
        read_only: true
      - type: bind
        source: ../../../pnpm-workspace.yaml
        target: /misskey/pnpm-workspace.yaml
        read_only: true
      - type: bind
        source: ./certificates/rootCA.crt
        target: /usr/local/share/ca-certificates/rootCA.crt
        read_only: true
    working_dir: /misskey
    entrypoint: >
      bash -c '
        npm install -g pnpm
        pnpm -F misskey-js i --frozen-lockfile
        pnpm -F backend i --frozen-lockfile
        exec "$0" "$@"
      '
    command: pnpm -F backend test:fed

  daemon:
    image: node:20
    depends_on:
      redis.test:
        condition: service_healthy
    volumes:
      - type: bind
        source: ../package.json
        target: /misskey/packages/backend/package.json
        read_only: true
      - type: bind
        source: ./daemon.ts
        target: /misskey/packages/backend/test-federation/daemon.ts
        read_only: true
      - type: bind
        source: ./tsconfig.json
        target: /misskey/packages/backend/test-federation/tsconfig.json
        read_only: true
      - type: bind
        source: ../../../package.json
        target: /misskey/package.json
        read_only: true
      - type: bind
        source: ../../../pnpm-lock.yaml
        target: /misskey/pnpm-lock.yaml
        read_only: true
      - type: bind
        source: ../../../pnpm-workspace.yaml
        target: /misskey/pnpm-workspace.yaml
        read_only: true
    working_dir: /misskey
    command: >
      bash -c "
        npm install -g pnpm
        pnpm -F backend i --frozen-lockfile
        pnpm exec tsc -p ./packages/backend/test-federation
        node ./packages/backend/test-federation/built/daemon.js
      "

  redis.test:
    image: redis:7-alpine
    volumes:
      - type: bind
        source: ./volumes/redis
        target: /data
        bind:
          create_host_path: true
    healthcheck:
      test: redis-cli ping
      interval: 5s
      retries: 20