diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f742269039..67c85394f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,46 +1,73 @@ -name: ci +name: CI on: - pull_request: + push: branches: - - homolog + - develop + pull_request: ~ + workflow_dispatch: ~ - workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: - BUILD: + tests: + name: Tests runs-on: ubuntu-latest steps: - - - uses: actions/checkout@v4.1.1 - - - name: Docker Login - uses: docker/login-action@v3.0.0 + - + name: Checkout + uses: actions/checkout@v4 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build Docker images + uses: docker/bake-action@v4 with: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Checkout submodules - run: git submodule update --init --recursive - - - name: Ajusta branch do MultipleLocalAuth - run: cd src/plugins/MultipleLocalAuth && git checkout v3.0.0 - - - name: Criação da Imagem docker - uses: docker/build-push-action@v5.0.0 - with: - context: ./ - file: ./Dockerfile - push: true - tags: | - secultceara/mapascultural:7.3.7 - secultceara/mapascultural:latest - - DEPLOY: - needs: BUILD - runs-on: mapahomolog + pull: true + load: true + files: | + compose.yaml + compose.override.yaml + set: | + *.cache-from=type=gha,scope=${{github.ref}} + *.cache-from=type=gha,scope=refs/heads/main + *.cache-to=type=gha,scope=${{github.ref}},mode=max + - + name: Start services + run: docker compose up --wait --no-build + - + name: Check HTTP reachability + run: curl -v --fail-with-body http://localhost + # - + # name: Check API reachability + # run: curl -vk --fail-with-body https://localhost + # - + # name: Check PWA reachability + # run: "curl -vk --fail-with-body -H 'Accept: text/html' https://localhost" + - + name: Create test database + run: docker compose exec -T php bin/console -e test doctrine:database:create + - + name: Run migrations + run: docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction + - + name: Run PHPUnit + run: docker compose exec -T php bin/phpunit + - + name: Doctrine Schema Validator + run: docker compose exec -T php bin/console -e test doctrine:schema:validate + lint: + name: Docker Lint + runs-on: ubuntu-latest steps: - - name: Pull das imagens docker - run: cd /opt/docker/mapa7 && sudo docker-compose pull - - name: Restart do docker-compose para atualizar o container com a nova imagem - run: cd /opt/docker/mapa7 && sudo docker-compose down && sudo docker-compose up -d \ No newline at end of file + - + name: Checkout + uses: actions/checkout@v4 + - + name: Lint Dockerfiles + uses: hadolint/hadolint-action@v3.1.0 + with: + recursive: true diff --git a/.github/workflows/cicd-dev.yml b/.github/workflows/cicd-dev.yml deleted file mode 100644 index 4e1cad187b..0000000000 --- a/.github/workflows/cicd-dev.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: ci/cd-dev - -on: - pull_request: - branches: - - develop - types: - - closed - - ready_for_review - - review_requested - - workflow_dispatch: - -jobs: - CODE_STYLE: - name: PHP-CS-Fixer - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run PHP-CS-Fixer - uses: erkenes/php-cs-fixer-action@main - with: - args: '--dry-run --diff -vvv' - - BUILD: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@v4.1.1 - - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - username: ${{ secrets.DOCKERHUB_USER }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Checkout submodules - run: git submodule update --init --recursive - - - name: Ajusta branch do MultipleLocalAuth - run: cd src/plugins/MultipleLocalAuth && git checkout v3.0.0 - - - name: Criação da Imagem docker - uses: docker/build-push-action@v5.0.0 - with: - context: ./ - file: ./Dockerfile - push: true - tags: | - secultceara/mapascultural:7.3.7-dev - - DEPLOY: - needs: BUILD - runs-on: mapahomolog - steps: - - name: Pull das imagens docker - run: cd /opt/docker/developv7 && sudo docker-compose pull - - name: Restart do docker-compose para atualizar o container com a nova imagem - run: cd /opt/docker/developv7 && sudo docker-compose down && sudo docker-compose up -d diff --git a/.github/workflows/workflows/ci.yml b/.github/workflows/workflows/ci.yml deleted file mode 100644 index 3e21569045..0000000000 --- a/.github/workflows/workflows/ci.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: CI - -on: - push: - branches: - - main - pull_request: ~ - workflow_dispatch: ~ - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - tests: - name: Tests - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build Docker images - uses: docker/bake-action@v4 - with: - pull: true - load: true - files: | - compose.yaml - compose.override.yaml - set: | - *.cache-from=type=gha,scope=${{github.ref}} - *.cache-from=type=gha,scope=refs/heads/main - *.cache-to=type=gha,scope=${{github.ref}},mode=max - - - name: Start services - run: docker compose up --wait --no-build - - - name: Check HTTP reachability - run: curl -v --fail-with-body http://localhost - - - name: Check API reachability - run: curl -vk --fail-with-body https://localhost - - - name: Check PWA reachability - run: "curl -vk --fail-with-body -H 'Accept: text/html' https://localhost" - - - name: Create test database - run: docker compose exec -T php bin/console -e test doctrine:database:create - - - name: Run migrations - run: docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction - - - name: Run PHPUnit - run: docker compose exec -T php bin/phpunit - - - name: Doctrine Schema Validator - run: docker compose exec -T php bin/console -e test doctrine:schema:validate - lint: - name: Docker Lint - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Lint Dockerfiles - uses: hadolint/hadolint-action@v3.1.0 - with: - recursive: true diff --git a/.github/workflows/workflows/release.yml b/.github/workflows/workflows/release.yml deleted file mode 100644 index 35ed5a0284..0000000000 --- a/.github/workflows/workflows/release.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Release -permissions: - contents: write - pull-requests: write - -on: - workflow_dispatch: - inputs: - tag: - description: 'API Platform core tag' - required: true - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - tests: - name: Update api-platform/core - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build Docker images - uses: docker/bake-action@v4 - with: - pull: true - load: true - files: | - compose.yaml - compose.override.yaml - set: | - *.cache-from=type=gha,scope=${{github.ref}} - *.cache-from=type=gha,scope=refs/heads/main - *.cache-to=type=gha,scope=${{github.ref}},mode=max - - - name: Update API Platform - run: docker compose run php composer update api-platform/core:${{ inputs.tag }} - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - commit-message: 'chore: api-platform ${{ inputs.tag }}' - branch: api-platform-core - title: 'chore: api-platform ${{ inputs.tag }}' - body: 'Updates api-platform/core to ${{ inputs.tag }}' diff --git a/api/config/packages/doctrine.yaml b/api/config/packages/doctrine.yaml index 75ec9e8410..f31898a6fc 100644 --- a/api/config/packages/doctrine.yaml +++ b/api/config/packages/doctrine.yaml @@ -8,6 +8,8 @@ doctrine: profiling_collect_backtrace: '%kernel.debug%' use_savepoints: true + mapping_types: + enum: string orm: auto_generate_proxy_classes: true enable_lazy_ghost_objects: true diff --git a/api/mapas/docker/Dockerfile b/api/mapas/docker/xDockerfile similarity index 100% rename from api/mapas/docker/Dockerfile rename to api/mapas/docker/xDockerfile diff --git a/api/mapas/Dockerfile b/api/mapas/xDockerfile similarity index 100% rename from api/mapas/Dockerfile rename to api/mapas/xDockerfile diff --git a/compose.yaml b/compose.yaml index 51aa5b506a..df310bea5a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -33,8 +33,8 @@ services: - ./api:/app # - /app/var - var-files:/app/var - # - ./api/frankenphp/Caddyfile:/etc/caddy/Caddyfile:ro - # - ./api/frankenphp/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro + - ./api/frankenphp/Caddyfile:/etc/caddy/Caddyfile:ro + - ./api/frankenphp/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro - caddy_data:/data - caddy_config:/config @@ -47,6 +47,17 @@ services: published: 5020 protocol: tcp + # pgadmin: + # image: dpage/pgadmin4 + # environment: + # PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} + # PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} + # PGADMIN_CONFIG_SERVER_MODE: 'False' + # volumes: + # - pgadmin:/var/lib/pgadmin + # ports: + # - 5050:80 + recreate-pending-pcache: extends: service: php @@ -91,10 +102,10 @@ services: volumes: - sessions:/data - mailhog: - image: mailhog/mailhog - # ports: - # - "8025:8025" + # mailhog: + # image: mailhog/mailhog + # ports: + # - "8025:8025" # pwa: # image: redemapas/mapas-pwa @@ -108,7 +119,6 @@ services: # API_PLATFORM_CREATE_CLIENT_OUTPUT: . # NEXT_PUBLIC_ENTRYPOINT: http://php - ###> doctrine/doctrine-bundle ### database: image: kartoza/postgis:14 environment: @@ -131,3 +141,4 @@ volumes: db_data: sessions: redis: + pgadmin: