11name : ci 
2- 
32on :
43  push :
54    branches :
6-       - " master" 
7-       - " develop" 
8-       - " saas" 
5+       - " feature*" 
96    tags :
107      - " v*.*.*" 
118  pull_request :
129    branches :
1310      - " develop" 
11+   workflow_dispatch :
12+ 
13+ permissions :
14+   contents : read 
15+   packages : write 
16+   id-token : write 
17+   security-events : write 
18+   actions : read 
19+   checks : read 
20+   statuses : read 
1421
1522jobs :
16-   docker :
23+   CODE_PUBLISH :
1724    runs-on : ubuntu-latest 
1825    steps :
1926      -
@@ -24,44 +31,169 @@ jobs:
2431        id : meta 
2532        uses : docker/metadata-action@v4 
2633        with :
27-           #  list of Docker images to use as base name for tags
2834          images : | 
29-             docker.io/hacklab/mapasculturais  
30- #  ghcr.io/username/app
31-           #  generate Docker tags based on the following events/attributes
35+             ghcr.io/redemapas/mapas 
3236tags : | 
37+             type=raw,value=latest,enable=${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} 
3338            type=ref,event=branch 
39+             type=raw,value=pr-${{ github.event.pull_request.number }} 
3440            type=semver,pattern={{version}} 
3541            type=semver,pattern={{major}}.{{minor}} 
3642            type=semver,pattern={{major}} 
43+             type=sha 
3744
3845        name : Set up QEMU 
3946        uses : docker/setup-qemu-action@v2 
4047      -
4148        name : Set up Docker Buildx 
4249        uses : docker/setup-buildx-action@v2 
43-       -
44-         name : Login to Docker Hub 
45-         if : github.event_name != 'pull_request' 
46-         uses : docker/login-action@v2 
47-         with :
48-           username : ${{ secrets.DOCKERHUB_USERNAME }} 
49-           password : ${{ secrets.DOCKERHUB_TOKEN }} 
5050      #  -
51-       #    name: Login to GHCR 
51+       #    name: Login to Docker Hub 
5252      #    if: github.event_name != 'pull_request'
5353      #    uses: docker/login-action@v2
5454      #    with:
55-       #      registry: ghcr.io
56-       #      username: ${{ github.repository_owner }}
57-       #      password: ${{ secrets.GITHUB_TOKEN }}
55+       #      username: ${{ secrets.DOCKERHUB_USERNAME }}
56+       #      password: ${{ secrets.DOCKERHUB_TOKEN }}
57+       -
58+         name : Login to GHCR 
59+         #  if: github.event_name != 'pull_request'
60+         uses : docker/login-action@v2 
61+         with :
62+           registry : ghcr.io 
63+           username : ${{ github.repository_owner }} 
64+           password : ${{ secrets.GITHUB_TOKEN }} 
5865      -
5966        name : Build and push 
6067        uses : docker/build-push-action@v4 
6168        with :
62-           file : ./docker /Dockerfile 
63-           context :  . 
64-           push : ${{ github.event_name != 'pull_request' }} 
69+           file : .nixpacks /Dockerfile 
70+           platforms :  linux/amd64 
71+           push : true 
6572          tags : ${{ steps.meta.outputs.tags }} 
6673          labels : ${{ steps.meta.outputs.labels }} 
74+           cache-from : type=gha 
75+           cache-to : type=gha,mode=max 
76+ 
77+   CODE_STYLE_FIXER :
78+     name : CODE STYLE CS FIXER 
79+     runs-on : ubuntu-latest 
80+     steps :
81+       - uses : actions/checkout@v4 
82+         with :
83+           submodules : recursive 
84+       - name : Run PHP-CS-Fixer 
85+         uses : erkenes/php-cs-fixer-action@main 
86+         with :
87+           args : ' --dry-run --diff -vvv' 
88+ 
89+   CODE_STYLE_PSALM :
90+     name : CODE SECURITY 
91+     runs-on : ubuntu-latest 
92+     steps :
93+       - uses : actions/checkout@v4 
94+         with :
95+           submodules : recursive 
96+       - name : Run Psalm 
97+         uses : docker://ghcr.io/psalm/psalm-github-actions 
98+         with :
99+           composer_require_dev : true 
100+           composer_ignore_platform_reqs : true 
101+           security_analysis : true 
102+           report_file : results.sarif 
103+       - name : Upload Security Analysis results to GitHub 
104+         uses : github/codeql-action/upload-sarif@v3 
105+         with :
106+           sarif_file : results.sarif 
107+ 
108+   CODE_TESTS :
109+     name : CODE TESTS 
110+     timeout-minutes : 15 
111+     runs-on : ubuntu-latest 
112+     steps :
113+       - name : Baixando codigo 
114+         uses : actions/checkout@v4 
115+         with :
116+           submodules : recursive 
117+       #  See https://github.com/pnpm/action-setup
118+       - name : Install pnpm 
119+         uses : pnpm/action-setup@v4 
120+       #  See https://github.com/actions/setup-node
121+       - name : Install Node.js 
122+         uses : actions/setup-node@v4 
123+         with :
124+           node-version : 20 
125+           cache : ' pnpm' 
126+           #  cache-dependency-path: ./pnpm-lock.yaml
127+       - run : pnpm i 
128+       - run : pnpm run build 
129+       - name : Configuração de valores padrões 
130+         run : | 
131+             cp .env.sample .env 
132+ 
133+       - 
uses : 
hoverkraft-tech/[email protected]  134+         with :
135+           compose-file : | 
136+             docker-compose.yml 
137+             docker-compose.dev.yml 
138+ services : " backend" 
139+           up-flags : " -d --wait" 
140+           down-flags : " -v" 
141+ 
142+       - name : Atualização da estrutura do banco de dados 
143+         run : | 
144+           make db-restore 
145+           make init 
146+           make init_dev 
147+           make db-migrations 
148+ env :
149+           APP_MODE : development 
150+ 
151+       - name : Testes Unitários com PhpUnit 
152+         run : | 
153+           make test-backend 
154+ 
155+ name : Upload to Codecov 
156+         uses : codecov/codecov-action@v2 
157+         with :
158+           token : ${{ secrets.CODECOV_TOKEN }} 
159+           files : ./coverage.xml 
160+           verbose : true 
161+ 
162+       #  - name: Testes de integração com Cypress
163+       #    uses: cypress-io/github-action@v6
164+       #    with:
165+       #      config: '{"e2e":{"viewportWidth":375,"viewportHeight":667}}'
166+       #      wait-on: "http://localhost:4242"
167+       #      wait-on-timeout: 120
168+       #      browser: chrome
169+       #      # record: false
170+       #      # parallel: true
171+       #      # group: "UI - Chrome - Mobile"
172+       #      config-file: cypress/cypress.config.js
173+       #    env:
174+       #      # CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
175+       #      # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
176+       #      # Recommended: pass the GitHub token lets this action correctly
177+       #      # determine the unique run id necessary to re-run the checks
178+       #      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179+       # 
180+       #  - name: Save build folder
181+       #    uses: actions/upload-artifact@v4
182+       #    with:
183+       #      name: screenshots
184+       #      if-no-files-found: error
185+       #      path: src/cypress/screenshots
186+     #  - name: Install composer and dependencies
187+     #    uses: php-actions/composer@v6
188+     #    with:
189+     #      php_extensions: pdo_pgsql zip intl gd mbstring curl xml
67190
191+     #  - name: PHPUnit Tests Mapas
192+     #    uses: php-actions/phpunit@v3
193+     #    env:
194+     #      XDEBUG_MODE: coverage
195+     #    with:
196+     #      version: 10.5
197+     #      php_version: 8.2
198+     #      configuration: phpunit.xml
199+     #      php_extensions: pdo_pgsql zip intl gd mbstring curl xml
0 commit comments