From d35b02fa236ce825e7d96a8d85d710dccc62bdb8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 28 Oct 2021 01:16:13 +0900 Subject: Improve CI --- .github/workflows/lint.yml | 21 +++++++++++ .github/workflows/nodejs.yml | 59 ------------------------------ .github/workflows/test.yml | 87 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- 4 files changed, 110 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/nodejs.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..0b3bbc186f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,21 @@ +name: Lint + +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: yarn install + - run: yarn lint diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index a91572ad78..0000000000 --- a/.github/workflows/nodejs.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Node.js CI -on: - push: - branches: - - master - - develop - pull_request: - -jobs: - build_and_test: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [14.x, 16.x] - - services: - postgres: - image: postgres:12.2-alpine - ports: - - 54312:5432 - env: - POSTGRES_DB: test-misskey - POSTGRES_HOST_AUTH_METHOD: trust - redis: - image: redis:4.0-alpine - ports: - - 56312:6379 - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: yarn install - - name: Check yarn.lock - run: git diff --exit-code yarn.lock - - name: Copy Configure - run: cp test/test.yml .config - - name: Build - run: yarn build - - name: Test - run: yarn test - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions/setup-node@v1 - with: - node-version: 12.x - - run: yarn install - - run: yarn lint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..045d209802 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,87 @@ +name: Test + +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + mocha: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + services: + postgres: + image: postgres:12.2-alpine + ports: + - 54312:5432 + env: + POSTGRES_DB: test-misskey + POSTGRES_HOST_AUTH_METHOD: trust + redis: + image: redis:4.0-alpine + ports: + - 56312:6379 + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: yarn install + - name: Check yarn.lock + run: git diff --exit-code yarn.lock + - name: Copy Configure + run: cp test/test.yml .config + - name: Build + run: yarn build + - name: Test + run: yarn mocha + + e2e: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + services: + postgres: + image: postgres:12.2-alpine + ports: + - 54312:5432 + env: + POSTGRES_DB: test-misskey + POSTGRES_HOST_AUTH_METHOD: trust + redis: + image: redis:4.0-alpine + ports: + - 56312:6379 + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: yarn install + - name: Check yarn.lock + run: git diff --exit-code yarn.lock + - name: Copy Configure + run: cp test/test.yml .config + - name: Build + run: yarn build + - name: Test + run: yarn e2e diff --git a/package.json b/package.json index f0bdd0049d..1da71f4d86 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "cy:open": "cypress open", "cy:run": "cypress run", "e2e": "start-server-and-test start:test http://localhost cy:run", - "test": "cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", + "mocha": "cross-env TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", + "test": "npm run mocha", "format": "gulp format" }, "resolutions": { -- cgit v1.2.3-freya