From a7421ca279891e86173a5d1e2e16abdd68460d53 Mon Sep 17 00:00:00 2001 From: eternal-flame-AD Date: Fri, 8 Nov 2024 16:59:24 -0600 Subject: [PATCH] add test-backend workflow Signed-off-by: eternal-flame-AD --- .forgejo/misskey/test.yml | 17 +++++ .forgejo/workflows/test-backend.yml | 96 +++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 .forgejo/misskey/test.yml create mode 100644 .forgejo/workflows/test-backend.yml diff --git a/.forgejo/misskey/test.yml b/.forgejo/misskey/test.yml new file mode 100644 index 0000000000..60005abf5a --- /dev/null +++ b/.forgejo/misskey/test.yml @@ -0,0 +1,17 @@ +url: 'http://misskey.local' + +setupPassword: example_password_please_change_this_or_you_will_get_hacked + +# ローカルでテストするときにポートを被らないようにするためデフォルトのものとは変える(以下同じ) +port: 61812 + +db: + host: postgres + port: 5432 + db: test-misskey + user: postgres + pass: '' +redis: + host: redis + port: 6379 +id: aidx diff --git a/.forgejo/workflows/test-backend.yml b/.forgejo/workflows/test-backend.yml new file mode 100644 index 0000000000..e83890147b --- /dev/null +++ b/.forgejo/workflows/test-backend.yml @@ -0,0 +1,96 @@ +name: Test (backend) + +on: + push: + branches: + - master + - develop + paths: + - packages/backend/** + # for permissions + - packages/misskey-js/** + - .forgejo/workflows/test-backend.yml + pull_request: + paths: + - packages/backend/** + # for permissions + - packages/misskey-js/** + - .forgejo/workflows/test-backend.yml +jobs: + unit: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.16.0] + + services: + postgres: + image: postgres:15 + env: + POSTGRES_DB: test-misskey + POSTGRES_HOST_AUTH_METHOD: trust + redis: + image: redis:7 + + steps: + - uses: actions/checkout@v4.1.1 + with: + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Install FFmpeg + uses: https://github.com/FedericoCarboni/setup-ffmpeg@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4.0.4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .forgejo/misskey/test.yml .config + - name: Build + run: pnpm build + - name: Test + run: pnpm --filter backend test-and-coverage + + e2e: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.16.0] + + services: + postgres: + image: postgres:15 + env: + POSTGRES_DB: test-misskey + POSTGRES_HOST_AUTH_METHOD: trust + redis: + image: redis:7 + + steps: + - uses: actions/checkout@v4.1.1 + with: + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4.0.4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .forgejo/misskey/test.yml .config + - name: Build + run: pnpm build + - name: Test + run: pnpm --filter backend test-and-coverage:e2e \ No newline at end of file