Skip to content

Fix master CI / GHAction CI / CodeCov / PHP 8 / Drop PHP 7.2 / Codacy #75

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 38 commits into from
Jun 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bd80b06
Refactor before fixing CI
yoanm Jun 18, 2022
3d132cd
Cleaning & fixes
yoanm Jun 18, 2022
3b05df2
Supported symfony versions
yoanm Jun 18, 2022
cabc99f
GHAction CI / PHP 8.1 / CodeCov / EditorConfig
yoanm Jun 18, 2022
cd45a96
Add nightly
yoanm Jun 18, 2022
1c69a71
Move composer-require-checker as GHAction
yoanm Jun 18, 2022
20a360d
Fix CI config
yoanm Jun 18, 2022
f11b204
Fix PHPUnit version
yoanm Jun 18, 2022
f53846b
Fix PHP 7.2 + composer-require-checker
yoanm Jun 19, 2022
3221d11
Improve
yoanm Jun 19, 2022
b4fef95
Improve README
yoanm Jun 19, 2022
f1f6435
Fix phpunit conf for v8
yoanm Jun 19, 2022
bb8691b
Merge unit and functional tests
yoanm Jun 19, 2022
9478f39
Fix
yoanm Jun 19, 2022
6329c36
Fix scrutinizer and codecov tags
yoanm Jun 19, 2022
bbdc038
Fix PHPUnit tests
yoanm Jun 19, 2022
bd4e06d
Drop PHP 7.2
yoanm Jun 19, 2022
99c9b6b
Fix composer requirements
yoanm Jun 19, 2022
d30f18f
Auto-detected clover file naming
yoanm Jun 19, 2022
1378a9e
Try specifing coverages files
yoanm Jun 19, 2022
16cddf3
Add codecov config
yoanm Jun 19, 2022
cf39b6d
Remove useless
yoanm Jun 19, 2022
b9af974
Improve / Remove useless
yoanm Jun 19, 2022
847cdf3
Add codacy
yoanm Jun 19, 2022
4858aec
Add Dependency Review action
yoanm Jun 19, 2022
00c81cd
Fix config
yoanm Jun 19, 2022
c606877
Send report to codacy
yoanm Jun 19, 2022
c81fe5e
Add behat coverage cache
yoanm Jun 19, 2022
531b636
Fix codacy install
yoanm Jun 19, 2022
f89d68a
Clean
yoanm Jun 19, 2022
c1db91f
Trigger CI with cache
yoanm Jun 19, 2022
1779048
Try to fix cache
yoanm Jun 19, 2022
facaa0e
trigger CI with cache
yoanm Jun 19, 2022
04f6923
Improve
yoanm Jun 19, 2022
8c09980
Improve
yoanm Jun 19, 2022
424295a
Split CI
yoanm Jun 19, 2022
ed875ea
Improve
yoanm Jun 19, 2022
1a179d5
Enable carryforward flags
yoanm Jun 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
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab
indent_size = 8

[{*.yml,*.yaml}]
indent_style = space
indent_size = 2
3 changes: 3 additions & 0 deletions .github/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.yml]
indent_style = space
indent_size = 2
10 changes: 5 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
51 changes: 51 additions & 0 deletions .github/workflows/CI-ComposerRequireChecker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'CI - ComposerRequireChecker'
on:
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
workflow_run:
workflows: ["CI"]
types:
- requested

concurrency:
group: "CI-${{ github.head_ref }}"
cancel-in-progress: true

env:
# Cache params
CACHE_VERSION: 2022061906 # To be able to create a new cache (YYYYMMDDXX)

jobs:
check:
name: ComposerRequireChecker
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- '8.1' # Latest supported
steps:
- uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: none
env:
# Always use latest available patch for the version
update: true

- name: Setup cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.composer
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ hashFiles('composer.json') }}

- name: Build
run: make build

- name: ComposerRequireChecker
uses: docker://webfactory/composer-require-checker:3.2.0
51 changes: 51 additions & 0 deletions .github/workflows/CI-DepsChecker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'CI - Dependencies check'
on:
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
workflow_run:
workflows: ["CI"]
types:
- requested

concurrency:
group: "CI-${{ github.head_ref }}"
cancel-in-progress: true

env:
# Cache params
CACHE_VERSION: 2022061906 # To be able to create a new cache (YYYYMMDDXX)

jobs:
check:
name: Dependencies check
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- '8.1' # Latest supported
steps:
- uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
coverage: none
env:
# Always use latest available patch for the version
update: true

- name: Setup cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.composer
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ hashFiles('composer.json') }}

- name: Build
run: make build

- name: Dependencies check
uses: actions/dependency-review-action@v1
77 changes: 77 additions & 0 deletions .github/workflows/CI-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: 'CI - Nightly'
on:
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
workflow_run:
workflows: ["CI"]
types:
- completed

concurrency:
group: "CI-${{ github.head_ref }}"
cancel-in-progress: true

env:
# Cache params
CACHE_VERSION: 2022061906 # To be able to create a new cache (YYYYMMDDXX)
TEST_OUTPUT_STYLE: pretty
COMPOSER_OPTIONS: --optimize-autoloader --ignore-platform-req=php+

jobs:
tests:
name: Nightly - Symfony ${{ matrix.symfony-version }}
needs: [ static-tests, tests ]
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
max-parallel: 4
# Perform tests against:
# - current php dev version with all supported symfony version
# - next Symfony minor version to manage with latest supported php version
matrix:
php-version:
- '8.2' # Current php dev version
symfony-version:
- '4.4' # Lowest LTS
- '5.4' # Latest LTS
include:
- symfony-version: '6.0' # Next symfony minor version to manage with latest supported PHP version
php-version: '8.1'

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php-version }}'
tools: composer
coverage: none
env:
# Always use latest available patch for the version
update: true

