diff --git a/.github/workflows/AWS.yml b/.github/workflows/AWS.yml new file mode 100644 index 0000000..29f92c9 --- /dev/null +++ b/.github/workflows/AWS.yml @@ -0,0 +1,36 @@ +Resources: + MyBucket: + Type: 'AWS::S3::Bucket' + Properties: + BucketName: my-application-bucket + + MyElasticBeanstalkApplication: + Type: 'AWS::ElasticBeanstalk::Application' + Properties: + ApplicationName: my-application + + MyElasticBeanstalkEnvironment: + Type: 'AWS::ElasticBeanstalk::Environment' + Properties: + ApplicationName: !Ref MyElasticBeanstalkApplication + SolutionStackName: 64bit Amazon Linux 2018.03 v2.11.4 running Python 3.6 + + MyEKSCluster: + Type: 'AWS::EKS::Cluster' + Properties: + Name: my-eks-cluster + RoleArn: !GetAtt MyEKSClusterRole.Arn + Version: '1.20' + ResourcesVpcConfig: + SubnetIds: + - subnet-abcde012 + - subnet-bcde012a + - subnet-fghi345a + SecurityGroupIds: + - sg-abcde012 + + Resources: + MyCustomResource: + Type: 'Custom::MyCustomResource' + Properties: + ServiceToken: arn:aws:lambda:us-west-2:123456789012:function:my-function \ No newline at end of file diff --git a/.github/workflows/Automated_Tests.yml b/.github/workflows/Automated_Tests.yml new file mode 100644 index 0000000..ea15d69 --- /dev/null +++ b/.github/workflows/Automated_Tests.yml @@ -0,0 +1,28 @@ +name: Run Automated Tests + +on: + push: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run tests + run: | + python -m unittest discover -s tests \ No newline at end of file diff --git a/.github/workflows/Pip_Update.yml b/.github/workflows/Pip_Update.yml new file mode 100644 index 0000000..2b78a76 --- /dev/null +++ b/.github/workflows/Pip_Update.yml @@ -0,0 +1,34 @@ +name: Update Dependencies + +on: + push: + branches: + - master + +jobs: + update_dependencies: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install and update Python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt --upgrade + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install and update JavaScript dependencies + run: | + npm install + npm update diff --git a/.github/workflows/Production.yml b/.github/workflows/Production.yml new file mode 100644 index 0000000..e6c3bf6 --- /dev/null +++ b/.github/workflows/Production.yml @@ -0,0 +1,86 @@ +name: CI/CD Pipeline + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: your-docker-username/quantum-genetic-algorithm:latest + + - name: Set up Kubectl + uses: azure/setup-kubectl@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: us-west-2 + + - name: Install AWS IAM Authenticator + run: | + curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.18.9/2020-09-18/bin/linux/amd64/aws-iam-authenticator + chmod +x ./aws-iam-authenticator + sudo mv aws-iam-authenticator /usr/local/bin + + - name: Connect to EKS cluster + run: | + aws eks --region us-west-2 update-kubeconfig --name your-eks-cluster-name + + - name: Deploy to EKS + run: | + kubectl apply -f - <