name: Test (backend) on: push: branches: - master - develop paths: - packages/backend/** # for permissions - packages/misskey-js/** - .github/workflows/test-backend.yml - .github/misskey/test.yml pull_request: paths: - packages/backend/** # for permissions - packages/misskey-js/** - .github/workflows/test-backend.yml - .github/misskey/test.yml workflow_dispatch: jobs: unit: name: Unit tests (backend) runs-on: ubuntu-latest strategy: matrix: node-version-file: - .node-version - .github/min.node-version services: postgres: image: postgres:18 ports: - 54312:5432 env: POSTGRES_DB: test-misskey POSTGRES_HOST_AUTH_METHOD: trust redis: image: redis:8 ports: - 56312:6379 meilisearch: image: getmeili/meilisearch:v1.42.1 ports: - 57712:7700 env: MEILI_NO_ANALYTICS: true MEILI_ENV: development steps: - uses: actions/checkout@v6.0.2 with: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v6.0.3 - name: Install FFmpeg run: | sudo apt install -y ffmpeg - name: Use Node.js uses: actions/setup-node@v6.4.0 with: node-version-file: ${{ matrix.node-version-file }} cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml run: git diff --exit-code pnpm-lock.yaml - name: Copy Configure run: cp .github/misskey/test.yml .config - name: Build run: pnpm build - name: Test run: pnpm --filter backend test-and-coverage - name: Upload to Codecov uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/backend/coverage/coverage-final.json e2e: name: E2E tests (backend) runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version-file: - .node-version - .github/min.node-version services: postgres: image: postgres:18 ports: - 54312:5432 env: POSTGRES_DB: test-misskey POSTGRES_HOST_AUTH_METHOD: trust redis: image: redis:8 ports: - 56312:6379 steps: - uses: actions/checkout@v6.0.2 with: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v6.0.3 - name: Use Node.js uses: actions/setup-node@v6.4.0 with: node-version-file: ${{ matrix.node-version-file }} cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml run: git diff --exit-code pnpm-lock.yaml - name: Copy Configure run: cp .github/misskey/test.yml .config - name: Build run: pnpm build - name: Test run: pnpm --filter backend test-and-coverage:e2e - name: Upload to Codecov uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./packages/backend/coverage/coverage-final.json migration: name: Migration tests (backend) runs-on: ubuntu-latest strategy: matrix: node-version-file: - .node-version #- .github/min.node-version services: postgres: image: postgres:18 ports: - 54312:5432 env: POSTGRES_DB: test-misskey POSTGRES_HOST_AUTH_METHOD: trust steps: - uses: actions/checkout@v6.0.2 with: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v6.0.3 - name: Get current date id: current-date run: echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - name: Use Node.js uses: actions/setup-node@v6.4.0 with: node-version-file: ${{ matrix.node-version-file }} cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml run: git diff --exit-code pnpm-lock.yaml - name: Copy Configure run: cp .github/misskey/test.yml .config - name: Build run: pnpm build - name: Run migrations run: MISSKEY_CONFIG_YML=test.yml pnpm --filter backend migrate - name: Check no migrations are remaining run: MISSKEY_CONFIG_YML=test.yml pnpm --filter backend check-migrations