-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from antowaddle/addDeploySiteandPlaywrightTests
Github Action Update Test 1
- Loading branch information
Showing
2 changed files
with
69 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,42 +7,60 @@ on: | |
branches: [ main ] | ||
|
||
jobs: | ||
unit-tests: | ||
build-and-deploy-infra: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: [3.8, 3.9] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
python-version: 3.9 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install boto3 botocore pytest | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-west-1 | ||
|
||
- name: Run tests | ||
- name: Setup SAM CLI | ||
uses: aws-actions/setup-sam@v1 | ||
|
||
- name: Run sam build | ||
run: sam build | ||
|
||
- name: Run sam deploy | ||
run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset | ||
|
||
- name: Debug Environment Variables | ||
run: env | grep AWS | ||
|
||
- name: Configure AWS credentials for S3 Sync | ||
run: | | ||
pytest tests/unit/test_lambda_functions.py | ||
mkdir -p ~/.aws | ||
echo "[default]" > ~/.aws/credentials | ||
echo "aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials | ||
echo "aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials | ||
echo "[default]" > ~/.aws/config | ||
echo "region = eu-west-1" >> ~/.aws/config | ||
- name: Debug secrets | ||
run: | | ||
echo "AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}" | ||
echo "AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}" | ||
- name: Sync resume-site to S3 | ||
uses: jakejarvis/[email protected] | ||
with: | ||
args: --acl public-read --follow-symlinks --delete | ||
env: | ||
SOURCE_DIR: 'resume-site' | ||
AWS_S3_BUCKET: 'recreated-website2351' | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: eu-west-1 | ||
|
||
build-and-deploy-infra: | ||
needs: unit-tests | ||
playwright-tests: | ||
needs: build-and-deploy-infra | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.9] # Ensure this job only runs with Python 3.9 | ||
|
||
steps: | ||
- name: Checkout code | ||
|
@@ -51,38 +69,15 @@ jobs: | |
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
python-version: 3.9 | ||
|
||
- name: Ensure Python 3.9 is on PATH | ||
run: | | ||
echo "Adding Python 3.9 to PATH" | ||
echo "${{ steps.python-setup.outputs.python-location }}/bin" >> $GITHUB_PATH | ||
- name: Verify Python version | ||
run: | | ||
python --version | ||
which python | ||
- name: Setup SAM CLI | ||
uses: aws-actions/setup-sam@v1 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-west-1 | ||
|
||
- name: Run sam build | ||
- name: Install dependencies | ||
run: | | ||
sam build | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install pytest-playwright | ||
playwright install | ||
- name: Run sam deploy | ||
- name: Run Playwright tests | ||
run: | | ||
sam deploy --no-confirm-changeset --no-fail-on-empty-changeset | ||
|
||
|
||
|
||
|
||
pytest -v tests/playwright-tests |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
# Cloud Resume Challenge | ||
# AWS Serverless Application with CI/CD Pipeline - Cloud Resume Challenge | ||
|
||
TODO - add | ||
This is my attempt at the Cloud Resume Challenge https://cloudresumechallenge.dev/docs/the-challenge/aws/ | ||
|
||
## Table of Contents | ||
This repository contains a serverless application built on AWS using Lambda functions, DynamoDB, and integrated with a CI/CD pipeline. It also includes Playwright for end-to-end testing and unit tests for Lambda functions. | ||
|
||
TODO - add | ||
## Benefits of the challenge | ||
## Live Site | ||
https://anthony-coughlin-resume.com/ | ||
|
||
TODO - add | ||
## Challenge stages | ||
## Technologies Used | ||
|
||
### Stage 0-10 | ||
- **AWS Lambda:** Serverless compute service used for executing backend functions without provisioning or managing servers. | ||
|
||
- **AWS DynamoDB:** Fully managed NoSQL database service for storing and retrieving data at scale with low latency. | ||
|
||
- **CI/CD Pipeline:** Automated workflow for Continuous Integration and Continuous Deployment (CI/CD) using GitHub Actions. | ||
|
||
- **Playwright:** End-to-end testing framework for web applications to ensure application quality and reliability. | ||
|
||
- **Unit Tests:** Tests written using Python's `pytest` framework to validate individual Lambda function behavior and logic. | ||
|
||
TODO - add | ||
## CI/CD Pipeline | ||
|
||
The CI/CD pipeline automates the testing, building, and deployment processes: | ||
|
||
- **Unit Tests:** Run against Lambda functions to ensure expected behavior. | ||
|
||
- **Build and Deploy:** Uses AWS SAM CLI to build and deploy Lambda functions and associated AWS resources. The site is also auto deployed and Playwright Tests are executed afterwards. |