From e1f902001e874070127be14cf8a492aa0df4e3e4 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 18 Jul 2022 09:15:32 +0200 Subject: [PATCH 1/3] migrate CI to woodpecker --- .github/dependabot.yml | 22 ---- .github/labeler.yml | 12 --- .github/misskey/test.yml | 15 --- .github/workflows/docker-develop.yml | 33 ------ .github/workflows/docker.yml | 32 ------ .github/workflows/labeler.yml | 16 --- .github/workflows/lint.yml | 39 -------- .github/workflows/ok-to-test.yml | 36 ------- .github/workflows/pr-preview-deploy.yml | 95 ------------------ .github/workflows/pr-preview-destroy.yml | 21 ---- .github/workflows/test.yml | 122 ----------------------- .woodpecker/lint-backend.yml | 17 ++++ .woodpecker/lint-client.yml | 17 ++++ .woodpecker/misskey/test.yml | 13 +++ .woodpecker/test.yml | 45 +++++++++ 15 files changed, 92 insertions(+), 443 deletions(-) delete mode 100644 .github/dependabot.yml delete mode 100644 .github/labeler.yml delete mode 100644 .github/misskey/test.yml delete mode 100644 .github/workflows/docker-develop.yml delete mode 100644 .github/workflows/docker.yml delete mode 100644 .github/workflows/labeler.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/ok-to-test.yml delete mode 100644 .github/workflows/pr-preview-deploy.yml delete mode 100644 .github/workflows/pr-preview-destroy.yml delete mode 100644 .github/workflows/test.yml create mode 100644 .woodpecker/lint-backend.yml create mode 100644 .woodpecker/lint-client.yml create mode 100644 .woodpecker/misskey/test.yml create mode 100644 .woodpecker/test.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 2625cf75d..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,22 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - open-pull-requests-limit: 0 -- package-ecosystem: npm - directory: "/packages/backend" - schedule: - interval: daily - open-pull-requests-limit: 0 -- package-ecosystem: npm - directory: "/packages/client" - schedule: - interval: daily - open-pull-requests-limit: 0 diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 98f1d2e38..000000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,12 +0,0 @@ -'⚙️Server': -- packages/backend/**/* - -'🖥️Client': -- packages/client/**/* - -'🧪Test': -- cypress/**/* -- packages/backend/test/**/* - -'‼️ wrong locales': -- any: ['locales/*.yml', '!locales/ja-JP.yml'] diff --git a/.github/misskey/test.yml b/.github/misskey/test.yml deleted file mode 100644 index cd33f8a93..000000000 --- a/.github/misskey/test.yml +++ /dev/null @@ -1,15 +0,0 @@ -url: 'http://misskey.local' - -# ローカルでテストするときにポートを被らないようにするためデフォルトのものとは変える(以下同じ) -port: 61812 - -db: - host: localhost - port: 54312 - db: test-misskey - user: postgres - pass: '' -redis: - host: localhost - port: 56312 -id: aid diff --git a/.github/workflows/docker-develop.yml b/.github/workflows/docker-develop.yml deleted file mode 100644 index 09331edd1..000000000 --- a/.github/workflows/docker-develop.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Publish Docker image (develop) - -on: - push: - branches: - - develop - workflow_dispatch: - -jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: misskey/misskey - - name: Log in to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and Push to Docker Hub - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: misskey/misskey:develop - labels: develop diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 1c6ad343e..000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Publish Docker image - -on: - release: - types: [published] - workflow_dispatch: - -jobs: - push_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: misskey/misskey - - name: Log in to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and Push to Docker Hub - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index fa4a58c3a..000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Pull Request Labeler" -on: - pull_request_target: - branches-ignore: - - 'l10n_develop' - -jobs: - triage: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 4e42fa931..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Lint - -on: - push: - branches: - - master - - develop - pull_request: - -jobs: - backend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions/setup-node@v3 - with: - node-version: 18.x - cache: 'yarn' - cache-dependency-path: | - packages/backend/yarn.lock - - run: yarn install - - run: yarn --cwd ./packages/backend lint - - client: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions/setup-node@v3 - with: - node-version: 18.x - cache: 'yarn' - cache-dependency-path: | - packages/client/yarn.lock - - run: yarn install - - run: yarn --cwd ./packages/client lint diff --git a/.github/workflows/ok-to-test.yml b/.github/workflows/ok-to-test.yml deleted file mode 100644 index 87af3a6ba..000000000 --- a/.github/workflows/ok-to-test.yml +++ /dev/null @@ -1,36 +0,0 @@ -# If someone with write access comments "/ok-to-test" on a pull request, emit a repository_dispatch event -name: Ok To Test - -on: - issue_comment: - types: [created] - -jobs: - ok-to-test: - runs-on: ubuntu-latest - # Only run for PRs, not issue comments - if: ${{ github.event.issue.pull_request }} - steps: - # Generate a GitHub App installation access token from an App ID and private key - # To create a new GitHub App: - # https://developer.github.com/apps/building-github-apps/creating-a-github-app/ - # See app.yml for an example app manifest - - name: Generate token - id: generate_token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.DEPLOYBOT_APP_ID }} - private_key: ${{ secrets.DEPLOYBOT_PRIVATE_KEY }} - - - name: Slash Command Dispatch - uses: peter-evans/slash-command-dispatch@v1 - env: - TOKEN: ${{ steps.generate_token.outputs.token }} - with: - token: ${{ env.TOKEN }} # GitHub App installation access token - # token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # PAT or OAuth token will also work - reaction-token: ${{ secrets.GITHUB_TOKEN }} - issue-type: pull-request - commands: deploy - named-args: true - permission: write diff --git a/.github/workflows/pr-preview-deploy.yml b/.github/workflows/pr-preview-deploy.yml deleted file mode 100644 index fd43bce9e..000000000 --- a/.github/workflows/pr-preview-deploy.yml +++ /dev/null @@ -1,95 +0,0 @@ -# Run secret-dependent integration tests only after /deploy approval -on: - pull_request: - types: [opened, reopened, synchronize] - repository_dispatch: - types: [deploy-command] - -name: Deploy preview environment - -jobs: - # Repo owner has commented /deploy on a (fork-based) pull request - deploy-preview-environment: - runs-on: ubuntu-latest - if: - github.event_name == 'repository_dispatch' && - github.event.client_payload.slash_command.sha != '' && - contains(github.event.client_payload.pull_request.head.sha, github.event.client_payload.slash_command.sha) - steps: - - uses: actions/github-script@v5 - id: check-id - env: - number: ${{ github.event.client_payload.pull_request.number }} - job: ${{ github.job }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - result-encoding: string - script: | - const { data: pull } = await github.rest.pulls.get({ - ...context.repo, - pull_number: process.env.number - }); - const ref = pull.head.sha; - - const { data: checks } = await github.rest.checks.listForRef({ - ...context.repo, - ref - }); - - const check = checks.check_runs.filter(c => c.name === process.env.job); - - return check[0].id; - - - uses: actions/github-script@v5 - env: - check_id: ${{ steps.check-id.outputs.result }} - details_url: ${{ github.server_url }}/${{ github.repository }}/runs/${{ github.run_id }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - await github.rest.checks.update({ - ...context.repo, - check_run_id: process.env.check_id, - status: 'in_progress', - details_url: process.env.details_url - }); - - # Check out merge commit - - name: Fork based /deploy checkout - uses: actions/checkout@v2 - with: - ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge' - - # - - name: Context - uses: okteto/context@latest - with: - token: ${{ secrets.OKTETO_TOKEN }} - - - name: Deploy preview environment - uses: ikuradon/deploy-preview@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - name: pr-${{ github.event.client_payload.pull_request.number }}-syuilo - timeout: 15m - - # Update check run called "integration-fork" - - uses: actions/github-script@v5 - id: update-check-run - if: ${{ always() }} - env: - # Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run - conclusion: ${{ job.status }} - check_id: ${{ steps.check-id.outputs.result }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { data: result } = await github.rest.checks.update({ - ...context.repo, - check_run_id: process.env.check_id, - status: 'completed', - conclusion: process.env.conclusion - }); - - return result; diff --git a/.github/workflows/pr-preview-destroy.yml b/.github/workflows/pr-preview-destroy.yml deleted file mode 100644 index c14c3db5c..000000000 --- a/.github/workflows/pr-preview-destroy.yml +++ /dev/null @@ -1,21 +0,0 @@ -# file: .github/workflows/preview-closed.yaml -on: - pull_request: - types: - - closed - -name: Destroy preview environment - -jobs: - destroy-preview-environment: - runs-on: ubuntu-latest - steps: - - name: Context - uses: okteto/context@latest - with: - token: ${{ secrets.OKTETO_TOKEN }} - - - name: Destroy preview environment - uses: okteto/destroy-preview@latest - with: - name: pr-${{ github.event.number }}-syuilo diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index c32c82e2a..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Test - -on: - push: - branches: - - master - - develop - pull_request: - -jobs: - mocha: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x] - - services: - postgres: - image: postgres:13 - ports: - - 54312:5432 - env: - POSTGRES_DB: test-misskey - POSTGRES_HOST_AUTH_METHOD: trust - redis: - image: redis:6 - ports: - - 56312:6379 - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'yarn' - cache-dependency-path: | - packages/backend/yarn.lock - packages/client/yarn.lock - - name: Install dependencies - run: yarn install - - name: Check yarn.lock - run: git diff --exit-code yarn.lock - - name: Copy Configure - run: cp .github/misskey/test.yml .config - - name: Build - run: yarn build - - name: Test - run: yarn mocha - - e2e: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - node-version: [18.x] - browser: [chrome] - - services: - postgres: - image: postgres:13 - ports: - - 54312:5432 - env: - POSTGRES_DB: test-misskey - POSTGRES_HOST_AUTH_METHOD: trust - redis: - image: redis:6 - ports: - - 56312:6379 - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - # https://github.com/cypress-io/cypress-docker-images/issues/150 - #- name: Install mplayer for FireFox - # run: sudo apt install mplayer -y - # if: ${{ matrix.browser == 'firefox' }} - #- uses: browser-actions/setup-firefox@latest - # if: ${{ matrix.browser == 'firefox' }} - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'yarn' - cache-dependency-path: | - packages/backend/yarn.lock - packages/client/yarn.lock - - name: Install dependencies - run: yarn install - - name: Check yarn.lock - run: git diff --exit-code yarn.lock - - name: Copy Configure - run: cp .github/misskey/test.yml .config - - name: Build - run: yarn build - # https://github.com/cypress-io/cypress/issues/4351#issuecomment-559489091 - - name: ALSA Env - run: echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc - - name: Cypress run - uses: cypress-io/github-action@v4 - with: - install: false - start: npm run start:test - wait-on: 'http://localhost:61812' - headless: false - browser: ${{ matrix.browser }} - - uses: actions/upload-artifact@v2 - if: failure() - with: - name: ${{ matrix.browser }}-cypress-screenshots - path: cypress/screenshots - - uses: actions/upload-artifact@v2 - if: always() - with: - name: ${{ matrix.browser }}-cypress-videos - path: cypress/videos diff --git a/.woodpecker/lint-backend.yml b/.woodpecker/lint-backend.yml new file mode 100644 index 000000000..a3afe26b1 --- /dev/null +++ b/.woodpecker/lint-backend.yml @@ -0,0 +1,17 @@ +clone: + git: + image: woodpeckerci/plugin-git + settings: + depth: 1 # CI does not need commit history + recursive: true + +pipeline: + lint: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: + - yarn install + - yarn --cwd ./packages/backend lint diff --git a/.woodpecker/lint-client.yml b/.woodpecker/lint-client.yml new file mode 100644 index 000000000..54002f34b --- /dev/null +++ b/.woodpecker/lint-client.yml @@ -0,0 +1,17 @@ +clone: + git: + image: woodpeckerci/plugin-git + settings: + depth: 1 # CI does not need commit history + recursive: true + +pipeline: + lint: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: + - yarn install + - yarn --cwd ./packages/client lint diff --git a/.woodpecker/misskey/test.yml b/.woodpecker/misskey/test.yml new file mode 100644 index 000000000..dfb2920eb --- /dev/null +++ b/.woodpecker/misskey/test.yml @@ -0,0 +1,13 @@ +url: 'http://misskey.local' + +port: 80 + +db: + host: postgres + port: 5432 + db: test-misskey + user: postgres + pass: '' +redis: + host: redis + port: 6379 diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml new file mode 100644 index 000000000..282543734 --- /dev/null +++ b/.woodpecker/test.yml @@ -0,0 +1,45 @@ +clone: + git: + image: woodpeckerci/plugin-git + settings: + depth: 1 # CI does not need commit history + recursive: true + +pipeline: + mocha: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: + - yarn install + - git diff --exit-code yarn.lock + - cp .woodpecker/misskey/test.yml .config + - yarn build + - yarn mocha + e2e: + when: + event: + - push + - pull_request + image: cypress/included:10.3.0 + commands: + - yarn install + - git diff --exit-code yarn.lock + - cp .woodpecker/misskey/test.yml .config + - yarn build + - npm run start:test & + - sleep 30 # wait for server to start + - cypress run --browser chrome + # TODO: upload screenshots and video artifacts? + # would need some kind of storage though + +services: + postgres: + image: postgres:13 + env: + - POSTGRES_DB=test-misskey + - POSTGRES_HOST_AUTH_METHOD=trust + redis: + image: redis:6 From 7358d95e022ac1d74cf913e58eb11b344fbc2771 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 18 Jul 2022 10:36:57 +0200 Subject: [PATCH 2/3] add extra step for installing/building This should make the CI output more readable. --- .woodpecker/lint-backend.yml | 9 ++++++++- .woodpecker/lint-client.yml | 9 ++++++++- .woodpecker/test.yml | 13 ++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.woodpecker/lint-backend.yml b/.woodpecker/lint-backend.yml index a3afe26b1..c63d944e1 100644 --- a/.woodpecker/lint-backend.yml +++ b/.woodpecker/lint-backend.yml @@ -6,7 +6,7 @@ clone: recursive: true pipeline: - lint: + install: when: event: - push @@ -14,4 +14,11 @@ pipeline: image: node:18.6.0 commands: - yarn install + lint: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: - yarn --cwd ./packages/backend lint diff --git a/.woodpecker/lint-client.yml b/.woodpecker/lint-client.yml index 54002f34b..44958c029 100644 --- a/.woodpecker/lint-client.yml +++ b/.woodpecker/lint-client.yml @@ -6,7 +6,7 @@ clone: recursive: true pipeline: - lint: + install: when: event: - push @@ -14,4 +14,11 @@ pipeline: image: node:18.6.0 commands: - yarn install + lint: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: - yarn --cwd ./packages/client lint diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index 282543734..bf5d86050 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -6,7 +6,7 @@ clone: recursive: true pipeline: - mocha: + build: when: event: - push @@ -17,6 +17,13 @@ pipeline: - git diff --exit-code yarn.lock - cp .woodpecker/misskey/test.yml .config - yarn build + mocha: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: - yarn mocha e2e: when: @@ -25,10 +32,6 @@ pipeline: - pull_request image: cypress/included:10.3.0 commands: - - yarn install - - git diff --exit-code yarn.lock - - cp .woodpecker/misskey/test.yml .config - - yarn build - npm run start:test & - sleep 30 # wait for server to start - cypress run --browser chrome From 1506df3b94456a57d9e7e68ed955a74c0919b8c9 Mon Sep 17 00:00:00 2001 From: Chloe Kudryavtsev Date: Mon, 18 Jul 2022 06:45:03 -0400 Subject: [PATCH 3/3] chore(ci): add a dedicated build pipeline --- .woodpecker/build.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .woodpecker/build.yml diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 000000000..a99684cc9 --- /dev/null +++ b/.woodpecker/build.yml @@ -0,0 +1,24 @@ +clone: + git: + image: woodpeckerci/plugin-git + settings: + depth: 1 # CI does not need commit history + recursive: true + +pipeline: + install: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: + - yarn install + build: + when: + event: + - push + - pull_request + image: node:18.6.0 + commands: + - yarn build