Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openchurch v2 #32

Open
wants to merge 79 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
537a223
Delete v1, add sf7
quentin-st Oct 12, 2024
46c1144
Setup model
quentin-st Oct 12, 2024
699c766
Install ApiPlatform
quentin-st Oct 12, 2024
fc7b46e
Misc fixes
quentin-st Oct 12, 2024
f8622df
Dbal: entities update
quentin-st Oct 12, 2024
8c47c31
Add [PATCH] /{type}/{id}/fields controller
quentin-st Oct 12, 2024
66fb91c
add dockerization for dev environment
bailletced Oct 12, 2024
b56ce10
add POST /communities
bailletced Oct 12, 2024
e3ccb8f
remove temporary POST /createObject
bailletced Oct 12, 2024
d3cfc22
allow validation in processors + create POST /places
bailletced Oct 13, 2024
944834a
small polish
bailletced Oct 13, 2024
7f78967
Field::applyValue fix
quentin-st Oct 13, 2024
f835d84
Handle authentication
quentin-st Oct 13, 2024
80a28bf
Add country code fields
quentin-st Oct 13, 2024
a2baaf7
Authentication fixes
quentin-st Oct 13, 2024
9b6d685
Add [POST] /(places|communities)
quentin-st Oct 13, 2024
259a96b
Add app:create:entity command
quentin-st Oct 13, 2024
847e7af
Add ExceptionListener to force-return JSON responses on error
quentin-st Oct 13, 2024
7ae5f9d
FieldController: handle object/object[] field types
quentin-st Oct 13, 2024
ae42997
Fix integer parameters wrongly casted to string and rejected for bein…
quentin-st Oct 13, 2024
b49dda0
Field: rename source into engine, add source
quentin-st Oct 13, 2024
606b7b6
FieldController: misc enhancements
quentin-st Oct 13, 2024
67037e9
Fields: use PHP native enums instead of static string arrays for vali…
quentin-st Oct 13, 2024
2565f35
Implement unique constraint validation
quentin-st Oct 13, 2024
6f7d00c
Fix insertion of OneToMany field values (parentCommunities)
quentin-st Oct 13, 2024
d9f962a
wip
Oct 13, 2024
1f017f7
WIP on feat/v2
bailletced Oct 13, 2024
0e16079
cleaning up
Oct 13, 2024
ac0a0c5
wip
Oct 13, 2024
cbd51b9
Add filter on community type
bailletced Oct 13, 2024
ed35cdd
Fix FieldRepository::exists
quentin-st Oct 23, 2024
8b2a889
reorganize the project + wip on 1st test
bailletced Nov 8, 2024
e875dc4
add application test on GET communities
bailletced Nov 8, 2024
f231139
remove dotenv
bailletced Nov 8, 2024
f538ad0
put dotenv back
bailletced Nov 11, 2024
f0ee3e9
POST /communities
bailletced Nov 12, 2024
93ecb28
POST /places
bailletced Nov 12, 2024
8a9d98c
PATCH /places
bailletced Nov 15, 2024
eda2d93
PATCH /communities
bailletced Nov 15, 2024
a253425
add security + domain exception
bailletced Nov 15, 2024
e49d95e
add security on /communites PATCH/POST endpoints
bailletced Nov 15, 2024
11f9e12
add synchro script
bailletced Nov 19, 2024
e8396a7
install elastic + index parishes + search parishes
bailletced Nov 21, 2024
0a3e891
fix unit test
bailletced Nov 21, 2024
3e17eb3
protect elastic service under an interface
bailletced Nov 21, 2024
fb80d75
elastic improvements + test - wip
bailletced Nov 22, 2024
02a32a1
add spec for parish search
bailletced Nov 25, 2024
ebd7c02
improve community collection provider
bailletced Nov 25, 2024
d69a134
Wip : improve the code coverage
bailletced Nov 29, 2024
c16707f
Wip : improve the code coverage
bailletced Dec 2, 2024
010ccd0
add specs + linter + phpstan + schema validate
bailletced Dec 3, 2024
4942ec1
add ci pipeline
bailletced Dec 3, 2024
37710ef
add CI pipeline
bailletced Dec 3, 2024
f0defe8
add python container
bailletced Dec 4, 2024
90f88b1
add doctrine event listeners - wip
bailletced Dec 12, 2024
c02c65e
improve tests
bailletced Dec 12, 2024
6597e6e
wip
bailletced Dec 16, 2024
10e3473
push to dockerhub
marcomoscardini01 Dec 16, 2024
5eb5fe1
fix .env
marcomoscardini01 Dec 16, 2024
6177935
set DB vars
marcomoscardini01 Dec 16, 2024
38ef098
fix env variables
marcomoscardini01 Dec 16, 2024
3ca1253
clean composer dependencies + fix warning during test
bailletced Dec 16, 2024
401f341
remove unused symfony components + try to fix the CI
bailletced Dec 16, 2024
c7725f8
fix missing symfony-intl dependency
bailletced Dec 16, 2024
8d21aaf
try to fix ci
bailletced Dec 16, 2024
da58fc2
try to fix ci
bailletced Dec 16, 2024
9d10aa4
try to fix ci
bailletced Dec 16, 2024
c09dc1c
fix ci
bailletced Dec 17, 2024
8bb041a
fix ci (docker build)
bailletced Dec 17, 2024
225daee
fix ci (docker build)
bailletced Dec 17, 2024
2dcf222
fix ci (docker build)
bailletced Dec 17, 2024
cfc570f
fix ci (docker build)
bailletced Dec 17, 2024
86e1d1d
fix ci (docker build)
bailletced Dec 17, 2024
502ca18
fix ci (docker build)
bailletced Dec 17, 2024
b03dae3
fix ci (docker build)
bailletced Dec 17, 2024
d2b7893
fix ci (docker build)
bailletced Dec 17, 2024
0499715
set a fixed version for dunglas frankenphp
bailletced Dec 20, 2024
6c5e792
Add secret key for cli_python
bailletced Dec 20, 2024
23828bf
fix publish python image
marcomoscardini01 Dec 24, 2024
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
86 changes: 0 additions & 86 deletions .circleci/config.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
LOCK_DSN=flock
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
40 changes: 0 additions & 40 deletions .env.dist

