Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Castopod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
misuzu
Castopod
Commits
53a934c8
Unverified
Commit
53a934c8
authored
3 years ago
by
Yassine Doghri
Browse files
Options
Downloads
Patches
Plain Diff
ci: use image with already installed composer & npm + add commit msg and js lint stages
parent
88c52db5
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+35
-25
35 additions, 25 deletions
.gitlab-ci.yml
package.json
+1
-0
1 addition, 0 deletions
package.json
scripts/bundle-prepare.sh
+2
-3
2 additions, 3 deletions
scripts/bundle-prepare.sh
scripts/lint-commit.sh
+12
-0
12 additions, 0 deletions
scripts/lint-commit.sh
with
50 additions
and
28 deletions
.gitlab-ci.yml
+
35
−
25
View file @
53a934c8
image
:
php:8.0-fpm
image
:
thecodingmachine/php:8.0-v4-fpm-node14
stages
:
-
prepare
-
quality
-
bundle
-
release
...
...
@@ -10,32 +11,31 @@ cache:
-
vendor/
-
node_modules/
before_script
:
-
apt-get update -y
# Install git which is required by composer (the php image doesn't have it)
-
apt-get install git -y
-
apt-get install -y libicu-dev
# Install intl PHP extension for tests
-
docker-php-ext-install intl
# Install composer
-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
-
php composer-setup.php
-
php -r "unlink('composer-setup.php');"
php-dependencies
:
stage
:
prepare
script
:
# Install all php dependencies
-
php composer.phar install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
# Install latest npm
-
curl -sL https://deb.nodesource.com/setup_lts.x | bash -
-
apt-get update && apt-get install -y nodejs
-
npm install --global npm
js-dependencies
:
stage
:
prepare
script
:
# Install all npm dependencies
-
npm install
# Install all php dependencies
-
php composer.phar install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
lint-commit-msg
:
stage
:
quality
script
:
-
chmod +x ./scripts/lint-commit.sh
# lint commit message
-
./scripts/lint-commit.sh
tests
:
stage
:
quality
before_script
:
# Install required intl PHP extension for tests
-
apt-get install -y libicu-dev
-
docker-php-ext-install intl
script
:
# run phpunit without code coverage
# TODO: add code coverage
...
...
@@ -44,20 +44,30 @@ tests:
code-style
:
stage
:
quality
script
:
# check php code style
-
vendor/bin/ecs check --ansi
static-analysis
:
stage
:
quality
script
:
# increase memory limit to 1GB
because of
script failure
#
phpstan -
increase memory limit to 1GB
to prevent
script failure
-
php -d memory_limit=1G vendor/bin/phpstan analyse --ansi
code-review
:
stage
:
quality
script
:
# run rector to check for php errors
-
vendor/bin/rector process --dry-run --ansi
bundle_app
:
lint-js
:
stage
:
quality
script
:
-
npm run prettier
-
npm run typecheck
-
npm run eslint
-
npm run stylelint
bundle
:
stage
:
bundle
script
:
# make scripts/bundle.sh executable
...
...
@@ -76,7 +86,7 @@ bundle_app:
-
beta
-
alpha
release
_app
:
release
:
stage
:
release
script
:
# make release scripts executable
...
...
This diff is collapsed.
Click to expand it.
package.json
+
1
−
0
View file @
53a934c8
...
...
@@ -22,6 +22,7 @@
"lint"
:
"eslint --ext js,ts app/Views/_assets"
,
"lint:fix"
:
"eslint --ext js,ts app/Views/_assets --fix"
,
"lint:css"
:
"stylelint
\"
app/Views/_assets/**/*.css
\"
"
,
"prettier"
:
"prettier --check --ignore-path .gitignore ."
,
"prettier:fix"
:
"prettier --write --ignore-path .gitignore ."
,
"typecheck"
:
"tsc"
,
"commit"
:
"git-cz"
,
...
...
This diff is collapsed.
Click to expand it.
scripts/bundle-prepare.sh
+
2
−
3
View file @
53a934c8
#!/bin/bash
# install only
dev
dependencies using the --no-dev option
# install only
production
dependencies using the --no-dev option
php composer.phar
install
--no-dev
--prefer-dist
--no-ansi
--no-interaction
--no-progress
--ignore-platform-reqs
# install js dependencies and build all production UI assets
npm
install
# build all production UI assets
npm run build
This diff is collapsed.
Click to expand it.
scripts/lint-commit.sh
0 → 100755
+
12
−
0
View file @
53a934c8
#!/bin/bash
# see https://github.com/conventional-changelog/commitlint/issues/885
if
[
"
${
CI_COMMIT_BEFORE_SHA
}
"
=
"0000000000000000000000000000000000000000"
]
then
echo
"commitlint from HEAD^"
npx commitlint
--from
=
HEAD^
else
echo
"commitlint from
${
CI_COMMIT_BEFORE_SHA
}
"
npx commitlint
--from
=
"
${
CI_COMMIT_BEFORE_SHA
}
"
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment