Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CD

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Run CI
uses: ./.github/workflows/ci.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy:
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Download artifact
uses: actions/download-artifact@v2
with:
name: build
path: build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Testes"

on:
workflow_call:

permissions:
contents: read
pages: write
id-token: write

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Instalação Nodejs
uses: actions/setup-node@v3
with:
node-version: 16

- name: Instalação das dependências
run: npm install

- name: Executando Testes
run: npm run test

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=ligtonribeiro
-Dsonar.projectKey=ligtonribeiro_express-api-example
-Dorganization-key=ligtonribeiro
-Dsonar.sources=src
-Dsonar.language=js,ts
-Dsonar.javascript.file.suffixes=.js
-Dsonar.typescript.file.suffixes=.ts
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
-Dsonar.sourceEncoding=UTF-8