This file was deleted.

38 changes: 7 additions & 31 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,32 +1,8 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
# define your env variables for the test env here
APP_ENV=test
APP_SECRET=A_SECRET_YOU_NEED_TO_CHANGE_TO_MAKE_IT_SECRET
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###

###> nelmio/cors-bundle ###
CORS_ALLOW_ORIGIN="^https?://localhost(:[0-9]+)?$"
###< nelmio/cors-bundle ###

DB_HOST=127.0.0.1
DB_PORT=3306
MYSQL_DATABASE=openchurch
MYSQL_USER=openchurch
MYSQL_PASSWORD=openchurch
MYSQL_ALLOW_EMPTY_PASSWORD=true

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://%MYSQL_USER%:%MYSQL_PASSWORD%@%DB_HOST%:%DB_PORT%/%MYSQL_DATABASE%
###< doctrine/doctrine-bundle ###

ES_HOST=127.0.0.1
ES_PORT=9200
ES_ENABLED=false
APP_SECRET='$ecretf0rt3st'
DATABASE_URL=mysql://root:symfony@localhost:3306/openchurch_test?serverVersion=11.5.2-MariaDB&charset=utf8mb4
HOST_API=api.openchurch.local/api
HOST_ADMIN=admin.openchurch.local
ELASTIC_PASSWORD=admin
ELASTICSEARCH_IRI=https://localhost:admin@elasticsearch:9200
144 changes: 144 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# https://github.com/shivammathur/setup-php
name: Tests

on: [push]

permissions:
contents: read

