Skip to content
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
40 changes: 20 additions & 20 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
name: test-integration
on: [ push ]
name: Run QA tests (static analysis, lint and unit tests)
on: [pull_request]

jobs:
build:
run-qa-tests:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 15
strategy:
matrix:
php-versions: [ '8.2' ]
experimental: [ false ]
include:
- php-versions: '8.3'
experimental: true
timeout-minutes: 30
name: PHP ${{ matrix.php-versions }} on Ubuntu latest. Experimental == ${{ matrix.experimental }}
php: ['8.2', '8.4']

steps:
- name: Install PHP
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Checkout
uses: actions/checkout@master
- name: Install dependencies
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none

- name: Composer install
run: composer install
continue-on-error: ${{ matrix.experimental }}
- name: Run CI tests
run: composer check
continue-on-error: ${{ matrix.experimental }}

- name: Run QA tests
run: composer check-ci

- name: Output log files on failure
if: failure()
run: tail -2000 /var/log/syslog
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
composer.lock
.idea
.phpunit.result.cache
/var
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 7.0.0
Allow for Symfony 7 packages and drop Symfony 5 support.

Changes include:
- Updated dev tooling & QA

# 6.0.0
Allow for Symfony 6 packages and drop PHP7 support

Expand Down
88 changes: 53 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,64 @@
# Step-up Bundle
[![Build Status](https://travis-ci.org/OpenConext/Stepup-bundle.svg)](https://travis-ci.org/OpenConext/Stepup-bundle) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/OpenConext/Stepup-bundle/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/OpenConext/Stepup-bundle/?branch=develop) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/5b8b8d8b-e917-4954-818b-782d9e181c75/mini.png)](https://insight.sensiolabs.com/projects/5b8b8d8b-e917-4954-818b-782d9e181c75)

A Symfony 2 and 3 bundle that holds shared code and framework integration for all Step-up applications. See [Stepup-Deploy](https://github.com/OpenConext/Stepup-Deploy) for an overview of Stepup.
A Symfony bundle that holds shared code and framework integration for all Step-up applications. See [Stepup-Deploy](https://github.com/OpenConext/Stepup-Deploy) for an overview of Stepup.

## Requirements

- PHP 8.2 or higher
- Symfony 6.3+ or 7.0+

## Installation

* Add the package to your Composer file (For Symfony 2 support, please use a version constraint "~3.5")
* Add the package to your Composer file
```sh
composer require surfnet/stepup-bundle
```

* Add the bundle to your kernel in `app/AppKernel.php`
* The bundle should be automatically registered in `config/bundles.php` (for Symfony Flex projects). If not, add it manually:
```php
public function registerBundles()
{
// config/bundles.php
return [
// ...
$bundles[] = new Surfnet\StepupBundle\SurfnetStepupBundle;
}
Surfnet\StepupBundle\SurfnetStepupBundle::class => ['all' => true],
];
```

* Copy and adjust the error templates to your application folder
* `src/Resources/views/Exception/error.html.twig` → `app/Resources/SurfnetStepupBundle/views/Exception/error.html.twig`
* `src/Resources/views/Exception/error404.html.twig` → `app/Resources/SurfnetStepupBundle/views/Exception/error404.html.twig`
* `src/Resources/views/Exception/error.html.twig` → `templates/bundles/SurfnetStepupBundle/Exception/error.html.twig`
* `src/Resources/views/Exception/error404.html.twig` → `templates/bundles/SurfnetStepupBundle/Exception/error404.html.twig`

### Install resources

For modern Symfony applications, you can use AssetMapper (recommended for Symfony 7.0+) or Webpack Encore to manage assets.

#### Using AssetMapper (Symfony 7.0+)

```bash
# Install AssetMapper if not already installed
composer require symfony/asset-mapper symfony/asset symfony/twig-pack
```

Copy the bundle's public assets to your project:
```bash
php bin/console assets:install --symlink
```

Then reference the assets in your templates:
```twig
{% stylesheets filter='less'
'@SurfnetStepupBundle/Resources/public/less/stepup.less'
%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}
{% javascripts
'@SurfnetStepupBundle/Resources/public/js/stepup.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
<link href="{{ asset('bundles/surfnetstepup/less/stepup.css') }}" type="text/css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="{{ asset('bundles/surfnetstepup/js/stepup.js') }}"></script>
```

#### Using Webpack Encore

Import the bundle's assets in your JavaScript/CSS entry point:
```javascript
// assets/app.js
import '../vendor/surfnet/stepup-bundle/src/Resources/public/js/stepup.js';

// assets/app.css
@import '../vendor/surfnet/stepup-bundle/src/Resources/public/less/stepup.less';
```

## Using the locale switcher
Expand All @@ -44,38 +67,34 @@ The locale switcher is a form that can be rendered with the help of a Twig funct

```twig
{% if app.user %}
{% set locale_switcher = stepup_locale_switcher('handler_route', ['return-url' => app.request.uri]) %}
{% set locale_switcher = stepup_locale_switcher('handler_route', {'return-url': app.request.uri}) %}
{{ form_start(locale_switcher, { attr: { class: 'form-inline' }}) }}
{{ form_widget(locale_switcher.locale) }}
{{ form_widget(locale_switcher.switch) }}
{{ form_end(locale_switcher) }}
{% endif %}
{% stylesheets filter='less'
'@SurfnetStepupBundle/Resources/public/less/style.less'
%}
<link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="screen" />
{% endstylesheets %}
{% javascripts
'@SurfnetStepupBundle/Resources/public/js/index.js'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
```

Include the required assets:
```twig
<link href="{{ asset('bundles/surfnetstepup/less/style.css') }}" type="text/css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="{{ asset('bundles/surfnetstepup/js/index.js') }}"></script>
```

## Release strategy

### CHANGELOG
The changelog for the bundle is kept in the `./CHANGELOG` file. A history of the releases can be found in this file.
Previous RMT release notes are kept in this file for history purposes. Please use markdown to style the changelog.
The changelog for the bundle is kept in the `CHANGELOG.md` file. A history of the releases can be found in this file.
Previous release notes are kept in this file for history purposes. Please use markdown to style the changelog.

Please update the changelog with any notable changes that are introduced in an upcoming release. If you are not yet
certain what the next release number will be, give the release title a generic value like `Upcoming release`. Make sure
before merging the changes to the release branch to update the release title in the changelog.

**Example CHANGELOG entry**
```
```markdown
# 2.5.23
Brief explenation on the major changes of this release
Brief explanation of the major changes of this release

## New features
* Title of PR of the new feature #30
Expand All @@ -86,7 +105,6 @@ Brief explenation on the major changes of this release

## Improvements
* Title of PR of the improvement #29

```

When releasing a hotfix on a release branch, please update the changelog on the release branch and after releasing the
Expand Down
6 changes: 6 additions & 0 deletions ci/qa/docheader
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

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

./vendor/bin/docheader --no-ansi --docheader=ci/qa/docheader.template check src/

16 changes: 16 additions & 0 deletions ci/qa/docheader.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright %regexp:\d{4}% SURFnet %regexp:(B.V.|bv)%
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

2 changes: 1 addition & 1 deletion ci/qa/phpcpd
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ cd $(dirname $0)/../../

# https://github.com/sebastianbergmann/phpcpd
./vendor/bin/phpcpd \
./src $1
./src $1
2 changes: 1 addition & 1 deletion ci/qa/phplint.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
path: [./src, ./tests]
jobs: 10
cache: /var/qa/phplint.cache
cache-dir: var/qa/phplint.cache
extensions:
- php
exclude:
Expand Down
Loading