]> git.mxchange.org Git - friendica.git/commitdiff
[CI] Fix "bad_habit" warnings from woodpecker
authorPhilipp <admin@philipp.info>
Mon, 23 Dec 2024 21:08:09 +0000 (22:08 +0100)
committerPhilipp <admin@philipp.info>
Mon, 30 Dec 2024 15:13:07 +0000 (16:13 +0100)
.woodpecker/.code_standards_check.yml
.woodpecker/.continuous-deployment.yml
.woodpecker/.database_checks.yml
.woodpecker/.license_check.yml
.woodpecker/.messages.po_check.yml
.woodpecker/.phpunit.yml
.woodpecker/.releaser.yml

index 30938f15fe9f9cb21b2253b3db6c03bfb86d2b8a..e6b02c3d7ddd20600286ba74a4fb7ca93cae7bfb 100644 (file)
@@ -2,6 +2,12 @@
 #
 # SPDX-License-Identifier: CC0-1.0
 
+# The code standard check is just triggered for PRs and pushes to non-stable branches of Friendica
+when:
+  branch:
+    exclude: [ stable ]
+  event: [ pull_request, push ]
+
 steps:
   restore_cache:
     image: meltwater/drone-cache:dev
@@ -31,12 +37,19 @@ steps:
     volumes:
       - /tmp/drone-cache:/tmp/cache
   check:
-    image: friendicaci/php-cs
+    image: php:8.3
     commands:
+      - apt-get update -q
+      - DEBIAN_FRONTEND=noninteractive apt-get install -q -y git
       - if [ ! -z "$${CI_COMMIT_PULL_REQUEST}" ]; then
           git fetch --no-tags origin ${CI_COMMIT_TARGET_BRANCH};
-          export CHANGED_FILES="$(git diff --name-status $(git merge-base FETCH_HEAD origin/${CI_COMMIT_TARGET_BRANCH})..${CI_COMMIT_SHA} | grep ^A | cut -f2)";
+          CHANGED_FILES="$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base FETCH_HEAD origin/${CI_COMMIT_TARGET_BRANCH})..${CI_COMMIT_SHA})";
+        else
+          CHANGED_FILES="$(git diff --name-only --diff-filter=ACMRTUXB ${CI_COMMIT_SHA})";
+        fi
+      - if ! echo "$${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then
+          EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "$${CHANGED_FILES}");
         else
-          export CHANGED_FILES="$(git diff --name-status ${CI_COMMIT_SHA} | grep ^A | cut -f2)";
+          EXTRA_ARGS='';
         fi
-      - /check-php-cs.sh
+      - ./bin/dev/php-cs-fixer/vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php -v --diff --using-cache=no $${EXTRA_ARGS}
index eff4ae0cffc936e8594850b4236acbe9db6d67e5..f661104acf9f0705a67e9a96baba44880674a9f6 100644 (file)
@@ -13,6 +13,12 @@ labels:
   location: friendica
   type: releaser
 
+# CD is triggered after pushing new code to the develop or *-rc branch, excluding the stable branch
+when:
+  repo: friendica/friendica
+  branch: [ develop, '*-rc' ]
+  event: push
+
 skip_clone: true
 
 steps:
@@ -23,10 +29,6 @@ steps:
       - git checkout $CI_COMMIT_BRANCH
       - git fetch origin $CI_COMMIT_REF
       - git merge $CI_COMMIT_SHA
-    when:
-      repo: friendica/friendica
-      branch: [ develop, '*-rc' ]
-      event: push
   restore_cache:
     image: meltwater/drone-cache:dev
     settings:
@@ -38,10 +40,6 @@ steps:
         - '.composer'
     volumes:
       - /tmp/drone-cache:/tmp/cache
-    when:
-      repo: friendica/friendica
-      branch: [ develop, '*-rc' ]
-      event: push
   composer_install:
     image: friendicaci/php8.2:php8.2.16
     commands:
@@ -50,10 +48,6 @@ steps:
       - composer install --no-dev --optimize-autoloader
     volumes:
       - /etc/hosts:/etc/hosts
-    when:
-      repo: friendica/friendica
-      branch: [ develop, '*-rc' ]
-      event: push
   create_artifacts:
     image: debian
     commands:
@@ -74,10 +68,6 @@ steps:
       - ls -lh
       - cat "$ARTIFACT.sum256"
       - sha256sum "$ARTIFACT"
