Merge pull request 'Woodpecker CI workflows (PR and develop releases)' (#3477) from phnt/pleroma-fe:woodpecker-pr-ci into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma-fe/pulls/3477
This commit is contained in:
commit
dee95c5f7a
7 changed files with 273 additions and 3 deletions
43
.woodpecker/build.yaml
Normal file
43
.woodpecker/build.yaml
Normal file
|
|
@ -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
|
||||
10
.woodpecker/changelog.yaml
Normal file
10
.woodpecker/changelog.yaml
Normal file
|
|
@ -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
|
||||
32
.woodpecker/lint.yaml
Normal file
32
.woodpecker/lint.yaml
Normal file
|
|
@ -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
|
||||
111
.woodpecker/test-e2e.yaml
Normal file
111
.woodpecker/test-e2e.yaml
Normal file
|
|
@ -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"
|
||||
71
.woodpecker/test.yaml
Normal file
71
.woodpecker/test.yaml
Normal file
|
|
@ -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
|
||||
0
changelog.d/woodpecker-pr-pipeline.skip
Normal file
0
changelog.d/woodpecker-pr-pipeline.skip
Normal file
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue