Skip to content

Commit

Permalink
adapt ci.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
sam committed Feb 18, 2024
1 parent 4f82fd4 commit c195e3f
Show file tree
Hide file tree
Showing 11 changed files with 578 additions and 59 deletions.
1 change: 1 addition & 0 deletions .env.oidc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PHP_SERVICE_NAME='php7.4-fpm'
###> symfony/framework-bundle ###
SYMFONY_DEPRECATIONS_HELPER=999999
APP_ENV=dev
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###
Expand Down
228 changes: 228 additions & 0 deletions .env.oidc.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
# This is used with the github ci


SYMFONY_ENV='test'
APP_SECRET='$ecretf0rt3st'
PHP_USER='www-data'
PHP_IDE_CONFIG='serverName=membres.yourcoop.local'
PHP_MEMORY_LIMIT=512M
PHP_SERVICE_NAME='php7.4-fpm'
###> symfony/framework-bundle ###
SYMFONY_DEPRECATIONS_HELPER=999999
APP_ENV=test
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
DATABASE_URL="mysql://root:[email protected]:3306/symfony?serverVersion=5.7&charset=utf8"
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###

# SUPER_ADMIN User
SUPER_ADMIN_USERNAME=admin
SUPER_ADMIN_INITIAL_PASSWORD=password

# Mailer Configuration
MAILER_TRANSPORT=smtp
MAILER_HOST=mailcatcher
MAILER_PORT=1025
MAILER_USER=null
MAILER_PASSWORD=null
MAILER_ENCRYPTION=null

# Transactional Mailer User
[email protected]
TRANSACTIONAL_MAILER_USER_NAME='espace membre'

# Base Domain for Emails
EMAILS_BASE_DOMAIN=yourcoop.local

# Email Addresses
EMAILS_CONTACT_NAME='Contact Localcoop'
[email protected]
EMAILS_MEMBER_NAME='Membres Localcoop'
[email protected]
EMAILS_SHIFT_NAME='Créneaux Localcoop'
[email protected]
EMAILS_FORMATION_NAME='Formation Localcoop'
[email protected]
EMAILS_ADMIN_NAME='Admin Localcoop'
[email protected]
EMAILS_NOREPLY_NAME='Ne pas répondre'
[email protected]

# Router Configuration
ROUTER_REQUEST_CONTEXT_HOST=membres.yourcoop.local
ROUTER_REQUEST_CONTEXT_SCHEME=https
ROUTER_REQUEST_CONTEXT_BASE_URL=

# Security: IP check
ENABLE_PLACE_LOCAL_IP_ADDRESS_CHECK=true
PLACE_LOCAL_IP_ADDRESS='127.0.0.1,192.168.0.x'

# Branding
SITE_NAME="Espace membre @ MyLocalCoop"
PROJECT_NAME="My Local Coop"
PROJECT_URL=https://yourcoop.local/
PROJECT_URL_DISPLAY=yourcoop.local
MAIN_COLOR=#51CAE9
LOCAL_CURRENCY_NAME="monnaie locale"

# Registration
REGISTRATION_DURATION='1 year'
REGISTRATION_EVERY_CIVIL_YEAR=false
REGISTRATION_MANUAL_ENABLED=true
HELLOASSO_REGISTRATION_CAMPAIGN_URL=https://www.helloasso.com/associations/my-local-coop/adhesions/re-adhesion
HELLOASSO_API_KEY=
HELLOASSO_API_PASSWORD=
HELLOASSO_API_BASE_URL=https://api.helloasso.com/v3/

# Shifting Configuration
DUE_DURATION_BY_CYCLE=180
MIN_SHIFT_DURATION=90
CYCLE_DURATION='28 days'
CYCLE_TYPE=abcd
NEW_USERS_START_AS_BEGINNER=true
ALLOW_EXTRA_SHIFTS=true
MAX_TIME_IN_ADVANCE_TO_BOOK_EXTRA_SHIFTS='3 days'
TIME_AFTER_WHICH_MEMBERS_ARE_LATE_WITH_SHIFTS=-9
RESERVE_NEW_SHIFT_TO_PRIOR_SHIFTER=true
RESERVE_NEW_SHIFT_TO_PRIOR_SHIFTER_DELAY=7
FORBID_SHIFT_OVERLAP_TIME=30
MAX_TIME_AT_END_OF_SHIFT=0
DISPLAY_NAME_SHIFTERS=false

