使用 Gulp 构建后从 Gitlab [=10th=] 工件创建特定文件夹
Create specifc folder from Gitlab CI artifacts after building with Gulp
几周前我在这里得到了一些 gitlab ci 的帮助,因为我以前从未使用过它。我已经取得了不错的成绩,现在在我的最后一节中,将 Gulp 的输出包含在工件 zip 中。
所以目前我的构建 .yml 文件如下所示:
cache:
paths:
- vendor/
- node_modules/
before_script:
# Install git (the php image doesn't have it) which is required by composer
- apt-get update -yqq
- apt-get install git unzip -yqq
- apt-get install php-pear -yqq
# Install composer
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
# Setup PHPCompatibility for php_codesniffer
- mkdir --parents vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility
- cp -R vendor/wimg/php-compatibility/* vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility
stages:
- compatibility_test
- coding_standards
- gulp_build
- gulp_package
# Compatibility Test
PHP 5.2 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.2 src/ --report-full --report-summary --extensions=php
PHP 5.3 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.3 src/ --report-full --report-summary --extensions=php
PHP 5.4 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.4 src/ --report-full --report-summary --extensions=php
PHP 5.5 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.5 src/ --report-full --report-summary --extensions=php
PHP 5.6 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.6 src/ --report-full --report-summary --extensions=php
PHP 7.0 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 7.0 src/ --report-full --report-summary --extensions=php
PHP 7.1 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 7.1 src/ --report-full --report-summary --extensions=php
# # Coding Standards Test
PHP Coding Standards:
image: php:5.6
stage: Coding Standards
script:
- vendor/bin/phpcs -s --standard=ruleset.xml src/ --report-full --report-summary --extensions=php
JS Coding Standards:
image: php:5.6
stage: Coding Standards
script:
- vendor/bin/phpcs -s --standard=ruleset.xml src/js/ --report-full --report-summary --extensions=js
CSS Coding Standards:
image: php:5.6
stage: Coding Standards
script:
- vendor/bin/phpcs -s --standard=ruleset.xml src/css/ --report-full --report-summary --extensions=css
# Gulp Build
Gulp:
image: node:latest
stage: gulp_build
script:
- npm install -g gulp
- npm install
- gulp build
- gulp zip
artifacts:
name: "my-build"
expire_in: 1 week
paths:
- "dist/*"
如您所见,它有点像野兽,但它确实有效。最后一部分我有 Gulp:
# Gulp Build
Gulp:
image: node:latest
stage: gulp_build
script:
- npm install -g gulp
- npm install
- gulp build
- gulp zip
artifacts:
name: "my-build"
expire_in: 1 week
paths:
- "dist/*"
当前生成工件文件时,其名称显示为 my-build.zip,这很完美。但是直接位于其中的文件夹是 dist。有没有办法将 dist 文件夹更改为 my-build?
干杯,
斯图
在 Gitlab Reddit 的帮助下,我设法解决了我的问题。这就是我所做的:
Gulp:
only:
- master
- merge-requests
image: node:latest
stage: gulp_build
script:
- npm install -g gulp
- npm install
- gulp build
- mv -T dist my-build
- gulp build --premium
- mv -T dist my-build-premium
artifacts:
name: "my-build"
expire_in: 1 week
paths:
- my-build/
- my-build-premium/
因为它是一个实例,所以我将文件夹重命名为我想要的名称,然后将其添加到工件中。我现在也可以在 Master 和合并请求上只使用 Gulp 来进行高级构建 :)
几周前我在这里得到了一些 gitlab ci 的帮助,因为我以前从未使用过它。我已经取得了不错的成绩,现在在我的最后一节中,将 Gulp 的输出包含在工件 zip 中。
所以目前我的构建 .yml 文件如下所示:
cache:
paths:
- vendor/
- node_modules/
before_script:
# Install git (the php image doesn't have it) which is required by composer
- apt-get update -yqq
- apt-get install git unzip -yqq
- apt-get install php-pear -yqq
# Install composer
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
# Setup PHPCompatibility for php_codesniffer
- mkdir --parents vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility
- cp -R vendor/wimg/php-compatibility/* vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PHPCompatibility
stages:
- compatibility_test
- coding_standards
- gulp_build
- gulp_package
# Compatibility Test
PHP 5.2 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.2 src/ --report-full --report-summary --extensions=php
PHP 5.3 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.3 src/ --report-full --report-summary --extensions=php
PHP 5.4 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.4 src/ --report-full --report-summary --extensions=php
PHP 5.5 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.5 src/ --report-full --report-summary --extensions=php
PHP 5.6 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 5.6 src/ --report-full --report-summary --extensions=php
PHP 7.0 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 7.0 src/ --report-full --report-summary --extensions=php
PHP 7.1 Compatibility Test:
image: php:5.6
stage: compatibility_test
script:
- vendor/bin/phpcs -d date.timezone=GMT --standard=PHPCompatibility --runtime-set testVersion 7.1 src/ --report-full --report-summary --extensions=php
# # Coding Standards Test
PHP Coding Standards:
image: php:5.6
stage: Coding Standards
script:
- vendor/bin/phpcs -s --standard=ruleset.xml src/ --report-full --report-summary --extensions=php
JS Coding Standards:
image: php:5.6
stage: Coding Standards
script:
- vendor/bin/phpcs -s --standard=ruleset.xml src/js/ --report-full --report-summary --extensions=js
CSS Coding Standards:
image: php:5.6
stage: Coding Standards
script:
- vendor/bin/phpcs -s --standard=ruleset.xml src/css/ --report-full --report-summary --extensions=css
# Gulp Build
Gulp:
image: node:latest
stage: gulp_build
script:
- npm install -g gulp
- npm install
- gulp build
- gulp zip
artifacts:
name: "my-build"
expire_in: 1 week
paths:
- "dist/*"
如您所见,它有点像野兽,但它确实有效。最后一部分我有 Gulp:
# Gulp Build
Gulp:
image: node:latest
stage: gulp_build
script:
- npm install -g gulp
- npm install
- gulp build
- gulp zip
artifacts:
name: "my-build"
expire_in: 1 week
paths:
- "dist/*"
当前生成工件文件时,其名称显示为 my-build.zip,这很完美。但是直接位于其中的文件夹是 dist。有没有办法将 dist 文件夹更改为 my-build?
干杯,
斯图
在 Gitlab Reddit 的帮助下,我设法解决了我的问题。这就是我所做的:
Gulp:
only:
- master
- merge-requests
image: node:latest
stage: gulp_build
script:
- npm install -g gulp
- npm install
- gulp build
- mv -T dist my-build
- gulp build --premium
- mv -T dist my-build-premium
artifacts:
name: "my-build"
expire_in: 1 week
paths:
- my-build/
- my-build-premium/
因为它是一个实例,所以我将文件夹重命名为我想要的名称,然后将其添加到工件中。我现在也可以在 Master 和合并请求上只使用 Gulp 来进行高级构建 :)