diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 000000000..de91af5d8 --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,43 @@ +when: + - event: pull_request + evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate" && not(CI_COMMIT_SOURCE_BRANCH startsWith "renovate/")' + - event: push + branch: ${CI_REPO_DEFAULT_BRANCH} + - event: manual + branch: ${CI_REPO_DEFAULT_BRANCH} + +depends_on: + - test + - test-e2e + +labels: + platform: linux/amd64 + memory: 'high' + +steps: + build: + image: docker.io/node:18-alpine + commands: + - apk add --no-cache zip + - yarn --frozen-lockfile + - yarn build + - if [ "${CI_PIPELINE_EVENT}" = "push" ] || [ "${CI_PIPELINE_EVENT}" = "manual" ]; then zip -9qr ${CI_REPO_DEFAULT_BRANCH}.zip dist/; fi + + upload-artifacts: + image: docker.io/woodpeckercommunity/plugin-gitea-package:0.5.0 + when: + - event: push + branch: ${CI_REPO_DEFAULT_BRANCH} + - event: manual + branch: ${CI_REPO_DEFAULT_BRANCH} + settings: + user: + from_secret: pleroma-ci-user + password: + from_secret: pleroma-ci-password + update: true + owner: 'pleroma' + package_name: 'pleroma-fe-builds' + package_version: ${CI_REPO_DEFAULT_BRANCH} + file_source: ./${CI_REPO_DEFAULT_BRANCH}.zip + file_name: latest.zip diff --git a/.woodpecker/changelog.yaml b/.woodpecker/changelog.yaml new file mode 100644 index 000000000..b6c35afbb --- /dev/null +++ b/.woodpecker/changelog.yaml @@ -0,0 +1,10 @@ +when: + - event: pull_request + evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate" && not(CI_COMMIT_SOURCE_BRANCH startsWith "renovate/")' + +steps: + check-changelog: + image: docker.io/alpine:3.23 + commands: + - apk add --no-cache git + - sh ./tools/check-changelog diff --git a/.woodpecker/lint.yaml b/.woodpecker/lint.yaml new file mode 100644 index 000000000..237135ee9 --- /dev/null +++ b/.woodpecker/lint.yaml @@ -0,0 +1,32 @@ +when: + - event: pull_request + evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate" && not(CI_COMMIT_SOURCE_BRANCH startsWith "renovate/")' + - event: push + branch: ${CI_REPO_DEFAULT_BRANCH} + - event: manual + branch: ${CI_REPO_DEFAULT_BRANCH} + +steps: + install-depends: + image: &node-image + docker.io/node:18-alpine + commands: + - yarn --frozen-lockfile + + eslint: + image: *node-image + depends_on: install-depends + commands: + - yarn ci-eslint + + biome: + image: *node-image + depends_on: install-depends + commands: + - yarn ci-biome + + stylelint: + image: *node-image + depends_on: install-depends + commands: + - yarn ci-stylelint diff --git a/.woodpecker/test-e2e.yaml b/.woodpecker/test-e2e.yaml new file mode 100644 index 000000000..f4468f8c9 --- /dev/null +++ b/.woodpecker/test-e2e.yaml @@ -0,0 +1,111 @@ +when: + - event: pull_request + evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate" && not(CI_COMMIT_SOURCE_BRANCH startsWith "renovate/")' + - event: push + branch: ${CI_REPO_DEFAULT_BRANCH} + - event: manual + branch: ${CI_REPO_DEFAULT_BRANCH} + +labels: + platform: linux/amd64 + memory: 'high' + +variables: + artifacts_uploader_settings: &artifacts_uploader_settings + user: + from_secret: pleroma-ci-user + password: + from_secret: pleroma-ci-password + owner: 'pleroma' + package_name: 'pleroma-fe-test-artifacts' + script_file_entrypoint: &script_file_entrypoint + - /bin/sh + - -c + - 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh' + +steps: + test: + image: mcr.microsoft.com/playwright:v1.57.0-jammy + entrypoint: *script_file_entrypoint + environment: + APT_CACHE_DIR: apt-cache + DEBIAN_FRONTEND: noninteractive + E2E_BASE_URL: http://localhost:8080 + FF_NETWORK_PER_BUILD: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" + VITE_PROXY_ORIGIN: "http://pleroma:4000" + VITE_PROXY_TARGET: "http://pleroma:4000" + commands: + - mkdir -pv $APT_CACHE_DIR && apt-get -qq update + - apt-get install -y zip + - npm install -g yarn@1.22.22 + - yarn --frozen-lockfile + - | + echo "-- Waiting for Pleroma API..." + api_ok="false" + for _i in $(seq 1 120); do + if wget -qO- http://pleroma:4000/api/v1/instance >/dev/null 2>&1; then + api_ok="true" + break + fi + sleep 1s + done + if [ "$api_ok" != "true" ]; then + echo "Timed out waiting for Pleroma API to become available" + exit 1 + fi + - | + if ! yarn e2e:pw; then + zip -9qr ${CI_COMMIT_SHA:0:8}-e2e.zip ./test/e2e-playwright/test-results ./test/e2e-playwright/playwright-report + exit 1 + fi + + upload-artifacts-pr: + image: &artifacts_uploader_image + docker.io/woodpeckercommunity/plugin-gitea-package:0.5.0 + when: + - event: pull_request + status: [failure] + settings: + <<: *artifacts_uploader_settings + package_version: pr-${CI_COMMIT_PULL_REQUEST} + file_source: ./${CI_COMMIT_SHA:0:8}-e2e.zip + file_name: ./pr-${CI_COMMIT_PULL_REQUEST}-e2e.zip + update: true + + upload-artifacts: + image: *artifacts_uploader_image + when: + - event: push + branch: ${CI_REPO_DEFAULT_BRANCH} + status: [failure] + - event: manual + branch: ${CI_REPO_DEFAULT_BRANCH} + status: [failure] + settings: + <<: *artifacts_uploader_settings + package_version: ${CI_REPO_DEFAULT_BRANCH}-${CI_COMMIT_SHA:0:8} + file_source: ./${CI_COMMIT_SHA:0:8}-e2e.zip + file_name: ${CI_COMMIT_SHA:0:8}-e2e.zip + +services: + postgres: + image: docker.io/postgres:13-alpine + environment: + POSTGRES_DB: pleroma_test + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + + pleroma: + image: git.pleroma.social/pleroma/pleroma:stable-e2e + environment: + ADMIN_EMAIL: "admin@example.com" + NOTIFY_EMAIL: "admin@example.com" + DB_USER: postgres + DB_PASS: postgres + DB_NAME: pleroma_test + DB_HOST: postgres + INSTANCE_NAME: Pleroma E2E + E2E_ADMIN_USERNAME: admin + E2E_ADMIN_PASSWORD: adminadmin + E2E_ADMIN_EMAIL: "admin@example.com" diff --git a/.woodpecker/test.yaml b/.woodpecker/test.yaml new file mode 100644 index 000000000..6a21f7d41 --- /dev/null +++ b/.woodpecker/test.yaml @@ -0,0 +1,71 @@ +when: + - event: pull_request + evaluate: 'CI_COMMIT_SOURCE_BRANCH != "weblate" && not(CI_COMMIT_SOURCE_BRANCH startsWith "renovate/")' + - event: push + branch: ${CI_REPO_DEFAULT_BRANCH} + - event: manual + branch: ${CI_REPO_DEFAULT_BRANCH} + +labels: + platform: linux/amd64 + memory: 'high' + +variables: + artifacts_uploader_settings: &artifacts_uploader_settings + user: + from_secret: pleroma-ci-user + password: + from_secret: pleroma-ci-password + owner: 'pleroma' + package_name: 'pleroma-fe-test-artifacts' + script_file_entrypoint: &script_file_entrypoint + - /bin/sh + - -c + - 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh' + +steps: + test: + image: mcr.microsoft.com/playwright:v1.57.0-jammy + environment: + APT_CACHE_DIR: apt-cache + DEBIAN_FRONTEND: noninteractive + FF_NETWORK_PER_BUILD: "true" + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" + entrypoint: *script_file_entrypoint + commands: + - mkdir -pv $APT_CACHE_DIR && apt-get -qq update + - apt-get -y install zip + - yarn --frozen-lockfile + - | + if ! yarn unit-ci; then + zip -9qr ${CI_COMMIT_SHA:0:8}-screenshots.zip $(find . -type d -name __screenshots__) + exit 1 + fi + + upload-artifacts-pr: + image: &artifacts_uploader_image + docker.io/woodpeckercommunity/plugin-gitea-package:0.5.0 + when: + - event: pull_request + status: [failure] + settings: + <<: *artifacts_uploader_settings + package_version: pr-${CI_COMMIT_PULL_REQUEST} + file_source: ./${CI_COMMIT_SHA:0:8}-screenshots.zip + file_name: pr-${CI_COMMIT_PULL_REQUEST}-screenshots.zip + update: true + + upload-artifacts: + image: *artifacts_uploader_image + when: + - event: push + branch: ${CI_REPO_DEFAULT_BRANCH} + status: [failure] + - event: manual + branch: ${CI_REPO_DEFAULT_BRANCH} + status: [failure] + settings: + <<: *artifacts_uploader_settings + package_version: ${CI_REPO_DEFAULT_BRANCH}-${CI_COMMIT_SHA:0:8} + file_source: ./${CI_COMMIT_SHA:0:8}-screenshots.zip + file_name: ${CI_COMMIT_SHA:0:8}-screenshots.zip diff --git a/changelog.d/woodpecker-pr-pipeline.skip b/changelog.d/woodpecker-pr-pipeline.skip new file mode 100644 index 000000000..e69de29bb diff --git a/tools/check-changelog b/tools/check-changelog index 9b3ff37f2..69e8b71cb 100644 --- a/tools/check-changelog +++ b/tools/check-changelog @@ -1,12 +1,15 @@ #!/bin/sh +echo "adding ownership exception" +git config --global --add safe.directory "$(pwd)" + echo "looking for change log" git remote add upstream https://git.pleroma.social/pleroma/pleroma-fe.git -git fetch upstream ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}:refs/remotes/upstream/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME +git fetch upstream ${CI_COMMIT_TARGET_BRANCH}:refs/remotes/upstream/${CI_COMMIT_TARGET_BRANCH} -git diff --raw --no-renames upstream/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME HEAD -- changelog.d | \ - grep ' A\t' | grep '\.\(skip\|add\|remove\|change\|fix\|security\)$' +git diff --raw --no-renames upstream/${CI_COMMIT_TARGET_BRANCH} HEAD -- changelog.d | \ + grep ' A\t' | grep '\.\(skip\|add\|remove\|fix\|security\|change\)$' ret=$? if [ $ret -eq 0 ]; then