-
-
Couldn't load subscription status.
- Fork 1
T9 docker compose #10
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
456fe5f
adding changelog and contributing docs
niden 9b92b57
adding initial folder structure as per pds/skeleton
niden 9ecc81a
added docker compose and dockerfiles
niden f980aa0
added sonar properties to the run; removed config
niden 6d73393
trying a different projectBaseDir for sonar
niden 096277e
correcting sonar task
niden 2d36c20
trying a different base dir
niden 3405c26
debugging the folder structure
niden e444303
added .env for ci
niden ef3b1b6
added .env to gitignore
niden 3dee1f9
adjustments to the ci run
niden b715be3
disable phpstan in ci; add new folders
niden 300e5c0
adding composer.json
niden c641e47
added migrations
niden 938ecd6
correcting run
niden 6909ec7
Update resources/docker/config/nginx/nginx.conf
niden b50d153
Update resources/docker/config/nginx/nginx.conf
niden 2b4e609
Update CONTRIBUTING.md
niden fe1c921
removing duplicate entry for bash
niden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,142 @@ | ||
|
|
||
| # This file is part of Phalcon. | ||
| # | ||
| # (c) Phalcon Team <[email protected]> | ||
| # | ||
| # For the full copyright and license information, please view | ||
| # the LICENSE file that was distributed with this source code. | ||
|
|
||
| name: REST API v6 CI | ||
| on: | ||
| push: | ||
| paths-ignore: | ||
| - '**.md' | ||
| - '**.txt' | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| fail-fast: true | ||
|
|
||
| # PHP extensions required by Composer | ||
| EXTENSIONS: json, mbstring, pdo, pdo_mysql | ||
|
|
||
| permissions: { } | ||
| jobs: | ||
| sonarqube: | ||
| name: SonarQube | ||
| runs-on: ubuntu-latest | ||
|
|
||
| # PHP CodeSniffer inspection | ||
| phpcs: | ||
| name: "Quality gate" | ||
| if: "!contains(github.event.head_commit.message, 'ci skip')" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| runs-on: ubuntu-22.04 | ||
|
|
||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| php: | ||
| - '8.2' | ||
| - '8.3' | ||
| - '8.4' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: "Setup PHP" | ||
| uses: shivammathur/[email protected] | ||
| with: | ||
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
| - name: SonarQube Scan | ||
| php-version: ${{ matrix.php }} | ||
| extensions: ${{ env.EXTENSIONS }} | ||
| tools: pecl | ||
| env: | ||
| COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: "Install development dependencies with Composer" | ||
| uses: "ramsey/composer-install@v3" | ||
| with: | ||
| composer-options: "--prefer-dist" | ||
|
|
||
| - name: "PHPCS" | ||
| run: | | ||
| composer cs | ||
|
|
||
| # - name: "PHPStan" | ||
| # run: | | ||
| # composer analyze | ||
|
|
||
| unit-tests: | ||
| needs: phpcs | ||
|
|
||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
|
|
||
| name: Unit tests / PHP-${{ matrix.php }} | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| strategy: | ||
| matrix: | ||
| php: | ||
| - '8.2' | ||
| - '8.3' | ||
| - '8.4' | ||
|
|
||
| services: | ||
| mariadb: | ||
| image: mariadb:10.6 | ||
| ports: | ||
| - "3306:3306" | ||
| env: | ||
| MYSQL_ROOT_PASSWORD: secret | ||
| MYSQL_USER: phalcon | ||
| MYSQL_DATABASE: phalcon | ||
| MYSQL_PASSWORD: secret | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: "Setup PHP" | ||
| uses: shivammathur/[email protected] | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| extensions: ${{ env.EXTENSIONS }} | ||
| tools: pecl | ||
| env: | ||
| COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: "Install development dependencies with Composer" | ||
| uses: "ramsey/composer-install@v3" | ||
| with: | ||
| composer-options: "--prefer-dist" | ||
|
|
||
| - name: "Setup Tests" | ||
| shell: bash | ||
| run: | | ||
| cp config/.env.ci .env | ||
|
|
||
| - name: "Run Unit Tests" | ||
| if: always() | ||
| run: | | ||
| composer test-unit | ||
|
|
||
| - name: "Run Migrations" | ||
| if: always() | ||
| run: | | ||
| composer migrate | ||
|
|
||
| - name: SonarCloud Scan | ||
| uses: SonarSource/sonarqube-scan-action@v5 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| with: | ||
| projectBaseDir: ./ | ||
| args: > | ||
| -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} | ||
| -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} | ||
| -Dsonar.sources=src/ | ||
| -Dsonar.exclusions=vendor/**,cv/**,tests/** | ||
| -Dsonar.sourceEncoding=UTF-8 | ||
| -Dsonar.language=php | ||
| -Dsonar.tests=tests/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| .bash_history | ||
| vendor | ||
| composer.lock | ||
| .env | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # 1.0.0 | ||
|
|
||
| Under development |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Contributing to Phalcon | ||
|
|
||
| Phalcon is an open source project and a volunteer effort. Phalcon welcomes contribution from everyone. Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. | ||
|
|
||
| Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. | ||
|
|
||
| ## Contributions | ||
|
|
||
| Contributions to Phalcon should be made in the form of GitHub pull requests. Each pull request will be reviewed by a core contributor (someone with permission to merge patches). Feedback can be provided and potentially changes requested or the pull request will be merged. All contributions should | ||
| follow this format, even those from core contributors. | ||
|
|
||
| ## Questions & Support | ||
|
|
||
| We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address all of them. Thus we only accept bug reports, new feature requests and pull requests in GitHub. Our great community and contributors are happy to help you though! Please use these community resources for obtaining help. | ||
|
|
||
| _Please use the [Documentation](https://phalcon.io/docs) before anything else. You can also use the search feature in our documents to find what you are looking for. If your question is still not answered, there are more options below._ | ||
|
|
||
| * Questions should go to [GitHub Discussions](https://phalcon.io/discussions) | ||
| * Come join the Phalcon [Discord](https://phalcon.io/discord) | ||
| * Our social network accounts are: | ||
| * [Telegram](https://phalcon.io/telegram) | ||
| * [Gab](https://phalcon.io/gab) | ||
| * [MeWe](https://phalcon.io/mewe) | ||
| * [Twitter](https://phalcon.io/t) | ||
| * [Facebook](https://phalcon.io/fb) | ||
| * If you still believe that what you found is a bug, please | ||
| [open an issue](https://github.com/phalcon/cphalcon/issues/new) | ||
|
|
||
| Please report bugs when you've exhausted all of the above options. | ||
|
|
||
| ## Bug Report Checklist | ||
|
|
||
| * Make sure you are using the latest released version of the composer packages. | ||
| * If you have found a bug it is important to add relevant reproducibility information to your issue to allow us to reproduce the bug and fix it quicker. Add a script, small program or repository providing the necessary code to make everyone reproduce the issue reported easily. | ||
| * Be sure that information such as OS, Phalcon version and PHP version are part of the bug report | ||
|
|
||
| ## Pull Request Checklist | ||
|
|
||
| * Don't submit your pull requests to the `master` branch. Branch from the required branch and, if needed, rebase to the proper branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes | ||
| * Don't put submodule updates in your pull request unless they are to landed commits | ||
| * Add tests relevant to the fixed bug or new feature. Test classes should follow the [PSR-12 coding style guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-coding-style-guide.md). | ||
|
|
||
| ## Requesting Features | ||
|
|
||
| If you have a change or new feature in mind, please fill out an NFR on GitHub. | ||
|
|
||
|
|
||
| Thanks! | ||
| Phalcon Team |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| PROJECT_NAME="rest" | ||
|
|
||
| # Mariadb | ||
| DB_HOST="127.0.0.1" | ||
| DB_PORT=3306 | ||
| DB_USER="root" | ||
| DB_PASS="secret" | ||
| DB_NAME="phalcon" | ||
| DB_CHARSET="utf8" | ||
|
|
||
| # Redis | ||
| DATA_REDIS_HOST="app-cache" | ||
| DATA_REDIS_PORT=6379 | ||
| DATA_REDIS_NAME="0" | ||
|
|
||
| XDEBUG_MODE=coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| PROJECT_NAME="rest" | ||
|
|
||
| # Mariadb | ||
| DB_HOST="app-db" | ||
| DB_PORT=3306 | ||
| DB_USER="root" | ||
| DB_PASS="secret" | ||
| DB_NAME="phalcon" | ||
| DB_CHARSET= "utf8" | ||
|
|
||
| # Redis | ||
| DATA_REDIS_HOST="app-cache" | ||
| DATA_REDIS_PORT=6379 | ||
| DATA_REDIS_NAME="0" | ||
|
|
||
| XDEBUG_MODE=coverage |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| services: | ||
|
|
||
| app-8.2: | ||
| build: | ||
| dockerfile: ./resources/docker/Dockerfile | ||
| args: | ||
| PHP_VERSION: 8.2 | ||
| hostname: rest-api-app-8.2 | ||
| container_name: "${PROJECT_NAME}-api-8.2" | ||
| tty: true | ||
| working_dir: /app | ||
| volumes: | ||
| - ./:/app | ||
| depends_on: | ||
| - app-db | ||
| - app-cache | ||
| networks: | ||
| - app-network | ||
| environment: | ||
| - APP_ENV=development | ||
| - APP_ENV_ADAPTER=dotenv | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost/fpm-ping"] | ||
| interval: 30s | ||
| timeout: 3s | ||
| retries: 3 | ||
| start_period: 5s | ||
|
|
||
| app-8.3: | ||
| build: | ||
| dockerfile: ./resources/docker/Dockerfile | ||
| args: | ||
| PHP_VERSION: 8.3 | ||
| hostname: rest-api-app-8.3 | ||
| container_name: "${PROJECT_NAME}-api-8.3" | ||
| tty: true | ||
| working_dir: /app | ||
| volumes: | ||
| - ./:/app | ||
| depends_on: | ||
| - app-db | ||
| - app-cache | ||
| networks: | ||
| - app-network | ||
| environment: | ||
| - APP_ENV=development | ||
| - APP_ENV_ADAPTER=dotenv | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost/fpm-ping"] | ||
| interval: 30s | ||
| timeout: 3s | ||
| retries: 3 | ||
| start_period: 5s | ||
|
|
||
| app-8.4: | ||
| build: | ||
| dockerfile: ./resources/docker/Dockerfile | ||
| args: | ||
| PHP_VERSION: 8.4 | ||
| hostname: rest-api-app-8.4 | ||
| container_name: "${PROJECT_NAME}-api-8.4" | ||
| tty: true | ||
| working_dir: /app | ||
| volumes: | ||
| - ./:/app | ||
| depends_on: | ||
| - app-db | ||
| - app-cache | ||
| networks: | ||
| - app-network | ||
| environment: | ||
| - APP_ENV=development | ||
| - APP_ENV_ADAPTER=dotenv | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost/fpm-ping"] | ||
| interval: 30s | ||
| timeout: 3s | ||
| retries: 3 | ||
| start_period: 5s | ||
|
|
||
| app-db: | ||
| container_name: "${PROJECT_NAME}-db" | ||
| image: mariadb:10.6 | ||
| environment: | ||
| - MYSQL_ROOT_PASSWORD=secret | ||
| - MYSQL_USER=phalcon | ||
| - MYSQL_DATABASE=phalcon | ||
| - MYSQL_PASSWORD=secret | ||
| networks: | ||
| - app-network | ||
|
|
||
| app-cache: | ||
| container_name: "${PROJECT_NAME}-cache" | ||
| image: redis:5-alpine | ||
| networks: | ||
| - app-network | ||
|
|
||
| networks: | ||
| app-network: | ||
| driver: bridge | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| use Dotenv\Dotenv; | ||
|
|
||
| require_once __DIR__ . '/vendor/autoload.php'; | ||
|
|
||
| // Load environment | ||
| $envs = array_merge(getenv(), $_ENV); | ||
|
|
||
| Dotenv::createImmutable(__DIR__)->load(); | ||
|
|
||
| $_ENV = array_merge($envs, $_ENV); | ||
|
|
||
| return [ | ||
| 'paths' => [ | ||
| 'migrations' => './resources/db/migrations', | ||
| 'seeds' => './resources/db/seeds', | ||
| ], | ||
| 'environments' => [ | ||
| 'default_migration_table' => "ut_migrations", | ||
| 'default_environment' => 'development', | ||
| 'development' => [ | ||
| 'adapter' => $_ENV['DB_ADAPTER'] ?? 'mysql', | ||
| 'host' => $_ENV['DB_HOST'] ?? '127.0.0.1', | ||
| 'name' => $_ENV['DB_NAME'] ?? 'phalcon', | ||
| 'user' => $_ENV['DB_USER'] ?? 'root', | ||
| 'pass' => $_ENV['DB_PASS'] ?? 'secret', | ||
| 'port' => $_ENV['DB_PORT'] ?? 3306, | ||
| 'charset' => $_ENV['DB_CHARSET'] ?? 'utf8', | ||
| ], | ||
| ], | ||
| 'version_order' => 'creation', | ||
| ]; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.