Skip to content

Commit

Permalink
Symfony 6.4 upgrade (#620)
Browse files Browse the repository at this point in the history
* Add correct entries for hosts

* Change deprecated Route

* Add return types

* Refactor deprecation

* Map port 3306

* Update SF and add ext-intl as requirement

* Rearrange constructor params that required is before optional

* Replace deprecated Twig_Extension with AbstractExtension

* Add return type

* Order params to required first

* Add rector

* Add semicolon to fix deprecation

* Add rector

* Replace session with requestStack

* Refactor to use requestStack

* Refactor to use requestStack

* Fix mock error in buildCommand

* Make test true in framework

* Make every failing testsuite return exit codes

* Apply rector

* Refactor deprecated twig functions

* Add typed properties

* Format json

* Fix controller method

* Change to attribute

* Add getProjectDir to Kernel

* Update phpunit

* Rector updates and typed properties

* Add return type for getBlcokPrefix

* Add return type to fix deprecation warning

* Add return type to fix deprecation warning

* Add return type to fix deprecation warning

* Add return type to fix deprecation warning

* Add types

* Add phpcbf to qa

* Add execute permission

* Add strict type rule

* Run PHPCBF

* Upgrade to 6.4 and fix flashbag

* Mock UserInterface instead of TokenInterface

* Change flashBag to requestStack

* Change flashBag to requestStack

* Change flashBag to requestStack

* Replace deprecated get

* Add correct versioning

* Phase out sensio framework extra bundle

* Add type to id

* Get session from request

* Add extension requirement

* Refactor container get and return types

Move FQCN to use

* Remove annotation

* Remove unused injected services

* Remove FQCN

* Add types

* Add types and remove unused getter

* Add exception if read does not return content

* Add test for unknown headers

* Remove missing service

* Fix twig path

* Remove dead code

* Replace annotation to attribute route

* Replace annotation to attribute route

* Run phpcbf

* Add php extensions used

* Replace deprecated method

* Remove unused dependency

* Run updates

* Add custom exception

* Replace annotation assert with attribute

* Fix deprecation warnings

* Update recipe

* Update recipe

* Update recipe

* Update recipe

* Fix deprecations

* Add types

* Run phpcbf

* Install phpstan

* Suppress PHPMD warnings

It is not in scope to reduce the complexity of these classes at this moment in time.

* Add strict typing

* Remove obsolete check because op array type hint

* Replace ramsey with symfony uid component

* Docker: Use the new php82 images from the openconext-basecontainers project

* Composer.json: Add archive directories so composer archive works

* Resolve projectdir

* GHA: Change workflow file to reflect the change from fpm to php as a
module. A new container is published, with the name "spdashboard"

* Docker: Use an apache file for php as module in stead of php fpm

* Docker: Override the allow_url_fopen to on. Needed to download images for the logos

* Remove commented strict types

* Remove left over

* Remove phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc and type params

* Remove obsolete phpdoc

* Remove unused rule

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc an typed

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc

* Remove obsolete phpdoc, reverted unintended rector change

* Fix deprecations (8.2)

* Add node:20

* Remove unused service

* GHA test integration: Use the new php82 containers

* Use flashes

* Add patch for TinymceBundle

* Docker: Add version info to environment variables

* Docker: Add version info to environment variables

* GHA: Remove deprecations

* Add CSP for translations in Apache config

* Apache config: Use header unset in stead of always unset

* Change checkout version

* Use node 20

* Updating composer.json

* Remove obsolete docblocks

* Updating rector

* Change expectation

* Remove more than 1 empty lines

* Fix test

* Docker: Allow composer to be run as root, avoiding build issues

* Add phpstan

Also, phpstan compains about empty return statements, so had to implement a fake return on IssueRepository

* Make phpstan executable

* Add comment to explain usage in compilerpass

* Add phpstan config file

* Add 6.0.0 release

---------

Co-authored-by: Bart Geesink <[email protected]>
  • Loading branch information
parijke and quartje authored Feb 15, 2024
1 parent 6acbb20 commit e0ed64e
Show file tree
Hide file tree
Showing 359 changed files with 11,186 additions and 7,490 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/daily-security-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

# PHP checks
- name: Check for php composer project
Expand All @@ -34,7 +34,7 @@ jobs:
if: steps.check_node_yarn.outputs.files_exists == 'true'
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 20
- name: Yarn Audit
if: steps.check_node_yarn.outputs.files_exists == 'true'
run: yarn audit --level high --groups dependencies optionalDependencies
Expand All @@ -50,7 +50,7 @@ jobs:
if: steps.check_node_npm.outputs.files_exists == 'true'
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 20
- name: npm audit
if: steps.check_node_npm.outputs.files_exists == 'true'
run: npm audit --audit-level=high
Expand Down
65 changes: 25 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Build docker container for the SP Dashboard
on:
pull_request:
release:
types: [ published ]
push:
branches: [ develop ]
types: [published]
push:
branches: [develop]
workflow_dispatch:

jobs:
Expand All @@ -16,66 +16,51 @@ jobs:
contents: read

steps:

- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: 14
- name: Get commit SHA and time
id: commit_details
run: |
GIT_COMMIT_TIME=$(git show -s --format=%ci $GITHUB_SHA)
echo "::set-output name=commit_time::$GIT_COMMIT_TIME"
echo "::set-output name=sha::$GITHUB_SHA"
REF_NAME=${GITHUB_REF#refs/*/}
echo "::set-output name=ref_name::$REF_NAME"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set docker metadata for php fpm container
id: metaphpfpm
- name: Set docker metadata for the container
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/surfnet/sp-dashboard/spdashboard_php-fpm
ghcr.io/surfnet/sp-dashboard/spdashboard
tags: |
type=schedule
type=ref,event=tag
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set docker metadata for web container
id: metahttpd
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/surfnet/sp-dashboard/spdashboard_web
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build the php-fpm container and push to GitHub Packages
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ steps.metaphpfpm.outputs.tags }}
target: phpfpm-build

