os2forms_fordelingskomponent #139
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
| # Do not edit this file! Make a pull request on changing | |
| # github/workflows/composer.yaml in | |
| # https://github.com/itk-dev/devops_itkdev-docker if need be. | |
| ### ### Composer | |
| ### | |
| ### Validates composer.json and checks that it's normalized. | |
| ### | |
| ### #### Assumptions | |
| ### | |
| ### 1. A docker compose service named `phpfpm` can be run and `composer` can be | |
| ### run inside the `phpfpm` service. | |
| ### 2. [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) | |
| ### is a dev requirement in `composer.json`: | |
| ### | |
| ### ``` shell | |
| ### docker compose run --rm phpfpm composer require --dev ergebnis/composer-normalize | |
| ### ``` | |
| ### | |
| ### Normalize `composer.json` by running | |
| ### | |
| ### ``` shell | |
| ### docker compose run --rm phpfpm composer normalize | |
| ### ``` | |
| name: Composer | |
| env: | |
| COMPOSE_USER: runner | |
| # https://getcomposer.org/doc/03-cli.md#composer-auth | |
| COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"} }' | |
| on: | |
| pull_request: | |
| paths: &paths | |
| - "composer.json" | |
| - "compose.yaml" | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| paths: *paths | |
| jobs: | |
| composer-validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create docker network | |
| run: | | |
| docker network create frontend | |
| - run: | | |
| docker compose run --rm phpfpm composer validate --strict | |
| composer-normalized: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create docker network | |
| run: | | |
| docker network create frontend | |
| - &composer_install | |
| name: Composer install | |
| run: | | |
| # Create a temporary composer file to install https://github.com/mglaman/composer-drupal-lenient before the real install needs it. | |
| docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer init --no-interaction | |
| docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true | |
| docker compose run --rm --env COMPOSER_AUTH --env COMPOSER=composer.lenient.json phpfpm composer require mglaman/composer-drupal-lenient:^1 | |
| docker compose run --rm --env COMPOSER=composer.lenient.json phpfpm rm composer.lenient.* | |
| # The real install. | |
| docker compose run --rm --env COMPOSER_AUTH phpfpm composer install | |
| - run: | | |
| docker compose run --rm phpfpm composer normalize --dry-run | |
| composer-audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create docker network | |
| run: | | |
| docker network create frontend | |
| - *composer_install | |
| - run: | | |
| docker compose run --rm phpfpm composer audit |