Remove duplicate JSON.parse #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test & Deploy to AWS | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright | |
| run: npx playwright install --with-deps chromium | |
| - name: Run tests | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: us-east-1 | |
| SQS_URL: ${{ secrets.SQS_URL }} | |
| SQS_RESULTADO_URL: ${{ secrets.SQS_RESULTADO_URL }} | |
| SQS_DLQ_URL: ${{ secrets.SQS_DLQ_URL }} | |
| OPENWEATHER_API_KEY: ${{ secrets.OPENWEATHER_API_KEY }} | |
| API_GATEWAY_URL: ${{ secrets.API_GATEWAY_URL }} | |
| run: npx playwright test --project=chromium --grep-invert "S3 Reports|CloudWatch muestra métricas" --retries=2 | |
| deploy-lambda: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Deploy Lambdas | |
| run: | | |
| if [ -d "lambda" ]; then | |
| cd lambda | |
| npm install --production | |
| # Lambda Clima | |
| if [ -f "index.js" ]; then | |
| zip -r clima.zip index.js node_modules/ | |
| aws lambda update-function-code --function-name Clima --zip-file fileb://clima.zip || true | |
| fi | |
| # Lambda API Gateway | |
| if [ -f "apiGatewayHandler.js" ]; then | |
| zip -r api.zip apiGatewayHandler.js node_modules/ | |
| aws lambda update-function-code --function-name apiGatewayClima --zip-file fileb://api.zip || true | |
| fi | |
| fi |