Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ease local development, use PHP 7.4, various fixes #962

Merged
merged 59 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9ffcace
Initial commit
arogachev Jan 3, 2022
281da65
Move out vendor and node_modules from shared volume
arogachev Jan 4, 2022
e67fa7b
Bump yii2 and yii2-apidoc versions, reorder for readability
arogachev Jan 5, 2022
0ff7a9e
Expose elasticsearch port
arogachev Jan 5, 2022
20aa083
Add components.elasticsearch to dev config
arogachev Jan 5, 2022
14761a2
Update Dockerfile
arogachev Jan 5, 2022
3bfe298
Add texlive dependency, minor composer adjustments
arogachev Jan 5, 2022
dd51967
Remove commented code and defaults
arogachev Jan 10, 2022
e2f6e26
Fix broken gulp command
arogachev Jan 10, 2022
3b87e47
Freeze yii2-apidoc version, update PHP version, add "sort-packages"
arogachev Jan 10, 2022
184469d
Add nginx and git for generating api
arogachev Jan 10, 2022
8a33a85
Prevent collisions with other Composer installs
arogachev Jan 10, 2022
9b9c0d2
Fix errors for make api-v-2.0
arogachev Jan 10, 2022
8fbf4f2
Remove current composer.lock
arogachev Jan 10, 2022
48c1918
Add nginx-site.conf
arogachev Jan 10, 2022
03da587
Fix generating of Yii 1.1 API docs
arogachev Jan 11, 2022
84a6d57
Adapt make download for custom vendor dir, fix make api-1.0
arogachev Jan 12, 2022
ed8d5bd
Adjust README.md (WIP)
arogachev Jan 12, 2022
4fc916a
Update README.md. Docker now is the main option for local development.
arogachev Jan 12, 2022
a1f5bd3
Add generated Yii 1.0 API docs to version control
arogachev Jan 12, 2022
41f310b
Fix console-local.php
arogachev Jan 12, 2022
a7b1b32
Add JSON files for API 1.0
arogachev Jan 13, 2022
c5f14cf
Fix installation of pageres-cli
arogachev Jan 13, 2022
9307b4d
Fix dir and difference between 1.0 / 1.1
arogachev Jan 13, 2022
9b5b1b3
Move gettint types logic to writeJsonFiles1x
arogachev Jan 13, 2022
f3c5d4e
Use Docker for generating Yii 1.0 API docs as well
arogachev Jan 13, 2022
7161eb6
Better fix for duplicate "en"
arogachev Jan 13, 2022
cde2e01
Replace vendor dir in other places
arogachev Jan 13, 2022
1bed038
Bump yii2-apidoc version
arogachev Jan 14, 2022
59d1698
Add composer.lock
arogachev Jan 14, 2022
39c348b
Minor cleanup, I am active contributor now :)
arogachev Jan 14, 2022
aa7c6ec
Sync vendor and node_modules folder with host
arogachev Jan 14, 2022
3d32ec2
Restore init call, adapt it to work with shared volume
arogachev Jan 14, 2022
a065290
No need for gulp in initial setup
arogachev Jan 14, 2022
72e0267
Require PHP extensions in composer.json
arogachev Jan 14, 2022
4213d73
Restore siteAbsoluteUrl in README.md
arogachev Jan 14, 2022
08a954a
Use https for Github url
arogachev Jan 14, 2022
d98bb3e
Require ext-json in composer.json
arogachev Jan 14, 2022
cb8d487
Use exact version of Github API because of breaking changes
arogachev Jan 17, 2022
9a39f33
Update composer.lock
arogachev Jan 17, 2022
54e5a74
Bump yii2-apidoc version after release
arogachev Jan 17, 2022
7a17081
Merge branch 'master' into ease-local-development
arogachev Jan 18, 2022
99303ef
Reformat code in yml files [skip ci]
arogachev Jan 18, 2022
d158efb
Reformat code in codeception.yml [skip ci]
arogachev Jan 18, 2022
648889f
Adjust PHP and Node.js version
arogachev Jan 18, 2022
4646ad2
Remove yarn
arogachev Jan 18, 2022
8a6ca8c
(Temp) Check contents of "vendor/bower-asset" directory
arogachev Jan 18, 2022
0abb0dc
Get vendor dir form env variable in gulpfile.js
arogachev Jan 18, 2022
3a0a804
Remove Windows block, rsync composer.lock, check scrollup dir
arogachev Jan 18, 2022
fda3454
composer.lock / package-lock.json changes
arogachev Jan 18, 2022
0283d8f
Merge branch 'master' into ease-local-development
arogachev Jan 18, 2022
9038fe4
Strictly freeze "knplabs/github-api" version again
arogachev Jan 18, 2022
dedb2fc
Update composer.lock
arogachev Jan 19, 2022
773cff3
Make use of Redis in Docker environment
arogachev Jan 19, 2022
3931f7e
Merge branch 'master' into ease-local-development
arogachev Jan 19, 2022
08de495
Fix Redis for tests
arogachev Jan 19, 2022
2c4607e
Separate configs by YII_ENV "test"
arogachev Jan 19, 2022
3d641cb
Fix missing class key in config
arogachev Jan 19, 2022
29786ff
Switch to cache session
arogachev Jan 19, 2022
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
10 changes: 3 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
os:
- ubuntu-latest
php:
- "7.0"
- "7.4"
mariadb:
- "10.5"

