Skip to content

Commit

Permalink
3547: Cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Jan 10, 2025
1 parent 9dff19a commit 51abfc9
Show file tree
Hide file tree
Showing 19 changed files with 1,262 additions and 175 deletions.
22 changes: 12 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# PHP PSR-2 Coding Standards
# http://www.php-fig.org/psr/psr-2/
# Drupal editor configuration normalization
# @see http://editorconfig.org/

# This is the top-most .editorconfig file; do not search in parent directories.
root = true

[*.*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{js,scss,yaml,yml}]
indent_size = 2
123 changes: 91 additions & 32 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,108 @@ env:
COMPOSE_USER: root

jobs:
changelog:
runs-on: ubuntu-latest
name: Changelog should be updated
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- run: git fetch
- name: Check that changelog has been updated.
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md

composer-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker network create frontend
- run: |
docker compose run --rm phpfpm composer validate
coding-standards-php:
composer-normalize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker network create frontend
docker compose run --rm phpfpm composer install
- run: |
docker compose run --rm phpfpm composer normalize --dry-run
coding-standards:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
script:
- code-analysis
- coding-standards-check/php
- coding-standards-check/twig
steps:
- uses: actions/checkout@v4
- uses: pnorton5432/setup-task@v1
- run: |
docker network create frontend
docker compose run --rm phpfpm composer install
docker compose run --rm phpfpm composer coding-standards-check
# code-analysis:
# runs-on: ubuntu-20.04
# strategy:
# fail-fast: false
# matrix:
# php: ['8.3']
# name: PHP code analysis (${{ matrix.php }})
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Setup PHP, with composer and extensions
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php}}
# extensions: apcu, ctype, iconv, json, redis, tokenizer
# coverage: none
# - name: Get composer cache directory
# id: composer-cache
# run: echo "::set-output name=dir::$(composer config cache-files-dir)"
# - name: Cache composer dependencies
# uses: actions/cache@v2
# with:
# path: ${{ steps.composer-cache.outputs.dir }}
# key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
# restore-keys: ${{ matrix.php }}-composer-
# - name: Install Dependencies
# run: composer install --ignore-platform-req=php
# - name: Code analysis
# run: composer code-analysis
- run: |
docker compose run --rm phpfpm composer ${{ matrix.script }}
site-update:
name: Check that site can be updated
runs-on: ubuntu-latest
steps:
# Install site from our base ref
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}

- name: setup-docker-and-composer
run: |
docker network create frontend
docker compose pull
docker compose up --detach
# Important: Use --no-interaction to make https://getcomposer.org/doc/06-config.md#discard-changes have effect.
docker compose exec --user root phpfpm composer install --no-interaction --ignore-platform-req=php
- name: Install site
run: |
docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
- name: Build assets
run: |
docker compose run --rm node yarn install
docker compose run --rm node yarn build
- name: Clean up root stuff
run: |
sudo chown -Rv $USER:$USER vendor/ node_modules/ || true
# Install site with our current ref
- uses: actions/checkout@v4
with:
# We want to keep site files generated by site install.
# https://github.com/actions/checkout?tab=readme-ov-file#usage
clean: false

- name: setup-docker-and-composer
run: |
docker compose pull
docker compose up --detach
# Important: Use --no-interaction to make https://getcomposer.org/doc/06-config.md#discard-changes have effect.
docker compose exec phpfpm composer install --no-interaction
- name: Update site
run: |
docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
- name: Build assets
run: |
docker compose run --rm node yarn install
docker compose run --rm node yarn build
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
.idea

###> vincentlanglet/twig-cs-fixer ###
/.twig-cs-fixer.cache
###< vincentlanglet/twig-cs-fixer ###
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Hoeringsportal – GetOrganized

``` shell name=site-install
docker compose pull
docker compose up --detach
docker compose exec phpfpm composer install
task site-install
```

``` shell name=assets-build
docker compose run --rm node yarn install
docker compose run --rm node yarn build

```

