-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/esteiras GitHub actions #98
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
Open
RafaelFantinel
wants to merge
28
commits into
develop
Choose a base branch
from
feature/esteiras-github-actions
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 3418a47
ci: create develop workflow
RafaelFantinel cedd0af
ci: adjust package.json scripts
RafaelFantinel 36e0fbb
ci: add run build
RafaelFantinel 3cf5130
ci: remove cache docker push image dockerhub
RafaelFantinel fe9ddb0
ci: remove buildx
RafaelFantinel 55719e6
ci: add npm build and install
RafaelFantinel a0b7666
remove report.txt
RafaelFantinel 260271e
ci: change npm commands by yarn
RafaelFantinel 7fe9efc
ci: add simulado tag
RafaelFantinel 0c9628b
ci: add Dockerfile analysis
RafaelFantinel fa58413
ci: add Trivy workflow
RafaelFantinel bd65966
ci: update Triby name jobs
RafaelFantinel d42a305
ci: add run_name
RafaelFantinel 8efc24a
ci: add artifact
RafaelFantinel 474365d
ci: remove run_name
RafaelFantinel a2f6ad3
ci: remove artifact
RafaelFantinel 886618a
cI: remove syncronized trigger
RafaelFantinel 4665da1
ci: add needs tests job push Dockerhub
RafaelFantinel 8ffdc24
ci: add synchronize and edited trigger
RafaelFantinel a0457ff
ci: adjust trivy-action version
RafaelFantinel b4c0439
ci: edit dockerfile to use json CMD
RafaelFantinel 829dcfe
ci: remove ci-main and release
RafaelFantinel e3274d4
ci: add run-name
RafaelFantinel 455f762
ci: remove run-name
RafaelFantinel 786c69a
ci: remove edited trigger
RafaelFantinel 31594d2
ci: workflow_dispatch
RafaelFantinel 29f30ba
ci: push image dockerhub only merge pull-request in develop
RafaelFantinel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | ||
| 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 | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,4 +34,5 @@ lerna-debug.log* | |
| !.vscode/launch.json | ||
| !.vscode/extensions.json | ||
|
|
||
| .env | ||
| .env | ||
| package-lock.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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]