Expand All @@ -40,7 +40,7 @@ jobs:
- name: Set up NodeJS
uses: actions/setup-node@v2
with:
node-version: '12'
node-version: '13'

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
Expand All @@ -54,10 +54,6 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Determine composer cache directory on Windows
if: matrix.os == 'windows-latest'
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Cache dependencies installed with composer
uses: actions/cache@v2
with:
Expand All @@ -77,7 +73,7 @@ jobs:
sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web-local.php

- name: Install node dependencies
run: npm install -g gulp-cli && npm install -g yarn && yarn install
run: npm install -g gulp-cli && npm install

- name: Compile assets
run: touch assets/src/scss/2-vendors/contributors.css && gulp build
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ phpunit.phar
/web/index.php
/web/.htaccess

# environment-dependent files (miscellaneous)
docker-compose.override.yml

# files automatically generated on dev platform
/web/css/*
/web/js/*
Expand Down
66 changes: 66 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# PHP

FROM php:7.4-fpm

# System packages

RUN apt-get update
RUN apt-get install -y texlive-full
RUN apt-get install -y python3-pygments
RUN apt-get install -y libnotify-bin
RUN apt-get install -y git
RUN apt-get install -y nginx
RUN apt-get install -y rsync

# PHP extensions
# https://github.com/mlocati/docker-php-extension-installer

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions gd intl pdo_mysql opcache zip

# Composer

COPY --from=composer:2.2.3 /usr/bin/composer /usr/local/bin/composer

# Node.js
# https://github.com/nvm-sh/nvm

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
SHELL ["/bin/bash", "--login", "-c"]
RUN command -v nvm
RUN nvm install 13.14.0

# Node.js global packages

RUN npm install -g gulp-cli --loglevel=verbose
RUN npm install -g pageres-cli --loglevel=verbose --unsafe-perm=true

# PHP configuration

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN sed -i 's,^memory_limit =.*$,memory_limit = -1,' "$PHP_INI_DIR/php.ini"

ENV VENDOR_DIR=/code/vendor

# Nginx configuration

COPY nginx-site.conf /etc/nginx/sites-enabled/default

# PHP packages

COPY composer.* /code/
WORKDIR /code
RUN composer config vendor-dir $VENDOR_DIR
RUN composer install
RUN composer config vendor-dir vendor

# Node.js packages

COPY package.json /code
WORKDIR /code
RUN npm install --loglevel=verbose

# Code

ADD . /code/src
WORKDIR /code/src
15 changes: 15 additions & 0 deletions Dockerfile.yii-1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# PHP

FROM php:7.0-cli

# System packages

RUN apt-get update
RUN apt-get install -y git

# Code

ADD . /code
WORKDIR /code

ENTRYPOINT ["rm", "-rf", "api-1.0"]
17 changes: 10 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ deploy:

docs: api guide download

api: api-1.0 api-1.1 api-2.0
api: api-1.1 api-2.0
./yii search/rebuild api

guide: guide-1.0 guide-1.1 guide-2.0
Expand All @@ -45,19 +45,21 @@ guide-%: yii-%
download-%: TARGET_DIR=data/docs-offline
download-%: SOURCE_DIR=data/yii-$(subst download-,,$@)
download-%: DOC_DIR=yii-docs-$(subst download-,,$@)
download-%: VENDOR_DIR=vendor
download-%: APIDOC_BIN=${VENDOR_DIR}/bin/apidoc
download-%: LANGUAGES=en $(shell find ${SOURCE_DIR}/docs/ | grep -ioP 'guide-[a-z-]+$$' | cut -c 7-)
download-%: yii-%
cd ${SOURCE_DIR}/docs && ln -sf guide guide-en
vendor/bin/apidoc api ${SOURCE_DIR}/framework,${SOURCE_DIR}/extensions ${TARGET_DIR}/${DOC_DIR} --interactive=0
for l in ${LANGUAGES} ; do \
${APIDOC_BIN} api ${SOURCE_DIR}/framework,${SOURCE_DIR}/extensions ${TARGET_DIR}/${DOC_DIR} --interactive=0
for l in $(shell echo "${LANGUAGES}" | xargs -n1 | sort -u | xargs) ; do \
echo "" ; \
echo "building guide and api package for language $$l..." ; \
test -d ${TARGET_DIR}/${DOC_DIR}-$$l && rm -rf ${TARGET_DIR}/${DOC_DIR}-$$l ; \
test -f ${TARGET_DIR}/${DOC_DIR}-$$l.tar.gz && rm ${TARGET_DIR}/${DOC_DIR}-$$l.tar.gz ; \
test -f ${TARGET_DIR}/${DOC_DIR}-$$l.tar.bz2 && rm ${TARGET_DIR}/${DOC_DIR}-$$l.tar.bz2 ; \
cp -ar ${TARGET_DIR}/${DOC_DIR} ${TARGET_DIR}/${DOC_DIR}-$$l ; \
vendor/bin/apidoc guide ${SOURCE_DIR}/docs/guide-$$l ${TARGET_DIR}/${DOC_DIR}-$$l --interactive=0 ; \
vendor/bin/apidoc api ${SOURCE_DIR}/framework,${SOURCE_DIR}/extensions ${TARGET_DIR}/${DOC_DIR}-$$l --interactive=0 ; \
${APIDOC_BIN} guide ${SOURCE_DIR}/docs/guide-$$l ${TARGET_DIR}/${DOC_DIR}-$$l --interactive=0 ; \
${APIDOC_BIN} api ${SOURCE_DIR}/framework,${SOURCE_DIR}/extensions ${TARGET_DIR}/${DOC_DIR}-$$l --interactive=0 ; \
rm -r ${TARGET_DIR}/${DOC_DIR}-$$l/cache ; \
cd ${TARGET_DIR} && tar czf ${DOC_DIR}-$$l.tar.gz ${DOC_DIR}-$$l ; cd - ; \
cd ${TARGET_DIR} && tar cjf ${DOC_DIR}-$$l.tar.bz2 ${DOC_DIR}-$$l ; cd - ; \
Expand All @@ -66,14 +68,15 @@ download-%: yii-%


# targets for cloning yii repos for building docs
yii-1.0:
yii-1.0: composer
test -d data/yii-1.0 || git clone https://github.com/yiisoft/yii.git data/yii-1.0
cd data/yii-1.0 && git checkout 1.0.12 && git checkout master build/
COMPOSER=composer.yii-1.0.json php data/composer.phar install

yii-1.1: composer
test -d data/yii-1.1 || git clone https://github.com/yiisoft/yii.git data/yii-1.1
cd data/yii-1.1 && git pull
cd data/yii-1.1 && (grep "phpunit/phpunit" composer.lock > /dev/null || php ../composer.phar require --dev --prefer-dist "phpunit/phpunit:~3.7" "phpunit/phpunit-selenium:~1.4.0")
cd data/yii-1.1 && php ../composer.phar require --dev --prefer-dist "phpunit/phpunit:4.8.34" "phpunit/phpunit-selenium:~1.4.0"

yii-2.0: yii-2.0-git yii-2.0-ext-apidoc yii-2.0-ext-authclient yii-2.0-ext-bootstrap yii-2.0-ext-debug yii-2.0-ext-elasticsearch yii-2.0-ext-faker yii-2.0-ext-gii yii-2.0-ext-httpclient yii-2.0-ext-imagine yii-2.0-ext-jui yii-2.0-ext-mongodb yii-2.0-ext-redis yii-2.0-ext-shell yii-2.0-ext-smarty yii-2.0-ext-sphinx yii-2.0-ext-swiftmailer yii-2.0-ext-twig

Expand Down
Loading