- name: Setup cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.composer
./vendor
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}

- name: Build
run: |
composer require -W ${{ env.COMPOSER_OPTIONS }} \
symfony/http-foundation:^${{ matrix.symfony-version }} \
symfony/http-kernel:^${{ matrix.symfony-version }} \
symfony/config:^${{ matrix.symfony-version }} \
symfony/dependency-injection:^${{ matrix.symfony-version }} \
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
symfony/routing:^${{ matrix.symfony-version }} \
&& make build

- name: Test
run: make test-unit && make test-functional
149 changes: 149 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: 'CI'
on: # Build any PRs and main branch changes
workflow_dispatch: # Allows to run the workflow manually from the Actions tab
pull_request:
types:
- opened
- edited
- synchronize
push:
branches: [ master ]
schedule:
- cron: '0 0 1 * *' # Every month

concurrency:
group: "CI-${{ github.head_ref }}"
cancel-in-progress: true

env:
# Cache params
CACHE_VERSION: 2022061905 # To be able to create a new cache (YYYYMMDDXX)
TEST_OUTPUT_STYLE: pretty
COMPOSER_OPTIONS: --optimize-autoloader
CODACY_CACHE_PATH: ~/.cache/codacy
CODACY_BIN: ~/.cache/codacy/codacy.sh

jobs:
tests:
name: UTs & FTs - Symfony ${{ matrix.symfony-version }}
runs-on: ubuntu-latest
env:
COVERAGE_TYPE: none
strategy:
fail-fast: true
max-parallel: 4
matrix:
php-version:
- '7.3' # Lowest supported
- '7.4' # Latest php 7 version
- '8.0' # First php 8 version
- '8.1' # Latest supported
symfony-version:
- '4.4' # Lowest LTS
- '5.4' # Latest LTS
exclude:
# Run all symfony version only on Lowest and Latest php versions, run it only one time for others
- php-version: '8.0'
symfony-version: '4.4'
- php-version: '7.4'
symfony-version: '5.4'
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Enable coverage
if: ${{ matrix.php-version == '8.1' }}
run: |
echo "COVERAGE_OUTPUT_STYLE=clover" >> $GITHUB_ENV
echo "COVERAGE_TYPE=xdebug" >> $GITHUB_ENV

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php-version }}'
tools: composer
coverage: ${{ env.COVERAGE_TYPE }}
env:
# Always use latest available patch for the version
update: true

- name: Setup cache
id: cache
uses: actions/cache@v2
with:
path: |
~/.composer
./vendor
${{ env.CODACY_CACHE_PATH }}
build/behat-code-coverage-cache
# Clear the cache if composer json (as composer.lock is in the repo) has been updated
key: ${{ env.CACHE_VERSION }}-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}-${{ hashFiles('composer.json') }}

- name: Download codacy binary
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.CODACY_CACHE_PATH }} \
&& curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
&& chmod +x ${{ env.CODACY_BIN }} \
&& ${{ env.CODACY_BIN }} download

- name: Build
run: |
composer require -W \
symfony/http-foundation:^${{ matrix.symfony-version }} \
symfony/http-kernel:^${{ matrix.symfony-version }} \
symfony/config:^${{ matrix.symfony-version }} \
symfony/dependency-injection:^${{ matrix.symfony-version }} \
symfony/event-dispatcher:^${{ matrix.symfony-version }} \
symfony/routing:^${{ matrix.symfony-version }} \
&& make build

- name: Tests
run: make test-unit && make test-functional

# See the reports at https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server
- name: Upload unit tests coverage to codecov
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
uses: codecov/codecov-action@v3
with:
file: "build/coverage-phpunit/unit.clover"
name: "unit-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
flags: "unit-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
fail_ci_if_error: true

- name: Upload functional tests coverage to codecov
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
uses: codecov/codecov-action@v3
with:
files: "build/coverage-behat/clover.xml,build/coverage-phpunit/functional.clover"
name: "functional-tests-${{ matrix.php-version }}-${{ matrix.symfony-version }}"
flags: "functional-tests,php-${{ matrix.php-version }},sf-${{ matrix.symfony-version }}"
fail_ci_if_error: true

- name: Upload coverages to Codacy
if: ${{ env.COVERAGE_TYPE == 'xdebug' }}
run: ${{ env.CODACY_BIN }} report -r build/coverage-phpunit/unit.clover -r build/coverage-behat/clover.xml -r build/coverage-phpunit/functional.clover -t ${{ secrets.CODACY_PROJECT_TOKEN }} --partial

finalize-codacy-coverage-report:
runs-on: ubuntu-latest
name: Finalize Codacy coverage report
needs: [ tests ]
steps:
- name: Setup cache
id: cache
uses: actions/cache@v2
with:
path: |
${{ env.CODACY_CACHE_PATH }}
key: ${{ env.CACHE_VERSION }}-codacy-final

- name: Download codacy binary
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.CODACY_CACHE_PATH }} \
&& curl -LN https://coverage.codacy.com/get.sh -o ${{ env.CODACY_BIN }} \
&& chmod +x ${{ env.CODACY_BIN }} \
&& ${{ env.CODACY_BIN }} download

- name: Finalize reporting
run: ${{ env.CODACY_BIN }} final -t ${{ secrets.CODACY_PROJECT_TOKEN }}
Loading