Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ include:

variables:
SAST_EXCLUDED_PATHS: "vendor/,build/,tests/"
XDEBUG_MODE: coverage

stages:
- verify
- test
- security

Expand All @@ -21,26 +21,26 @@ cache:
- apt-get update -yqq
- apt-get install -yqq git unzip libzip-dev
- docker-php-ext-install zip
- pecl install xdebug && docker-php-ext-enable xdebug
- pecl install pcov && docker-php-ext-enable pcov
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install --prefer-dist --no-progress --no-interaction

# Verify all commits are GPG-signed (via GitLab API)
verify-signatures:
stage: test
image: alpine:latest
stage: verify
image: alpine:3
before_script:
- apk add --no-cache curl jq git
- apk add --no-cache curl jq
script:
- |
echo "Checking commits via GitLab API..."

BASE_SHA=$(git merge-base origin/master HEAD 2>/dev/null || echo "")
if [ -z "$BASE_SHA" ]; then
echo "No common ancestor with master, checking only HEAD commit"
COMMITS=$(git rev-parse HEAD)
if [ -n "$CI_MERGE_REQUEST_IID" ]; then
echo "Checking MR commits via GitLab API..."
COMMITS=$(curl -s --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}/commits" \
| jq -r '.[].id')
else
COMMITS=$(git log --format=%H ${BASE_SHA}..HEAD)
echo "Checking HEAD commit via GitLab API..."
COMMITS=$(git rev-parse HEAD)
fi

UNSIGNED_COUNT=0
Expand Down Expand Up @@ -68,9 +68,9 @@ verify-signatures:

echo ""
echo "All commits are verified!"
only:
- merge_requests
- master
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH'

security:
<<: *php-setup
Expand Down
Loading