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

Tests, CI, PDS #1

Merged
merged 13 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]: "
labels: 'bug, status: unverified'
assignees: ''
---

Questions? Discussions: https://phalcon.io/discussions or Discord: https://phalcon.io/discord

## Describe the bug

A clear and concise description of what the bug is.

## To Reproduce

Steps to reproduce the behavior:

```php
// paste output here
```

> Provide minimal script to reproduce the issue

```php
// paste output here
```

## Expected behavior

A clear and concise description of what you expected to happen.

```php
// paste code
```

## Screenshots

If applicable, add screenshots to help explain your problem.

## Details

- Phalcon version
- PHP Version: (`php -v`)
- Operating System:
- Server: Nginx | Apache | Other
- Other related info (Database, table schema):

## Additional context

Add any other context about the problem here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[NFR]: "
labels: new feature request
assignees: ''
---

## Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Example: _I am always frustrated when..._

## Describe the solution you would like

A clear and concise description of what you want to happen.

## Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

## Additional context

Add any other context or screenshots about the feature request here.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
16 changes: 16 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Hello!

* Type: bug fix | new feature | code quality | documentation
* Link to issue:

**In raising this pull request, I confirm the following:**

- [ ] I have read and understood the [Contributing Guidelines](https://github.com/phalcon/phalcon/blob/master/CONTRIBUTING.md)
- [ ] I have checked that another pull request for this purpose does not exist
- [ ] I wrote some tests for this PR
- [ ] I have updated the relevant CHANGELOG
- [ ] I have created a PR for the [documentation](https://github.com/phalcon/docs) about this change

Small description of change:

Thanks
57 changes: 57 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 90

# Number of days of inactivity before a stale Issue or Pull Request is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 1

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- "status: high"
- "status: medium"
- "status: low"
- "bug"
- "wip"
- Locked
- "new feature request"
- "enhancement"

# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false

# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true

# Label to use when marking as stale
staleLabel: stale

# Comment to post when marking as stale. Set to `false` to disable
markComment: >
Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalcon.io/post/github-closing-old-issues
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.

# Comment to post when closing a stale Issue or Pull Request.
#closeComment: >
# Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalcon.io/post/github-closing-old-issues

# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30

# Limit to only `issues` or `pulls`
only: issues

# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions!

# issues:
# exemptLabels:
# - confirmed
223 changes: 223 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
# This file is part of Phalcon.
#
# (c) Phalcon Team <team@phalcon.io>
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.

name: "Phalcon Volt CI"

on:
schedule:
- cron: '0 2 * * *' # Daily at 02:00 runs only on default branch
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
workflow_dispatch:

env:
fail-fast: true

# All versions should be declared here
PHALCON_VERSION: 6.0.0
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

# For tests
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
LC_ALL: en_US.UTF-8

# Windows specific
TOOLS_DIR: 'C:\tools'

# PHP extensions required by Composer
EXTENSIONS: mbstring

permissions: { }
jobs:

# PHP CodeSniffer inspection
phpcs:
name: "Validate Tests code style"
if: "!contains(github.event.head_commit.message, 'ci skip')"

permissions:
contents: read

runs-on: ubuntu-20.04

strategy:
fail-fast: true
matrix:
php:
- '8.1'
steps:
- uses: actions/checkout@v4

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
ini-values: apc.enable_cli=on, session.save_path=/tmp
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PHALCON_PATH: ext

- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v2"
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 }}-${{ matrix.ts }}-${{ matrix.name }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
php:
- '8.1'
ts:
- 'ts'
name:
- ubuntu-gcc
include:
# Linux
- { name: ubuntu-gcc, os: ubuntu-20.04, compiler: gcc }

steps:
- uses: actions/checkout@v4
- name: "Setup platform specific environment"
shell: pwsh
run: |
git config --global core.autocrlf false
$SessionSavePath = if ("${{ runner.os }}" -eq "Windows") { 'C:\temp' } else { '/tmp' }
Write-Output "SESSION_SAVE_PATH=$SessionSavePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
tools: pecl, composer:v2
coverage: xdebug
env:
PHPTS: ${{ matrix.ts }}
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Validate composer"
run: composer validate --no-check-all --no-check-publish

- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist"

- name: "Run Unit Tests"
if: always()
run: |
composer test-coverage

- name: "Upload coverage file artifact"
uses: "actions/upload-artifact@v4"
with:
name: "unit-${{ matrix.php }}.coverage"
path: "tests/support/coverage.xml"

qodana-analysis:
permissions:
contents: read

name: "Qodana Analysis"
runs-on: "ubuntu-22.04"
needs:
- "unit-tests"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
fetch-depth: 0 # a full history is required for pull request analysis

- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2023.2
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
args: --baseline,qodana.sarif.json

upload-coverage:
permissions:
contents: read

name: "Upload coverage"
runs-on: "ubuntu-22.04"
needs:
- "unit-tests"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

- name: "Display structure of downloaded files"
run: |
mkdir -p reports

- name: "Download coverage files"
uses: "actions/download-artifact@v4"
with:
path: "reports"

- name: "Display structure of downloaded files"
run: ls -R
working-directory: reports

# - name: "Upload to Codacy"
# run: |
# bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
# -l php $(find ./reports/ -name '*.xml' | sed 's,^, -r ,' | xargs echo)

# - name: "Upload to Codacy"
# uses: codacy/codacy-coverage-reporter-action@v1.3.0
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# # or
# # api-token: ${{ secrets.CODACY_API_TOKEN }}
# coverage-reports: reports
# # or a comma-separated list for multiple reports
# # coverage-reports: <PATH_TO_REPORT>, <PATH_TO_REPORT>

# - name: "Upload to Codecov"
# uses: "codecov/codecov-action@v3"
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: reports
# fail_ci_if_error: true
# verbose: true
#
- name: "Upload to Qodana"
run: |
docker run \
-v $(pwd):/data/project/ \
-v ./reports/:/data/coverage \
-e QODANA_TOKEN="${{ secrets.QODANA_TOKEN }}" \
jetbrains/qodana-php
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ composer.phar
/vendor/
/lemon-php/
log.txt
tests/support/output/
Empty file added CHANGELOG.md
Empty file.
Empty file added CONTRIBUTING.md
Empty file.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Volt: Template Engine

This repository consists of the Volt parser, for the Volt Template Engine used by the Phalcon Framework.
Loading