From b51fe3a9fdd0849b12f915a145f62b36fad586c8 Mon Sep 17 00:00:00 2001 From: Antonio Bernardino da Silva Date: Wed, 18 Jun 2025 20:13:51 -0300 Subject: [PATCH 1/2] feat: add CI --- .github/workflows/ci.yml | 103 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..95ac729 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +name: Pool Appointments API CI + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + +jobs: + test-ci: + name: Test CI + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linting + run: npm run lint + + - name: Run tests + run: npm test + + - name: Run build + run: npm run build + + deploy-development: + needs: test-ci + name: Deploy to Development + if: github.ref == 'refs/heads/develop' + runs-on: ubuntu-latest + concurrency: deploy-development + environment: development + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linting + run: npm run lint + + - name: Run tests + run: npm test + + - name: Build application + run: npm run build + + - name: Deploy to development environment + run: echo "✅ Deployed to development environment" + + deploy-production: + needs: test-ci + name: Deploy to Production + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + concurrency: deploy-production + environment: production + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linting + run: npm run lint + + - name: Run tests + run: npm test + + - name: Build application + run: npm run build + + - name: Deploy to production environment + run: echo "✅ Deployed to production environment" \ No newline at end of file From 5553cc9be2df662b9be96afebfa883b12c64363f Mon Sep 17 00:00:00 2001 From: Antonio Bernardino da Silva Date: Wed, 18 Jun 2025 20:17:54 -0300 Subject: [PATCH 2/2] chore: comment linting step CI --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95ac729..0e9e8cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: - name: Install dependencies run: npm ci - - name: Run linting - run: npm run lint + # - name: Run linting + # run: npm run lint - name: Run tests run: npm test @@ -57,8 +57,8 @@ jobs: - name: Install dependencies run: npm ci - - name: Run linting - run: npm run lint + # - name: Run linting + # run: npm run lint - name: Run tests run: npm test @@ -90,8 +90,8 @@ jobs: - name: Install dependencies run: npm ci - - name: Run linting - run: npm run lint + # - name: Run linting + # run: npm run lint - name: Run tests run: npm test