Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
iaanimashaun committed Jan 4, 2024
1 parent bbf0e68 commit d040f75
Show file tree
Hide file tree
Showing 25 changed files with 311 additions and 417 deletions.
1 change: 1 addition & 0 deletions .github/workflows/01-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- dev

jobs:
lint:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/02-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- dev

workflow_run:
workflows: ["Lint"]
types:
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/03-publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: Build and Publish Hailstone Calculator Package
on:
push:
branches:
- main
# paths:
# - 'src/hailstone_calculator/**'
- dev

workflow_run:
workflows: ["Test"]
types:
Expand All @@ -22,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x # Replace with desired Python version
python-version: 3.x

- name: Install dependencies
run: pip install twine setuptools
Expand All @@ -31,16 +30,6 @@ jobs:
run: |
cd src
python setup.py sdist
# - name: Upload
# run: |
# twine upload dist/* -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }}
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
# working-directory: src



- name: Upload package to Nexus Repository
Expand Down
74 changes: 3 additions & 71 deletions .github/workflows/04-build-push-docker.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,10 @@

# name: Build and Push Docker Images

# on:
# push:
# # paths:
# # - 'infra/aws/lambda/hailstone/**' # Watch for changes in the hailstone lambda function path
# branches:
# - main
# workflow_run:
# workflows: ["Build and Publish Hailstone Calculator Package"]
# types:
# - completed


# jobs:
# build_and_push_images:

# env:
# FUNCTION_PATH: 'infra/aws/lambda/hailstone'
# FUNCTION_NAME: 'hailstone_function'
# AWS_REGION: us-east-1
# AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

# runs-on: ubuntu-latest

# steps:
# - name: Checkout Repository
# uses: actions/checkout@v2

# - name: Set Up AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: $AWS_ACCESS_KEY_ID
# aws-secret-access-key: $AWS_SECRET_ACCESS_KEY
# aws-region: us-east-1


# - name: Check for changes in the function path
# id: check_changes
# run: |
# if [ -n "$(git diff --name-only $FUNCTION_PATH)" ]; then
# echo "changes=true" >> $GITHUB_ENV
# fi

# echo "changes is: '${{ env.changes }}'"

# - name: Set up Environment File
# run: echo "${{ secrets.ENV_FILE }}" > .env

# - name: Build and Push Docker Image for Lambda Function
# if: ${{ env.changes }} == 'true'
# run: |
# cd $FUNCTION_PATH
# make build_push
# env:
# AWS_ACCOUNT_ID: $AWS_ACCOUNT_ID
# AWS_REGION: $AWS_REGION
# DOCKER_IMAGE_NAME: $FUNCTION_NAME
# DOCKER_IMAGE_TAG: latest
# AWS_ECR_REPO_NAME: $FUNCTION_NAME
# AWS_ECR_REPO_URI: $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$FUNCTION_NAME





name: Build and Push Docker Image

on:
push:
branches:
- main
- dev
workflow_run:
workflows: ["Build and Publish Hailstone Calculator Package"]
types:
Expand All @@ -91,8 +23,8 @@ jobs:
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1 # Update with your AWS region
aws-region: us-east-1

- name: Set up Environment File
run: echo "${{ secrets.ENV_FILE }}" > .env

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/05-terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }} # Replace with your AWS region for dev
aws-region: ${{ secrets.AWS_REGION }}
- name: Deploy to Pre-Prod
run: |
# Use the configuration file from the repository
Expand All @@ -38,7 +38,7 @@ jobs:
terraform workspace select pre_prod
terraform apply -auto-approve
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} # Replace with your AWS region for pre-prod
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Expand All @@ -65,7 +65,7 @@ jobs:
runs-on: ubuntu-latest

needs: manual_approval
if: github.ref == 'refs/heads/main' # && needs.manual-approval.outputs.approval_granted == 'true'
if: github.ref == 'refs/heads/main'
steps:

- name: Deploy to Prod
Expand All @@ -81,6 +81,6 @@ jobs:
terraform workspace select prod
terraform apply -auto-approve
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} # Replace with your AWS region for prod
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
31 changes: 0 additions & 31 deletions .pre-commit-config.yaml

This file was deleted.

12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Dockerfile for building a Python application image

# Dockerfile
# Use an official Python runtime as a base image
FROM python:3.10-slim

# Set the working directory inside the container to /app/
WORKDIR /app/

# COPY src/hailstone_calculator/ .
# Copy the current directory contents into the container at /app/
COPY . /app

# Copy requirements file to the working directory
COPY requirements/requirements.txt .

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# ENTRYPOINT ["sleep", "120"]

# Set the default command to run when the container starts
CMD ["python", "src/main.py"]

Loading

0 comments on commit d040f75

Please sign in to comment.