-    when:
-      repo: friendica/friendica
-      branch: [ develop, '*-rc' ]
-      event: push
   sign_artifacts:
     image: plugins/gpgsign
     settings:
@@ -90,17 +80,9 @@ steps:
       exclude:
         - build/*.sum256
       detach_sign: true
-    when:
-      repo: friendica/friendica
-      branch: [ develop, '*-rc' ]
-      event: push
   publish_artifacts:
     image: alpine
     commands:
       - cp -fr build/* /tmp/friendica_files/
     volumes:
       - files:/tmp/friendica_files
-    when:
-      repo: friendica/friendica
-      branch: [ develop, '*-rc' ]
-      event: push
index 6bde5b281e0a83906b46e7bc765fa6221a07daa7..c7b5ce533d7f783dabcf01f6a2cc5af9c0279827 100644 (file)
@@ -8,8 +8,9 @@ matrix:
       PHP_VERSION: 8.2.16
 
 when:
-  - branch:
-      exclude: [ stable ]
+  branch:
+    exclude: [ stable ]
+  event: [ pull_request, push ]
 
 # This forces CI executions at the "opensocial" labeled location (because of much more power...)
 labels:
index 1417fb9a9c7c7234a8079f374c32328f4fdd5711..86174e51fd16bc1c99a942696da47e8b6456201f 100644 (file)
@@ -2,6 +2,11 @@
 #
 # SPDX-License-Identifier: CC0-1.0
 
+when:
+  branch:
+    exclude: [ stable ]
+  event: [ pull_request, push ]
+
 steps:
   check:
     image: fsfe/reuse:latest
index 8df12b93ce4b68008922b7df016f6181226abfbf..2f9ae94044f51a1060d497c5c89266884a3b0605 100644 (file)
@@ -2,6 +2,11 @@
 #
 # SPDX-License-Identifier: CC0-1.0
 
+when:
+  branch:
+    exclude: [ stable ]
+  event: [ pull_request, push ]
+
 steps:
   build_xgettext:
     image: friendicaci/transifex
@@ -11,7 +16,3 @@ steps:
     image: friendicaci/transifex
     commands:
       - /check-messages.sh
-
-when:
-  - branch:
-      exclude: [ stable ]
index 58b5723cc67d424bad31161a9ff7181c548e3194..5bea36122bc912cf74301152bb7ee56fde7f2419 100644 (file)
@@ -19,6 +19,11 @@ matrix:
 labels:
   location: opensocial
 
+when:
+  branch:
+    exclude: [ stable ]
+  event: [ pull_request, push ]
+
 steps:
   php-lint:
     image: php:${PHP_MAJOR_VERSION}
index 0c7caac0097f0a454a91b10bb99398dd31d16d3b..8a720a2607a65f2fe5f7f929e81c2e3922e75cf2 100644 (file)
@@ -13,6 +13,11 @@ labels:
 
 skip_clone: true
 
+when:
+  repo: friendica/friendica
+  branch: stable
+  event: tag
+
 steps:
   clone:
     image: alpine/git
@@ -21,10 +26,7 @@ steps:
       - git checkout $CI_COMMIT_BRANCH
       - git fetch origin $CI_COMMIT_REF
       - git merge $CI_COMMIT_SHA
-    when:
-      repo: friendica/friendica
-      branch: stable
-      event: tag
+
   restore_cache:
     image: meltwater/drone-cache:dev
     settings:
@@ -36,20 +38,12 @@ steps:
         - '.composer'
     volumes:
       - /tmp/drone-cache:/tmp/cache
-    when:
-      repo: friendica/friendica
-      branch: stable
-      event: tag
   composer_install:
     image: friendicaci/php8.2:php8.2.16
     commands:
       - export COMPOSER_HOME=.composer
       - composer validate
       - composer install --no-dev --optimize-autoloader
-    when:
-      repo: friendica/friendica
-      branch: stable
-      event: tag
     volumes:
       - /etc/hosts:/etc/hosts
   create_artifacts:
@@ -72,10 +66,6 @@ steps:
       - ls -lh
       - cat "$ARTIFACT.sum256"
       - sha256sum "$ARTIFACT"
-    when:
-      repo: friendica/friendica
-      branch: stable
-      event: tag
   sign_artifacts:
     image: plugins/gpgsign
     settings:
@@ -98,7 +88,3 @@ steps:
       - cp -fr build/* /tmp/friendica_files/
     volumes:
       - files:/tmp/friendica_files
-    when:
-      repo: friendica/friendica
-      branch: stable
-      event: tag