diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 3bf3b9eff5..57bf53b168 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -21,14 +21,54 @@ on: workflow_dispatch: jobs: - unit: - name: Unit tests (backend) + build: + name: Build (${{ matrix.node-version-file }}) runs-on: ubuntu-latest strategy: matrix: - node-version-file: - - .node-version - - .github/min.node-version + include: + - node-version-file: .node-version + artifact-name: backend-test-repo-node-version + - node-version-file: .github/min.node-version + artifact-name: backend-test-repo-min-node-version + + steps: + - uses: actions/checkout@v6.0.3 + with: + submodules: true + - name: Setup pnpm + uses: pnpm/action-setup@v6.0.9 + - 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: Archive built repository + run: tar -C "$GITHUB_WORKSPACE" -czf "$RUNNER_TEMP/${{ matrix.artifact-name }}.tar.gz" . + - name: Upload built repository + uses: actions/upload-artifact@v7 + with: + name: ${{ matrix.artifact-name }} + path: ${{ runner.temp }}/${{ matrix.artifact-name }}.tar.gz + + unit: + name: Unit tests (backend) + runs-on: ubuntu-latest + needs: build + strategy: + matrix: + include: + - node-version-file: .node-version + artifact-name: backend-test-repo-node-version + - node-version-file: .github/min.node-version + artifact-name: backend-test-repo-min-node-version services: postgres: @@ -51,9 +91,13 @@ jobs: MEILI_ENV: development steps: - - uses: actions/checkout@v6.0.3 + - name: Download built repository + uses: actions/download-artifact@v8 with: - submodules: true + name: ${{ matrix.artifact-name }} + path: ${{ runner.temp }} + - name: Extract built repository + run: tar -C "$GITHUB_WORKSPACE" -xzf "$RUNNER_TEMP/${{ matrix.artifact-name }}.tar.gz" - name: Setup pnpm uses: pnpm/action-setup@v6.0.9 - name: Install FFmpeg @@ -64,13 +108,6 @@ jobs: 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 @@ -82,12 +119,15 @@ jobs: e2e: name: E2E tests (backend) runs-on: ubuntu-latest + needs: build strategy: fail-fast: false matrix: - node-version-file: - - .node-version - - .github/min.node-version + include: + - node-version-file: .node-version + artifact-name: backend-test-repo-node-version + - node-version-file: .github/min.node-version + artifact-name: backend-test-repo-min-node-version services: postgres: @@ -103,9 +143,13 @@ jobs: - 56312:6379 steps: - - uses: actions/checkout@v6.0.3 + - name: Download built repository + uses: actions/download-artifact@v8 with: - submodules: true + name: ${{ matrix.artifact-name }} + path: ${{ runner.temp }} + - name: Extract built repository + run: tar -C "$GITHUB_WORKSPACE" -xzf "$RUNNER_TEMP/${{ matrix.artifact-name }}.tar.gz" - name: Setup pnpm uses: pnpm/action-setup@v6.0.9 - name: Use Node.js @@ -113,13 +157,6 @@ jobs: 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 @@ -131,11 +168,12 @@ jobs: migration: name: Migration tests (backend) runs-on: ubuntu-latest + needs: build strategy: matrix: - node-version-file: - - .node-version - #- .github/min.node-version + include: + - node-version-file: .node-version + artifact-name: backend-test-repo-node-version services: postgres: @@ -147,9 +185,13 @@ jobs: POSTGRES_HOST_AUTH_METHOD: trust steps: - - uses: actions/checkout@v6.0.3 + - name: Download built repository + uses: actions/download-artifact@v8 with: - submodules: true + name: ${{ matrix.artifact-name }} + path: ${{ runner.temp }} + - name: Extract built repository + run: tar -C "$GITHUB_WORKSPACE" -xzf "$RUNNER_TEMP/${{ matrix.artifact-name }}.tar.gz" - name: Setup pnpm uses: pnpm/action-setup@v6.0.9 - name: Get current date @@ -160,13 +202,6 @@ jobs: 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 diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index e8a98b2b78..800e1e664e 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -23,8 +23,8 @@ on: - .github/workflows/test-frontend.yml - .github/misskey/test.yml jobs: - vitest: - name: Unit tests (frontend) + build: + name: Build runs-on: ubuntu-latest steps: @@ -45,6 +45,34 @@ jobs: run: cp .github/misskey/test.yml .config - name: Build run: pnpm build + - name: Archive built repository + run: tar -C "$GITHUB_WORKSPACE" -czf "$RUNNER_TEMP/frontend-test-repo.tar.gz" . + - name: Upload built repository + uses: actions/upload-artifact@v7 + with: + name: frontend-test-repo + path: ${{ runner.temp }}/frontend-test-repo.tar.gz + + vitest: + name: Unit tests (frontend) + runs-on: ubuntu-latest + needs: build + + steps: + - name: Download built repository + uses: actions/download-artifact@v8 + with: + name: frontend-test-repo + path: ${{ runner.temp }} + - name: Extract built repository + run: tar -C "$GITHUB_WORKSPACE" -xzf "$RUNNER_TEMP/frontend-test-repo.tar.gz" + - name: Setup pnpm + uses: pnpm/action-setup@v6.0.9 + - name: Use Node.js + uses: actions/setup-node@v6.4.0 + with: + node-version-file: '.node-version' + cache: 'pnpm' - name: Test run: pnpm --filter frontend test-and-coverage - name: Upload Coverage @@ -56,6 +84,7 @@ jobs: e2e: name: E2E tests (frontend) runs-on: ubuntu-latest + needs: build services: postgres: @@ -71,9 +100,13 @@ jobs: - 56312:6379 steps: - - uses: actions/checkout@v6.0.3 + - name: Download built repository + uses: actions/download-artifact@v8 with: - submodules: true + name: frontend-test-repo + path: ${{ runner.temp }} + - name: Extract built repository + run: tar -C "$GITHUB_WORKSPACE" -xzf "$RUNNER_TEMP/frontend-test-repo.tar.gz" - name: Setup pnpm uses: pnpm/action-setup@v6.0.9 - name: Use Node.js @@ -81,11 +114,6 @@ jobs: with: node-version-file: '.node-version' cache: 'pnpm' - - run: pnpm i --frozen-lockfile - - name: Copy Configure - run: cp .github/misskey/test.yml .config - - name: Build - run: pnpm build - name: Playwright install working-directory: packages/frontend run: pnpm exec playwright install --with-deps chromium