From 399de8f9a917754daff16f55e2a5f19305c28b99 Mon Sep 17 00:00:00 2001 From: Wellington Menezes Date: Wed, 17 May 2023 20:20:38 -0300 Subject: [PATCH 1/2] estrutura inicial pipeline pre-hackathon --- .github/workflows/cd.yml | 12 +++++++++++ .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..e72e859 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,12 @@ +name: "CD" + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + tests: + uses: ./.github/workflows/ci.yml + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..943fc6b --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 From 93062f368afcd6ec27dc9e60fcb3986cf8832d4b Mon Sep 17 00:00:00 2001 From: Lucas Aragao Alves da Costa <30377854+lucasarags@users.noreply.github.com> Date: Wed, 17 May 2023 20:54:21 -0300 Subject: [PATCH 2/2] Update cd.yml CD --- .github/workflows/cd.yml | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e72e859..c969271 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,4 @@ -name: "CD" +name: CD on: push: @@ -8,5 +8,34 @@ on: jobs: tests: - uses: ./.github/workflows/ci.yml - secrets: inherit + 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