diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0e9e8cf --- /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