From 1a214b2cf4228e349331acd3a56491ab4c47933a Mon Sep 17 00:00:00 2001 From: zyoshoka <107108195+zyoshoka@users.noreply.github.com> Date: Thu, 13 Mar 2025 14:58:31 +0900 Subject: [PATCH 1/2] chore(workflow): use `node-version-file` instead of hardcoded `node-version` --- .github/workflows/get-api-diff.yml | 5 ++--- .github/workflows/on-release-created.yml | 9 ++------- .github/workflows/storybook.yml | 2 +- .github/workflows/test-backend.yml | 16 ++++------------ .github/workflows/test-federation.yml | 7 ++----- .github/workflows/test-frontend.yml | 13 ++++--------- .github/workflows/test-misskey-js.yml | 9 ++------- .github/workflows/test-production.yml | 8 ++------ .github/workflows/validate-api-json.yml | 8 ++------ 9 files changed, 21 insertions(+), 56 deletions(-) diff --git a/.github/workflows/get-api-diff.yml b/.github/workflows/get-api-diff.yml index 3244a39156..0ecb834bc0 100644 --- a/.github/workflows/get-api-diff.yml +++ b/.github/workflows/get-api-diff.yml @@ -17,7 +17,6 @@ jobs: strategy: matrix: - node-version: [22.11.0] api-json-name: [api-base.json, api-head.json] include: - api-json-name: api-base.json @@ -32,10 +31,10 @@ jobs: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml diff --git a/.github/workflows/on-release-created.yml b/.github/workflows/on-release-created.yml index aa32f2cb3b..033a940a48 100644 --- a/.github/workflows/on-release-created.yml +++ b/.github/workflows/on-release-created.yml @@ -15,22 +15,17 @@ jobs: contents: read id-token: write - strategy: - matrix: - node-version: [22.11.0] - steps: - uses: actions/checkout@v4.2.2 with: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - registry-url: 'https://registry.npmjs.org' - name: Publish package run: | pnpm i --frozen-lockfile diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 9fdbeab913..68a1c547c5 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -42,7 +42,7 @@ jobs: git checkout $(git rev-list --parents -n1 HEAD | cut -d" " -f3) - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js 20.x + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: node-version-file: '.node-version' diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 69652621ca..f92d4cc65a 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -23,10 +23,6 @@ jobs: name: Unit tests (backend) runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.11.0] - services: postgres: image: postgres:15 @@ -61,10 +57,10 @@ jobs: exit 1 fi done - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml @@ -85,10 +81,6 @@ jobs: name: E2E tests (backend) runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.11.0] - services: postgres: image: postgres:15 @@ -108,10 +100,10 @@ jobs: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml diff --git a/.github/workflows/test-federation.yml b/.github/workflows/test-federation.yml index 93588b54b9..a74aea9223 100644 --- a/.github/workflows/test-federation.yml +++ b/.github/workflows/test-federation.yml @@ -19,9 +19,6 @@ jobs: test: name: Federation test runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.11.0] steps: - uses: actions/checkout@v4 with: @@ -43,10 +40,10 @@ jobs: exit 1 fi done - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - name: Build Misskey run: | diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index 14a754c190..88735f4b88 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -27,20 +27,16 @@ jobs: name: Unit tests (frontend) runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.11.0] - steps: - uses: actions/checkout@v4.2.2 with: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml @@ -64,7 +60,6 @@ jobs: strategy: fail-fast: false matrix: - node-version: [22.11.0] browser: [chrome] services: @@ -92,10 +87,10 @@ jobs: # if: ${{ matrix.browser == 'firefox' }} - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Copy Configure diff --git a/.github/workflows/test-misskey-js.yml b/.github/workflows/test-misskey-js.yml index 29b6c6172b..755047c1ca 100644 --- a/.github/workflows/test-misskey-js.yml +++ b/.github/workflows/test-misskey-js.yml @@ -20,11 +20,6 @@ jobs: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.11.0] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - steps: - name: Checkout uses: actions/checkout@v4.2.2 @@ -32,10 +27,10 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/test-production.yml b/.github/workflows/test-production.yml index 205eae2399..cf1c0c91b6 100644 --- a/.github/workflows/test-production.yml +++ b/.github/workflows/test-production.yml @@ -15,20 +15,16 @@ jobs: name: Production build runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.11.0] - steps: - uses: actions/checkout@v4.2.2 with: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml diff --git a/.github/workflows/validate-api-json.yml b/.github/workflows/validate-api-json.yml index f84efa4821..dc9c2eae90 100644 --- a/.github/workflows/validate-api-json.yml +++ b/.github/workflows/validate-api-json.yml @@ -16,20 +16,16 @@ jobs: validate-api-json: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22.11.0] - steps: - uses: actions/checkout@v4.2.2 with: submodules: true - name: Setup pnpm uses: pnpm/action-setup@v4.1.0 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js uses: actions/setup-node@v4.2.0 with: - node-version: ${{ matrix.node-version }} + node-version-file: '.node-version' cache: 'pnpm' - name: Install Redocly CLI run: npm i -g @redocly/cli From a16873ab76baf6b2e8774299cb178c2486d25e49 Mon Sep 17 00:00:00 2001 From: zyoshoka <107108195+zyoshoka@users.noreply.github.com> Date: Thu, 1 May 2025 21:09:24 +0900 Subject: [PATCH 2/2] chore: test min version --- .github/min.node-version | 1 + .github/workflows/test-backend.yml | 14 ++++++++++++-- .github/workflows/test-federation.yml | 8 +++++++- packages/backend/test-federation/README.md | 6 +++--- packages/backend/test-federation/compose.tpl.yml | 2 +- packages/backend/test-federation/compose.yml | 4 ++-- 6 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 .github/min.node-version diff --git a/.github/min.node-version b/.github/min.node-version new file mode 100644 index 0000000000..d5a159609d --- /dev/null +++ b/.github/min.node-version @@ -0,0 +1 @@ +20.10.0 diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 7938a11af4..9d611c9964 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -22,6 +22,11 @@ jobs: unit: name: Unit tests (backend) runs-on: ubuntu-latest + strategy: + matrix: + node-version-file: + - .node-version + - .github/min.node-version services: postgres: @@ -60,7 +65,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4.4.0 with: - node-version-file: '.node-version' + node-version-file: ${{ matrix.node-version-file }} cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml @@ -80,6 +85,11 @@ jobs: e2e: name: E2E tests (backend) runs-on: ubuntu-latest + strategy: + matrix: + node-version-file: + - .node-version + - .github/min.node-version services: postgres: @@ -103,7 +113,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4.4.0 with: - node-version-file: '.node-version' + node-version-file: ${{ matrix.node-version-file }} cache: 'pnpm' - run: pnpm i --frozen-lockfile - name: Check pnpm-lock.yaml diff --git a/.github/workflows/test-federation.yml b/.github/workflows/test-federation.yml index 65f9f7d192..82895cdf37 100644 --- a/.github/workflows/test-federation.yml +++ b/.github/workflows/test-federation.yml @@ -19,6 +19,11 @@ jobs: test: name: Federation test runs-on: ubuntu-latest + strategy: + matrix: + node-version-file: + - .node-version + - .github/min.node-version steps: - uses: actions/checkout@v4 with: @@ -43,7 +48,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v4.4.0 with: - node-version-file: '.node-version' + node-version-file: ${{ matrix.node-version-file }} cache: 'pnpm' - name: Build Misskey run: | @@ -51,6 +56,7 @@ jobs: pnpm build - name: Setup run: | + echo "NODE_VERSION=$(cat ${{ matrix.node-version-file }})" >> $GITHUB_ENV cd packages/backend/test-federation bash ./setup.sh sudo chmod 644 ./certificates/*.test.key diff --git a/packages/backend/test-federation/README.md b/packages/backend/test-federation/README.md index 967d51f085..4ea88c1b80 100644 --- a/packages/backend/test-federation/README.md +++ b/packages/backend/test-federation/README.md @@ -10,15 +10,15 @@ cd packages/backend/test-federation First, you need to start servers by executing following commands: ```sh bash ./setup.sh -docker compose up --scale tester=0 +NODE_VERSION=22 docker compose up --scale tester=0 ``` Then you can run all tests by a following command: ```sh -docker compose run --no-deps --rm tester +NODE_VERSION=22 docker compose run --no-deps --rm tester ``` For testing a specific file, run a following command: ```sh -docker compose run --no-deps --rm tester -- pnpm -F backend test:fed packages/backend/test-federation/test/user.test.ts +NODE_VERSION=22 docker compose run --no-deps --rm tester -- pnpm -F backend test:fed packages/backend/test-federation/test/user.test.ts ``` diff --git a/packages/backend/test-federation/compose.tpl.yml b/packages/backend/test-federation/compose.tpl.yml index a7e907c3ee..e4483acd7a 100644 --- a/packages/backend/test-federation/compose.tpl.yml +++ b/packages/backend/test-federation/compose.tpl.yml @@ -12,7 +12,7 @@ services: retries: 20 misskey: - image: node:20 + image: node:${NODE_VERSION} env_file: - ./.config/docker.env environment: diff --git a/packages/backend/test-federation/compose.yml b/packages/backend/test-federation/compose.yml index 4df4ced365..6c010e0089 100644 --- a/packages/backend/test-federation/compose.yml +++ b/packages/backend/test-federation/compose.yml @@ -16,7 +16,7 @@ services: " tester: - image: node:20 + image: node:${NODE_VERSION} depends_on: a.test: condition: service_healthy @@ -85,7 +85,7 @@ services: command: pnpm -F backend test:fed daemon: - image: node:20 + image: node:${NODE_VERSION} depends_on: redis.test: condition: service_healthy