- name: Build the Apache container and push to GitHub Packages
uses: docker/build-push-action@v4
- name: Build the container and push to GitHub Packages
uses: docker/build-push-action@v5
with:
context: .
build-args: |
APP_VERSION=${{ steps.commit_details.outputs.ref_name }}
GIT_SHA=${{ steps.commit_details.outputs.sha }}
GIT_COMMIT_TIME=${{ steps.commit_details.outputs.commit_time }}
file: docker/Dockerfile
push: true
tags: ${{ steps.metahttpd.outputs.tags }}
target: httpd-build
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
24 changes: 11 additions & 13 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ jobs:
timeout-minutes: 30
env:
DOCKER_COMPOSE: docker-compose -f docker-compose.yml -f docker-compose-ci.yml
DOCKER_COMPOSE_PHP_FPM: docker-compose -f docker-compose.yml -f docker-compose-ci.yml exec -T php-fpm
DOCKER_COMPOSE_PHP: docker-compose -f docker-compose.yml -f docker-compose-ci.yml exec -T php
DOCKER_COMPOSE_OPENCONEXT: docker-compose -f docker-compose.yml -f docker-compose-ci.yml exec -T openconext
DOCKER_COMPOSE_CYPRESS: docker-compose -f docker-compose.yml -f docker-compose-ci.yml exec -T cypress

steps:

- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Start the docker images for testing
run: ${DOCKER_COMPOSE} up -d
Expand All @@ -27,55 +26,54 @@ jobs:

- name: Run composer
run: |
${DOCKER_COMPOSE_PHP_FPM} /usr/local/bin/composer install -n --prefer-dist -o --ignore-platform-reqs
${DOCKER_COMPOSE_PHP} /usr/bin/composer install -n --prefer-dist -o --ignore-platform-reqs
env:
SYMFONY_ENV: dev

- name: Run yarn
run: |
docker run -v ${PWD}:/var/www/html -w /var/www/html node:14 yarn install
${DOCKER_COMPOSE_PHP} yarn install
env:
SYMFONY_ENV: dev

- name: Create front end dependencies (yarn encore production)
run: |
docker run -v ${PWD}:/var/www/html -w /var/www/html node:14 yarn run encore production
${DOCKER_COMPOSE_PHP} yarn run encore production
env:
SYMFONY_ENV: dev

- name: Get the database up and running
run: |
${DOCKER_COMPOSE_PHP_FPM} bin/console doctrine:migrations:migrate
${DOCKER_COMPOSE_PHP} bin/console doctrine:migrations:migrate
env:
SYMFONY_ENV: dev