# shift fly and fixed
USE_FLY_AND_FIXED=false
FLY_AND_FIXED_ENTITY_FLYING=Beneficiary
FLY_AND_FIXED_ALLOW_FIXED_SHIFT_FREE=false

# Swipe card
USE_CARD_READER_TO_VALIDATE_SHIFTS=false
SWIPE_CARD_LOGGING=true
SWIPE_CARD_LOGGING_ANONYMOUS=true
DISPLAY_SWIPE_CARDS_SETTINGS=true

# Shifting: time log saving
USE_TIME_LOG_SAVING=false
TIME_LOG_SAVING_SHIFT_FREE_MIN_TIME_IN_ADVANCE_DAYS=null
TIME_LOG_SAVING_SHIFT_FREE_ALLOW_ONLY_IF_ENOUGH_SAVING=false

# Profile Configuration
DISPLAY_GAUGE=true
PROFILE_DISPLAY_TASK_LIST=true
PROFILE_DISPLAY_TIME_LOG=true
PROFILE_DISPLAY_SHIFT_FREE_LOG=true
PROFILE_DISPLAY_PERIOD_POSITION_FREE_LOG=true
DISPLAY_FREEZE_ACCOUNT=true
DISPLAY_FREEZE_ACCOUNT_FALSE_MESSAGE="Le gel de compte n'est pas autorisé."
MAX_NB_OF_PAST_CYCLES_TO_DISPLAY=3

# User Configuration
USER_ACCOUNT_NOT_ENABLED_MATERIAL_ICON=phonelink_off
USER_ACCOUNT_ENABLED_ICON=☑
USER_ACCOUNT_ENABLED_MATERIAL_ICON=devices

# Member Configuration
MAXIMUM_NB_OF_BENEFICIARIES_IN_MEMBERSHIP=2
MEMBER_WITHDRAWN_ICON=∅
MEMBER_WITHDRAWN_MATERIAL_ICON=block
MEMBER_WITHDRAWN_BACKGROUND_COLOR='rgba(255, 50, 0, 0.2)'
MEMBER_FROZEN_ICON=❄️
MEMBER_FROZEN_MATERIAL_ICON=ac_unit
MEMBER_FROZEN_BACKGROUND_COLOR='rgba(0, 138, 255, 0.1)'
MEMBER_EXEMPTED_ICON=☂
MEMBER_EXEMPTED_MATERIAL_ICON=beach_access
MEMBER_EXEMPTED_BACKGROUND_COLOR='rgb(0, 150, 136, 0.1)'
MEMBER_FLYING_ICON=✈
MEMBER_FLYING_MATERIAL_ICON=flightsmode
MEMBER_REGISTRATION_MISSING_ICON=$
MEMBER_REGISTRATION_MISSING_MATERIAL_ICON=attach_money
MEMBER_REGISTRATION_MISSING_BACKGROUND_COLOR='rgb(0, 150, 136, 0.1)'

# Beneficiary Configuration
BENEFICIARY_MAIN_ICON=⚐
BENEFICIARY_NEW_ICON=★
BENEFICIARY_FLYING_ICON=✈

# Admin: Member
ADMIN_MEMBER_DISPLAY_SHIFT_FREE_LOG=true
ADMIN_MEMBER_DISPLAY_PERIOD_POSITION_FREE_LOG=true
FORBID_OWN_SHIFT_BOOK_ADMIN=false
FORBID_OWN_SHIFT_FREE_ADMIN=false
FORBID_OWN_SHIFT_VALIDATE_ADMIN=false
FORBID_OWN_TIMELOG_NEW_ADMIN=false

# Events
MAX_EVENT_PROXY_PER_MEMBER=1