``` shell name=assets-watch
Expand Down
155 changes: 155 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
version: '3'

# https://taskfile.dev/usage/#env-files
dotenv: ['.env.local', '.env']

vars:
# https://taskfile.dev/reference/templating/
BASE_URL: 'https://{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default "sharefile2go.local.itkdev.dk"}}'
DOCKER_COMPOSE: '{{.TASK_DOCKER_COMPOSE | default "docker compose"}}'
COMPOSER_INSTALL_ARGUMENTS: '{{.TASK_COMPOSER_INSTALL_ARGUMENTS | default ""}}'

tasks:
default:
cmds:
- task --list-all
silent: true

site-install:
prompt: "This will reset your setup. Continue?"
cmds:
- task compose -- down
- task: site-update
- task site-open
# - task site-open:admin
silent: true

site-update:
cmds:
- task compose -- pull
- task compose-up
- task composer-install
- task console -- --no-interaction doctrine:migrations:migrate
silent: true

site-url:
cmds:
- echo {{.BASE_URL}}
silent: true

site-open:
cmds:
- if command -v open 2>&1 >/dev/null; then open "$(task site-url)"; else echo "$(task site-url)"; fi
silent: true

compose:
cmds:
- '{{.DOCKER_COMPOSE}} {{.CLI_ARGS}}'

compose-up:
cmds:
- task compose -- up --detach --remove-orphans
silent: true

composer:
cmds:
- task compose -- exec phpfpm composer {{.CLI_ARGS}}
silent: true

composer-install:
cmds:
- task composer -- install {{.COMPOSER_INSTALL_ARGUMENTS}} {{.CLI_ARGS}}
silent: true

console:
cmds:
# Check if we have content on stdin (cf.
# https://unix.stackexchange.com/questions/762992/bash-check-if-the-standard-input-contains-anything)
- >-
if [[ ! -t 0 ]]; then
task compose -- exec --no-TTY phpfpm bin/console {{.CLI_ARGS}};
else
task compose -- exec phpfpm bin/console {{.CLI_ARGS}};
fi
silent: true

coding-standards:apply:
desc: "Apply coding standards"
cmds:
- task: coding-standards:apply:assets
- task: coding-standards:apply:markdown
- task: coding-standards:apply:php
- task: coding-standards:apply:twig
silent: true

coding-standards:check:
desc: "Apply coding standards"
cmds:
- task: coding-standards:check:assets
- task: coding-standards:check:markdown
- task: coding-standards:check:php
- task: coding-standards:check:twig
silent: true

coding-standards:apply:assets:
desc: "Apply coding standards for assets"
cmds:
# Prettier does not (yet, fcf.
# https://github.com/prettier/prettier/issues/15206) have an official
# docker image.
# https://hub.docker.com/r/jauderho/prettier is good candidate (cf. https://hub.docker.com/search?q=prettier&sort=updated_at&order=desc)
- docker run --rm --volume "$PWD:/work" jauderho/prettier --write assets

coding-standards:check:assets:
desc: "Apply and check coding standards for assets"
cmds:
- task: coding-standards:apply:assets
- docker run --rm --volume "$PWD:/work" jauderho/prettier --check assets

coding-standards:apply:markdown:
desc: "Apply coding standards for Markdown"
cmds:
- docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore '**/node_modules/**' --ignore '**/vendor/**' '*.md' 'web/*/custom/**/*.md' 'documentation/*.md' --fix

coding-standards:check:markdown:
desc: "Apply and check coding standards for Markdown"
cmds:
- task: coding-standards:apply:markdown
- docker run --rm --volume "$PWD:/md" peterdavehello/markdownlint markdownlint --ignore '**/node_modules/**' --ignore '**/vendor/**' '*.md' 'web/*/custom/**/*.md' 'documentation/*.md'

coding-standards:apply:php:
desc: "Apply coding standards for PHP"
cmds:
- task composer -- coding-standards-apply/php
silent: true

coding-standards:check:php:
desc: "Apply and check coding standards for PHP"
cmds:
- task: coding-standards:apply:php
- task composer -- coding-standards-check/php
silent: true

coding-standards:apply:twig:
desc: "Apply coding standards for Twig"
cmds:
- task composer -- coding-standards-apply/twig
silent: true

coding-standards:check:twig:
desc: "Apply and check coding standards for Twig"
cmds:
- task: coding-standards:apply:twig
- task composer -- coding-standards-check/twig
silent: true

code-analysis:
cmds:
- task composer -- code-analysis

docker-pull:
desc: "Pull all development docker images"
cmds:
- docker pull jauderho/prettier
- docker pull peterdavehello/markdownlint
- task compose -- pull
10 changes: 5 additions & 5 deletions assets/css/console.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
* {
margin: 0;
padding: 0;
margin: 0;
padding: 0;
}

div {
padding-left: 1ex;
padding-left: 1ex;
}

.stderr {
border-left: solid 1ex #ffaaaa;
border-left: solid 1ex #ffaaaa;
}

.stdout {
border-left: solid 1ex #aaffaa;
border-left: solid 1ex #aaffaa;
}
8 changes: 4 additions & 4 deletions assets/css/easy_admin.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.form-widget input.form-control,
.form-widget textarea.form-control,
.form-widget select.form-control {
max-width: none;
max-width: none;
}

.edoc-item-list-values {
dd {
margin-left: 1em;
}
dd {
margin-left: 1em;
}
}
Loading

0 comments on commit 51abfc9

Please sign in to comment.