variables: CI_REGISTRY: 102167438644.dkr.ecr.us-east-1.amazonaws.com CI_REGISTRY_USER: "" CI_REGISTRY_IMAGE: 102167438644.dkr.ecr.us-east-1.amazonaws.com/code-coverage-helpers DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "" AWS_DEFAULT_REGION: us-east-1 WORDPRESS_DB_HOST: mysql WORDPRESS_DB_USER: 'root' WORDPRESS_DB_PASSWORD: 'test' MYSQL_ROOT_PASSWORD: 'test' MYSQL_ROOT_HOST: mysql MYSQL_USER: 'root' WIREMOCK_HOST: 'wiremock' WIREMOCK_PORT: '8080' MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' DB_PORT: '3306' DB_HOST: mysql DB_HOST_READER: mysql DB_USERNAME: root DB_PASSWORD: 'test' WC_RELEASE_VERSION: '2.0.2' WP_SVN_PASS: $WP_SVN_PASS stages: - .pre - build - test - staging - production - deploy - .post include: - template: Jobs/Build.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/ci/templates/Jobs/Build.gitlab-ci.yml - project: 'security/gitlab-templates' file: 'snyk-scanning.yml' .deploy_helpers: &deploy_helpers | function setup_docker() { if ! docker info; then if [[ -z "$DOCKER_HOST" ]] && [[ -n "$KUBERNETES_PORT" ]]; then export DOCKER_HOST='tcp://localhost:2375' fi fi } aws_install() { if ! hash aws 2>/dev/null then apk -v --update add \ python3 \ py3-pip \ && \ pip install --upgrade awscli fi } before_script: - *deploy_helpers .composer_vendorize_and_install: &composer_vendorize_and_install before_script: - ./bin/vendorize build: stage: build image: 102167438644.dkr.ecr.us-east-1.amazonaws.com/devops/auto-devops-deploy:latest script: - aws_install - aws ecr describe-repositories --repository-names $CI_PROJECT_NAME 2>&1 > /dev/null || aws ecr create-repository --repository-name $CI_PROJECT_NAME > /dev/null - eval $(aws ecr get-login --no-include-email --region "${AWS_DEFAULT_REGION}") - setup_docker - | export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE} if [[ -z "$CI_COMMIT_TAG" ]]; then export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_SHA} else export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG} fi build_package: stage: build image: $CI_REGISTRY_IMAGE:latest script: - echo "Creating build package" artifacts: expire_in: 1 hour paths: - ./ image: $CI_REGISTRY_IMAGE:latest test:lint: stage: test dependencies: - build_package <<: *composer_vendorize_and_install script: - composer run lint #test:PHPUnit: # stage: test # dependencies: # - build_package # allow_failure: true # <<: *composer_vendorize_and_install # services: # - mysql:5.6 # - name: rodolpheche/wiremock # alias: wiremock # variables: # MYSQL_DATABASE: PHPUnitTests # DB_DATABASE: PHPUnitTests # script: # - ./bin/install_wp_tests PHPUnitTests root test mysql:3306 && ./vendor/bin/phpunit --configuration phpunit.ci.xml --coverage-html=coverage # artifacts: # paths: # - coverage/* # reports: # junit: phpunit.ci.xml test:Karma: stage: test <<: *composer_vendorize_and_install dependencies: - build_package script: - echo "Run Karma CI" - npm install - npm run ci test:Qunit: stage: test <<: *composer_vendorize_and_install dependencies: - build_package script: - echo "Run Qunit test" - npm install - npm run qunit zip_for_testing: stage: staging dependencies: - build_package script: - DEPLOY=1 ./bin/vendorize && npm install && npm rebuild node-sass && npm run build && ./bin/create_build artifacts: paths: - activecampaign-for-woocommerce.zip expire_in: 1 day send_to_wordpress: stage: deploy when: manual # Run this job manually in the pipeline dependencies: - build_package rules: - if: $CI_COMMIT_TAG # Run this job only when a tag is created script: - echo "Running release_job for $TAG" - echo "Creating Version $WC_RELEASE_VERSION" - DEPLOY=1 ./bin/vendorize && npm install && npm rebuild node-sass && npm run build && ./bin/create_build - WC_RELEASE_VERSION=$WC_RELEASE_VERSION && WP_SVN_PASS=$WP_SVN_PASS ./bin/prep_svn_files artifacts: paths: - ./svn make_gitlab_release: stage: deploy image: registry.gitlab.com/gitlab-org/release-cli:latest rules: - if: $CI_COMMIT_TAG # Run this job only when a tag is created needs: - job: zip_for_testing artifacts: true script: - echo "Creating Version $WC_RELEASE_VERSION" artifacts: paths: - activecampaign-for-woocommerce.zip expire_in: never release: name: 'Version $CI_COMMIT_TAG' tag_name: '$CI_COMMIT_TAG' description: './CHANGELOG.md' ref: '$CI_COMMIT_SHA' assets: links: - name: 'activecampaign-for-woocommerce.zip' url: 'https://gitlab.devops.app-us1.com/team-ecommerce/activecampaign-for-woocommerce/-/jobs/$CI_JOB_ID/artifacts/download' # #release_to_wordpress: # stage: .post # image: registry.gitlab.com/gitlab-org/release-cli:latest # when: manual # rules: # - if: $CI_COMMIT_TAG # Run this job only when a tag is created # needs: # - job: prep_release # artifacts: true # script: # - pwd # - ls -la # - cd svn/activecampaign-for-woocommerce/trunk # - apk add subversion # - ls -la # - svn status