Remove old playwright workflow #4
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] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps | |
| - 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 --grep-invert "S3 Reports" | |
| continue-on-error: false | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: test-results/ | |
| retention-days: 30 | |
| if-no-files-found: warn | |
| deploy-lambda: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && success() | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| 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 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Deploy Lambda Clima | |
| run: | | |
| if [ -d "lambda" ] && [ -f "lambda/index.js" ]; then | |
| cd lambda | |
| npm install --production --ignore-scripts | |
| zip -r clima.zip index.js node_modules/ package.json || true | |
| if [ -f "clima.zip" ]; then | |
| aws lambda update-function-code \ | |
| --function-name Clima \ | |
| --zip-file fileb://clima.zip \ | |
| --region us-east-1 || echo "⚠️ Lambda Clima deployment failed" | |
| echo "✅ Lambda Clima deployed" | |
| fi | |
| else | |
| echo "⚠️ lambda/index.js not found" | |
| fi | |
| - name: Deploy Lambda API Gateway | |
| run: | | |
| if [ -d "lambda" ] && [ -f "lambda/apiGatewayHandler.js" ]; then | |
| cd lambda | |
| zip -r api.zip apiGatewayHandler.js node_modules/ package.json || true | |
| if [ -f "api.zip" ]; then | |
| aws lambda update-function-code \ | |
| --function-name apiGatewayClima \ | |
| --zip-file fileb://api.zip \ | |
| --region us-east-1 || echo "⚠️ Lambda API Gateway deployment failed" | |
| echo "✅ Lambda API Gateway deployed" | |
| fi | |
| else | |
| echo "⚠️ lambda/apiGatewayHandler.js not found" | |
| fi |