Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6002e94
[create-pull-request] automated change
RafaelFantinel Mar 23, 2025
3418a47
ci: create develop workflow
RafaelFantinel Mar 23, 2025
cedd0af
ci: adjust package.json scripts
RafaelFantinel Mar 23, 2025
36e0fbb
ci: add run build
RafaelFantinel Mar 23, 2025
3cf5130
ci: remove cache docker push image dockerhub
RafaelFantinel Mar 25, 2025
fe9ddb0
ci: remove buildx
RafaelFantinel Mar 25, 2025
55719e6
ci: add npm build and install
RafaelFantinel Mar 25, 2025
a0b7666
remove report.txt
RafaelFantinel Mar 25, 2025
260271e
ci: change npm commands by yarn
RafaelFantinel Mar 31, 2025
7fe9efc
ci: add simulado tag
RafaelFantinel Apr 1, 2025
0c9628b
ci: add Dockerfile analysis
RafaelFantinel Apr 1, 2025
fa58413
ci: add Trivy workflow
RafaelFantinel Apr 1, 2025
bd65966
ci: update Triby name jobs
RafaelFantinel Apr 1, 2025
d42a305
ci: add run_name
RafaelFantinel Apr 1, 2025
8efc24a
ci: add artifact
RafaelFantinel Apr 1, 2025
474365d
ci: remove run_name
RafaelFantinel Apr 1, 2025
a2f6ad3
ci: remove artifact
RafaelFantinel Apr 1, 2025
886618a
cI: remove syncronized trigger
RafaelFantinel Apr 1, 2025
4665da1
ci: add needs tests job push Dockerhub
RafaelFantinel Apr 1, 2025
8ffdc24
ci: add synchronize and edited trigger
RafaelFantinel Apr 1, 2025
a0457ff
ci: adjust trivy-action version
RafaelFantinel Apr 1, 2025
b4c0439
ci: edit dockerfile to use json CMD
RafaelFantinel Apr 1, 2025
829dcfe
ci: remove ci-main and release
RafaelFantinel Apr 1, 2025
e3274d4
ci: add run-name
RafaelFantinel Apr 1, 2025
455f762
ci: remove run-name
RafaelFantinel Apr 1, 2025
786c69a
ci: remove edited trigger
RafaelFantinel Apr 1, 2025
31594d2
ci: workflow_dispatch
RafaelFantinel Apr 1, 2025
29f30ba
ci: push image dockerhub only merge pull-request in develop
RafaelFantinel Apr 5, 2025
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
120 changes: 120 additions & 0 deletions .github/workflows/ci-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: CI

on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
branches:
- develop

concurrency:
group: ci-${{ github.event.pull_request.title || github.ref_name }}
cancel-in-progress: true

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache Yarn Modules
uses: actions/cache@v3
with:
path: ~/.yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- uses: actions/setup-node@v4
with:
node-version: 20.x

- run: yarn
- run: yarn build
- run: yarn test

lint-styles:
name: Lint Styles
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache Yarn Modules
uses: actions/cache@v3
with:
path: ~/.yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- uses: actions/setup-node@v4
with:
node-version: 20.x

- run: yarn
- run: yarn lint

push-image-dockerhub:
name: Push Image DockerHub
runs-on: ubuntu-latest
needs: [lint-styles, tests]
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Em que momento essa condição será verdadeira?

Analisando o tipo de trigger configurado:
pull_request:
types: [opened, reopened, synchronize]
branches:
- develop

Me parece que a lógica está inconsistente.

considerar adicionar o closed na trigger. [opened, reopened, synchronize, closed]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Yarn Modules
uses: actions/cache@v3
with:
path: ~/.yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: yarn

- name: Build app vCnafacul
run: yarn build

- name: Dockerfile analysis
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: ms.dockerfile

- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
file: ms.dockerfile
push: true
tags: |
vcnafacul/simulado:v${{ github.run_number }}
vcnafacul/simulado:latest

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: 'image'
image-ref: vcnafacul/simulado:v${{ github.run_number }}
format: 'sarif'
output: 'trivy-docker-result.sarif'
severity: 'CRITICAL, HIGH'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
category: docker-result
sarif_file: trivy-docker-result.sarif
fail_on_error: true
46 changes: 0 additions & 46 deletions .github/workflows/develop.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/main.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ lerna-debug.log*
!.vscode/launch.json
!.vscode/extensions.json

.env
.env
package-lock.json
2 changes: 1 addition & 1 deletion ms.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ ENV NODE_ENV=$NODE_ENV

RUN yarn install --production && yarn cache clean

CMD ./node_modules/pm2/bin/pm2-runtime main.js --name msSimulado
CMD ["./node_modules/pm2/bin/pm2-runtime", "main.js", "--name", "msSimulado"]
Loading