Updated .gitlab-ci.yml and moved the old CI to an old file
This commit is contained in:
parent
60365861ab
commit
6567f5900a
2 changed files with 119 additions and 62 deletions
109
.gitlab-ci.yml
109
.gitlab-ci.yml
|
@ -1,72 +1,57 @@
|
||||||
|
stages:
|
||||||
|
- setup
|
||||||
|
- install
|
||||||
|
- build
|
||||||
|
- publish
|
||||||
|
|
||||||
|
# Prepare the environment
|
||||||
|
setup:
|
||||||
|
stage: setup
|
||||||
|
image: php:8.2
|
||||||
|
script:
|
||||||
|
- apt-get update -y
|
||||||
|
- apt-get install -y libmbstring-dev libzip-dev wget gnupg curl
|
||||||
|
- docker-php-ext-install mbstring ctype tokenizer posix
|
||||||
|
|
||||||
|
# Install Phive and Phpab
|
||||||
|
install:
|
||||||
|
stage: install
|
||||||
|
script:
|
||||||
|
- wget -O phive.phar https://phar.io/releases/phive.phar
|
||||||
|
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
||||||
|
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
||||||
|
- gpg --verify phive.phar.asc phive.phar
|
||||||
|
- chmod +x phive.phar
|
||||||
|
- mv phive.phar /usr/local/bin/phive
|
||||||
|
- phive install phpab --global
|
||||||
|
|
||||||
|
# Build the project using the Makefile
|
||||||
build:
|
build:
|
||||||
image: php:8.1
|
stage: build
|
||||||
|
|
||||||
before_script:
|
|
||||||
# Install some stuff that the image doesn't come with
|
|
||||||
- apt update -yqq
|
|
||||||
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
|
||||||
|
|
||||||
# Install phive
|
|
||||||
- wget -O phive.phar https://phar.io/releases/phive.phar
|
|
||||||
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
|
||||||
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
|
||||||
- gpg --verify phive.phar.asc phive.phar
|
|
||||||
- chmod +x phive.phar
|
|
||||||
- mv phive.phar /usr/local/bin/phive
|
|
||||||
|
|
||||||
# install phpab
|
|
||||||
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
|
||||||
script:
|
|
||||||
- make tar
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH
|
|
||||||
|
|
||||||
release:
|
|
||||||
image: php:8.1
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
# Install some stuff that the image doesn't come with
|
|
||||||
- apt update -yqq
|
|
||||||
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
|
||||||
|
|
||||||
# Install phive
|
|
||||||
- wget -O phive.phar https://phar.io/releases/phive.phar
|
|
||||||
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
|
||||||
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
|
||||||
- gpg --verify phive.phar.asc phive.phar
|
|
||||||
- chmod +x phive.phar
|
|
||||||
- mv phive.phar /usr/local/bin/phive
|
|
||||||
|
|
||||||
# install phpab
|
|
||||||
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
|
||||||
script:
|
script:
|
||||||
|
- make autoload
|
||||||
- make redist
|
- make redist
|
||||||
- mkdir ncc_$CI_COMMIT_TAG
|
- make tar
|
||||||
- cp -r build/src/* ncc_$CI_COMMIT_TAG/
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- ncc_$CI_COMMIT_TAG/
|
- build/*.tar.gz
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
||||||
|
|
||||||
ncc-docker-build:
|
# Publish the package
|
||||||
image: docker:latest
|
publish:
|
||||||
services:
|
stage: publish
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
if [[ "$CI_COMMIT_REF_NAME" == "master" || "$CI_COMMIT_REF_NAME" == "dev" ]]; then
|
||||||
tag=""
|
PACKAGE_NAME=$CI_COMMIT_REF_NAME
|
||||||
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
|
||||||
|
PACKAGE_NAME=$CI_COMMIT_TAG
|
||||||
else
|
else
|
||||||
tag=":$CI_COMMIT_REF_SLUG"
|
PACKAGE_NAME=feature/$CI_COMMIT_REF_NAME
|
||||||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
|
||||||
fi
|
fi
|
||||||
- docker build --no-cache --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
|
||||||
- docker push "$CI_REGISTRY_IMAGE${tag}"
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" \
|
||||||
rules:
|
--upload-file build/*.tar.gz \
|
||||||
- if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_BRANCH == 'dev'
|
"https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/packages/generic/$PACKAGE_NAME/$CI_PIPELINE_ID/file.tar.gz"
|
||||||
exists:
|
only:
|
||||||
- Dockerfile
|
- branches
|
||||||
|
- tags
|
72
.gitlab-ci.yml.old
Normal file
72
.gitlab-ci.yml.old
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
build:
|
||||||
|
image: php:8.1
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
# Install some stuff that the image doesn't come with
|
||||||
|
- apt update -yqq
|
||||||
|
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
||||||
|
|
||||||
|
# Install phive
|
||||||
|
- wget -O phive.phar https://phar.io/releases/phive.phar
|
||||||
|
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
||||||
|
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
||||||
|
- gpg --verify phive.phar.asc phive.phar
|
||||||
|
- chmod +x phive.phar
|
||||||
|
- mv phive.phar /usr/local/bin/phive
|
||||||
|
|
||||||
|
# install phpab
|
||||||
|
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
||||||
|
script:
|
||||||
|
- make tar
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
|
||||||
|
release:
|
||||||
|
image: php:8.1
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
# Install some stuff that the image doesn't come with
|
||||||
|
- apt update -yqq
|
||||||
|
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
||||||
|
|
||||||
|
# Install phive
|
||||||
|
- wget -O phive.phar https://phar.io/releases/phive.phar
|
||||||
|
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
||||||
|
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
||||||
|
- gpg --verify phive.phar.asc phive.phar
|
||||||
|
- chmod +x phive.phar
|
||||||
|
- mv phive.phar /usr/local/bin/phive
|
||||||
|
|
||||||
|
# install phpab
|
||||||
|
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
||||||
|
script:
|
||||||
|
- make redist
|
||||||
|
- mkdir ncc_$CI_COMMIT_TAG
|
||||||
|
- cp -r build/src/* ncc_$CI_COMMIT_TAG/
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- ncc_$CI_COMMIT_TAG/
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
|
||||||
|
ncc-docker-build:
|
||||||
|
image: docker:latest
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
before_script:
|
||||||
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
||||||
|
tag=""
|
||||||
|
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
||||||
|
else
|
||||||
|
tag=":$CI_COMMIT_REF_SLUG"
|
||||||
|
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
||||||
|
fi
|
||||||
|
- docker build --no-cache --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
||||||
|
- docker push "$CI_REGISTRY_IMAGE${tag}"
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_BRANCH == 'dev'
|
||||||
|
exists:
|
||||||
|
- Dockerfile
|
Loading…
Add table
Reference in a new issue