# Opening Hours
DISPLAY_OPENING_HOUR_OPEN_CLOSED_HEADER=true
OPENING_HOUR_OPEN_CLOSED_HEADER_OPEN_MESSAGE="Ouvert"
OPENING_HOUR_OPEN_CLOSED_HEADER_CLOSED_MESSAGE="Fermé"

# Code Generation
CODE_GENERATION_ENABLED=true
DISPLAY_KEYS_SHOP=true
WIKI_KEYS_URL=

# Logging
LOGGING_MATTERMOST_ENABLED=false
LOGGING_MATTERMOST_LEVEL=critical
LOGGING_MATTERMOST_URL=http://mattermost.yourcoop.local
LOGGING_SWIFTMAILER_ENABLED=false
LOGGING_SWIFTMAILER_LEVEL=critical
[email protected]
LOGGING_MATTERMOST_CHANNEL=elefan

# Open ID Client
OIDC_ENABLE=true
OIDC_PROFILE_CUSTOM_MESSAGE='vos informations personnelles sont éditables <a href="http://membres.yourcool.local:8080/"> ici </a>'
OIDC_NO_ACCOUNT_MESSAGE="Vous n\'avez pas de compte. Veuillez contacter le support."
OIDC_ISSUER=http://keycloak:8080/auth
OIDC_REALM=elefan
OIDC_CLIENT_ID=elefan
OIDC_CLIENT_SECRET=secret
OIDC_ROLES_CLAIM=groups

# OIDC User Attributes Map
OIDC_USER_ATTRIBUTE_FIRSTNAME=firstName
OIDC_USER_ATTRIBUTE_LASTNAME=lastName
OIDC_USER_ATTRIBUTE_MEMBER_NUMBER=member_number
OIDC_USER_ATTRIBUTE_EMAIL=email
OIDC_USER_ATTRIBUTE_PHONE=phone
OIDC_USER_ATTRIBUTE_FLYING=flying
OIDC_USER_ATTRIBUTE_ADDRESS_STREET1=address.street1
OIDC_USER_ATTRIBUTE_ADDRESS_STREET2=address.street2
OIDC_USER_ATTRIBUTE_ADDRESS_ZIPCODE=address.zipcode
OIDC_USER_ATTRIBUTE_ADDRESS_CITY=address.city
OIDC_USER_ATTRIBUTE_CO_MEMBER_NUMBER=co_member_number

# OIDC Roles Map
OIDC_ROLE_USER=/cooperate
OIDC_ROLE_ADMIN_PANEL=/infrastructure/informatique/elefan/admin
OIDC_ROLE_USER_VIEWER=/infrastructure/informatique/elefan/admin
OIDC_ROLE_USER_MANAGER=/infrastructure/informatique/elefan/admin
OIDC_ROLE_SHIFT_MANAGER=/infrastructure/informatique/elefan/admin
OIDC_ROLE_FINANCE_MANAGER=/infrastructure/informatique/elefan/admin
OIDC_ROLE_PROCESS_MANAGER=/infrastructure/informatique/elefan/admin
OIDC_ROLE_ADMIN=/infrastructure/informatique/elefan/admin
OIDC_ROLE_SUPER_ADMIN=/infrastructure/informatique/elefan/super_admin
OIDC_ROLE_OAUTH_LOGIN=

OIDC_FORMATIONS_CLAIM=groups

# OIDC Formations Map in JSON
OIDC_FORMATIONS_MAP='{"Accueil magasin": "/infrastructure/informatique/elefan/formations/accueil_magasin", "Caisse": "/infrastructure/informatique/elefan/formations/caisse"}'

OIDC_COMMISSIONS_CLAIM=groups

# OIDC Commissions Map in JSON
OIDC_COMMISSIONS_MAP='{"foo": "/grouvernance/foo", "bar": "/grouvernance/bar"}'
16 changes: 9 additions & 7 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
SYMFONY_ENV='dev'
# This is used with the github ci