jobs:
build-docker-image:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/preprod' || github.ref == 'refs/heads/prod' || github.ref == 'refs/heads/feat/v2'
runs-on: ubuntu-latest
needs: tests
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_REGISTRY: docker.pkg.github.com
DOCKER_REPOSITORY: docker.io
DOCKER_IMAGE_PHP: hozanaci/openchurch-backend
DOCKER_IMAGE_PYTHON: hozanaci/openchurch-sync
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Debug branch info
run: |
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Git ref: ${{ github.ref }}"
- name: Create version.json file
run: |
echo "{ \"version\": \"$(git rev-parse --short HEAD)\", \"build\": \"$(date)\", \"branch\": \"$(git rev-parse --abbrev-ref HEAD)\", \"tag\": \"$(git name-rev --tags --name-only $(git rev-parse HEAD))\" } " > public/version.json
- name: Build and push the image to DockerHub
run: |
echo "$DOCKER_PASSWORD" | docker login $DOCKER_REPOSITORY -u $DOCKER_USERNAME --password-stdin
docker build -t $DOCKER_IMAGE_PHP:$(git rev-parse --short HEAD) -f docker/php/Dockerfile .
docker push $DOCKER_IMAGE_PHP:$(git rev-parse --short HEAD)
docker build -t $DOCKER_IMAGE_PYTHON:$(git rev-parse --short HEAD) -f docker/python/Dockerfile .
docker push $DOCKER_IMAGE_PYTHON:$(git rev-parse --short HEAD)

publish-docker-image:
runs-on: ubuntu-latest
needs: build-docker-image
if: github.ref == 'refs/heads/preprod' || github.ref == 'refs/heads/prod' || github.ref == 'refs/heads/feat/v2'
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_REGISTRY: docker.pkg.github.com
DOCKER_REPOSITORY: docker.io
DOCKER_IMAGE_PHP: hozanaci/openchurch-backend
DOCKER_IMAGE_PYTHON: hozanaci/openchurch-sync
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish latest tag for docker image to DockerHub
run: |
echo "$DOCKER_PASSWORD" | docker login $DOCKER_REPOSITORY -u $DOCKER_USERNAME --password-stdin
docker pull $DOCKER_IMAGE_PHP:$(git rev-parse --short HEAD)
docker tag $DOCKER_IMAGE_PHP:$(git rev-parse --short HEAD) $DOCKER_IMAGE_PHP:$(git rev-parse --abbrev-ref HEAD | tr '/' '-')
docker push $DOCKER_IMAGE_PHP:$(git rev-parse --abbrev-ref HEAD | tr '/' '-')
docker pull $DOCKER_IMAGE_PYTHON:$(git rev-parse --short HEAD)
docker tag $DOCKER_IMAGE_PYTHON:$(git rev-parse --short HEAD) $DOCKER_IMAGE_PYTHON:$(git rev-parse --abbrev-ref HEAD | tr '/' '-')
docker push $DOCKER_IMAGE_PYTHON:$(git rev-parse --abbrev-ref HEAD | tr '/' '-')

tests:
env:
HOST_API: api.openchurch.local/api
runs-on: ubuntu-latest
# Docs: https://docs.github.com/en/actions/using-containerized-services
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: symfony
MYSQL_DATABASE: openchurch_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --name=mysql
elasticsearch:
image: elasticsearch:8.16.0
ports:
- 9200:9200
env:
ELASTIC_PASSWORD: admin
discovery.type: single-node
xpack.security.enabled: true
bootstrap.memory_lock: true
ES_JAVA_OPTS: -Xms512m -Xmx512m
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
tools: phpunit-bridge
extensions: mbstring, xml, ctype, intl, iconv, json, mysql
ini-values: date.timezone=Europe/Paris
- uses: actions/checkout@v4
- name: Create .env.test.local
run: echo -e "DB_NAME_SUFFIX=\\nELASTICSEARCH_IRI=http://elastic:[email protected]:${{ job.services.elasticsearch.ports['9200'] }}" > .env.test.local
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Run migrations
run: |
php bin/console doctrine:migrations:migrate --no-interaction || echo "No migrations found or migration failed"
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/openchurch_test
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/openchurch_test
- name: phpstan
if: always()
run: composer phpstan
- name: composer validate
if: always()
run: composer validate --strict
- name: lint:container
if: always()
run: php bin/console lint:container
- name: lint:yaml
if: always()
run: php bin/console lint:yaml config src
- name: doctrine:schema:validate
if: always()
run: php bin/console doctrine:schema:validate -vvv
env:
DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/openchurch_test
- name: Archive logs as artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: |
var/log/test.log
.env.test.local
16 changes: 16 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Security

on:
push: ~
schedule:
- cron: "0 7 * * *"

permissions:
contents: read

jobs:
security-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: symfonycorp/security-checker-action@v5
Loading
Loading