- name: Remove leftover files
run: |
${DOCKER_COMPOSE_PHP_FPM} /bin/rm -rf /tmp/sp-dashboard/ /tmp/sp-dashboard-sessions/
${DOCKER_COMPOSE_PHP} /bin/rm -rf /tmp/sp-dashboard/ /tmp/sp-dashboard-sessions/
- name: Make the log and cache dir writable
run: |
${DOCKER_COMPOSE_PHP_FPM} chmod 777 /var/www/html/var/ -R
${DOCKER_COMPOSE_PHP} chmod 777 /var/www/html/var/ -R
- name: Wait until the spdashboard is accessable
run: |
${DOCKER_COMPOSE_OPENCONEXT} sh /usr/local/sbin/spdup.sh
- name: Run Copy Paste Detector
run: |
${DOCKER_COMPOSE_PHP_FPM} sh -c 'composer jscpd'
${DOCKER_COMPOSE_PHP} sh -c 'composer jscpd'
continue-on-error: true

- name: Run CI tests
run: |
${DOCKER_COMPOSE_PHP_FPM} sh -c 'composer check'
${DOCKER_COMPOSE_PHP} sh -c 'composer check'
- name: Run JS tests
run: |
${DOCKER_COMPOSE_PHP_FPM} sh -c 'composer jest'
${DOCKER_COMPOSE_PHP} sh -c 'composer jest'
- name: Run Cypress tests
run: |
${DOCKER_COMPOSE_CYPRESS} cypress run --browser chrome -C ./ci/qa/cypress.config.ts
continue-on-error: true

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ assets/js/coverage
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###

###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 6.0.0
Make the project Symfony 6 and PHP 8.2 compatible. Many changes were made to achieve this goal.
- Return types where possible
- Strict and strong typing where possible
- PHPstan added to QA

## 5.2.1
- Changed jira from username / password login to token

## 5.2.0
- Collection widgets now allow editing #602
- Improve client reset behavior #607
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Use `docker-compose up -d` to create and build the development environment.
An entry in your hostsfile is still required for things to work. An example entry would look like:

```
127.0.0.1 welcome.vm.openconext.org static.vm.openconext.org mujina-sp.vm.openconext.org mujina-idp.vm.openconext.org engine-api.vm.openconext.org oidc.vm.openconext.org manage.vm.openconext.org spdashboard.vm.openconext.org
127.0.0.1 welcome.vm.openconext.org static.vm.openconext.org mujina-sp.vm.openconext.org mujina-idp.vm.openconext.org engine-api.vm.openconext.org oidc.vm.openconext.org manage.vm.openconext.org spdashboard.vm.openconext.org engine.vm.openconext.org teams.vm.openconext.org
```

Is your host system on an ARM based archetecture CPU, and are you running a docker solution in a VM? Chances are
Expand All @@ -37,10 +37,13 @@ might aid in that area.

## Getting started

First, run `composer install`. This will install all PHP dependencies, including the development dependencies.

In order to start the development environment, run `docker-compose up -d`. This will build and start the container that is
used in development to run the application.
used in development to run the application.

Then start the command line in the container with `docker exec -it sp-dashboard-php-fpm-1 sh`. This will start a shell

Run `composer install`. This will install all PHP dependencies, including the development dependencies.
Run `yarn install`. This will install all js dependencies, including the development dependencies.

Install database migrations
```
Expand All @@ -54,7 +57,7 @@ front controller is used automatically, so you don't have to include `/app_dev.p

### Running the tests

`ant test` will run the full suite of tests and static analysis.
`composer check` will run the full suite of tests and static analysis.

Cypress tests only run locally for now. Use `npm run cy:open` to run them. Please ensure the accessibility tests succeed when making changes in the frontend.

Expand Down
6 changes: 6 additions & 0 deletions ci/qa/phpcbf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh

cd $(dirname $0)/../../

# https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically
./vendor/bin/phpcbf --standard=ci/qa/phpcs.xml ./src $1
5 changes: 5 additions & 0 deletions ci/qa/phpstan
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd $(dirname $0)/../../

vendor/bin/phpstan analyze --memory-limit=-1 --no-ansi -c ./ci/qa/phpstan.neon
Loading

0 comments on commit e0ed64e

Please sign in to comment.