APP_ENV=test
SYMFONY_ENV='test'
APP_SECRET='$ecretf0rt3st'
PHP_USER='www-data'
PHP_IDE_CONFIG='serverName=membres.yourcoop.local'
PHP_IDE_CONFIG='serverName=localhost'
PHP_MEMORY_LIMIT=512M
PHP_SERVICE_NAME='php7.4-fpm'
###> symfony/framework-bundle ###
SYMFONY_DEPRECATIONS_HELPER=999999
APP_ENV=dev
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
DATABASE_URL="mysql://root:secret@database:3306/symfony?serverVersion=5.7&charset=utf8"
DATABASE_TEST_HOST=127.0.0.1
DATABASE_URL="mysql://root:[email protected]:3306/symfony?serverVersion=5.7&charset=utf8"
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
Expand Down Expand Up @@ -57,8 +59,8 @@ EMAILS_NOREPLY_NAME='Ne pas répondre'
EMAILS_NOREPLY_ADDRESS=[email protected]

# Router Configuration
ROUTER_REQUEST_CONTEXT_HOST=membres.yourcoop.local
ROUTER_REQUEST_CONTEXT_SCHEME=https
ROUTER_REQUEST_CONTEXT_HOST=localhost
ROUTER_REQUEST_CONTEXT_SCHEME=http
ROUTER_REQUEST_CONTEXT_BASE_URL=

# Security: IP check
Expand Down
116 changes: 116 additions & 0 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Integration and Functional

on:
pull_request:
branches:
- master
- staging
- dev

jobs:
setup:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
php-versions: ['7.4']
steps:
# REMOVE RESIDUAL CONTAINERS ( for local debug with act only )
- name: Remove all mysql containers when working with act
if: ${{ env.ACT }}
run: |
CONTAINERS=$(docker ps -a -q --filter ancestor=mariadb:10.4.10)
if [ ! -z "$CONTAINERS" ]; then
docker rm -f $CONTAINERS
else
echo "No containers to remove."
fi
- name: Checkout code
uses: actions/checkout@v4

# INSTALL DEPENDENCIES ----------------
- name: Setup PHP, extensions and composer with shivammathur/setup-php
uses: shivammathur/setup-php@verbose
with:
php-version: ${{ matrix.php-versions }}
tools: composer:2.2
extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql, dom, filter, gd, iconv, json

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.11.0'

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: |
${{ env.dir }}
./vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

# INSTALL DEPENDENCIES ----------------
- name: Install MySQL Client
run: sudo apt-get update && sudo apt-get install -y mysql-client

- name: Install Cypress dependencies
run: sudo apt-get install -y xvfb

# SET ENVIRONMENT VARIABLES ----------------
# - name: Set up test environment variables
# run: cp .env.test .env

# START SERVICES ----------------
# - name: Set up MySQL
# uses: getong/[email protected]
# with:
# host port: 3306 # Optional, default value is 3306. The port of host
# container port: 3306 # Optional, default value is 3306. The port of container
# character set server: 'utf8mb4' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
# collation server: 'utf8mb4_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
# mariadb version: '10.4.10' # Optional, default value is "latest". The version of the MySQL
# mysql database: 'symfony' # Optional, default value is "test". The specified database which will be created
# mysql root password: 'secret' # Required if "mysql user" is empty, default is empty. The root superuser password
# mysql user: 'user' # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too
# mysql password: 'password' # Required if "mysql user" exists. The password for the "mysql user"
#
# - name: Wait for MySQL to become available
# run: |
# until mysql -h 127.0.0.1 -u root -psecret -e "SELECT 1"; do
# echo 'Waiting for MySQL...'
# sleep 1
# done

# - name: Start Symfony server
# run: php -S localhost:8000 -t public &>/dev/null &

# RUN MIGRATIONS ----------------
# - name: Run migrations
# run: php bin/console doctrine:migrations:migrate --no-interaction

# FILL DATABASE ----------------
# - name: Run fixture
# run: php bin/console doctrine:fixtures:load --no-interaction

# BUILD FRONT ----------------
- name: Enable verbose npm logging
run: npm config set loglevel verbose

- name: Install dependencies
run: npm install

- name: Build front-end assets
run: ./node_modules/.bin/encore production --progress

# RUN CYPRESS TESTS ----------------
# - name: Run Cypress tests
# run: npm run cy:run:main
Loading

0 comments on commit c195e3f

Please sign in to comment.