diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 0000000..c823011 --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,58 @@ +name: CD + +on: + push: + branches: [ "main" ] + + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +jobs: + CD: + runs-on: ubuntu-latest + + steps: + + - name: Checkout repository + uses: actions/checkout@v3 + + + - name: Set up Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + + + - name: Install dependencies + run: npm install + + + - name: Run the tests + run: npm run test -- --coverage + env: + CI: true + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Build the application + run: npm run build + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: 'build' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..1ca5485 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,40 @@ +# Nome do fluxo +name: CI + +# Aciona o fluxo quando: +on: + # Houver um pull + pull_request: + branches: [ "main" ] + # Permite a execução manual + workflow_dispatch: + +# Fluxo de trabalho +jobs: + CI: + runs-on: ubuntu-latest + + # Passos do fluxo de trabalho + steps: + + - name: Checkout do repositório + uses: actions/checkout@v3 + + - name: Preparando Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + + - name: Instalando dependências + run: npm install + + - name: Executando testes + run: npm run test -- --coverage + env: + CI: true + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..bc5a52a --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,9 @@ +sonar.organization=guilherme-nunes +sonar.projectKey=GONunes_pre-hackathon-devops +sonar.sources=. +sonar.language=js,jsx,ts,tsx +sonar.javascript.file.suffixes=.js,.jsx +sonar.typescript.file.suffixes=.ts,.tsx +sonar.sourceEncoding=UTF-8 +sonar.javascript.lcov.reportPaths=./coverage/lcov.info +sonar.exclusions=**/*.test.* diff --git a/src/App.js b/src/App.js index 82ce5b9..2be6bd6 100644 --- a/src/App.js +++ b/src/App.js @@ -7,7 +7,7 @@ function App() {
logo

- DevOps Básico IT Talent - Mudanças aula 26-04-2023 + DevOps Básico IT Talent - Mudanças hackathon 17-05-2023 teste 3