diff --git a/.github/workflows/diff_length.yml b/.github/workflows/diff_length.yml deleted file mode 100644 index 49db8c13b..000000000 --- a/.github/workflows/diff_length.yml +++ /dev/null @@ -1,34 +0,0 @@ -# .github/workflows/large-diffs.yml -name: Large Diffs - -on: - pull_request: - types: [opened, edited] - -jobs: - check-diff-size: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - - name: Install dependencies - run: pip install requests - - - name: Check diff size - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - PR_NUMBER=$(echo "${{ github.event.pull_request.url }}" | cut -d/ -f7) - DIFF=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER.diff") - LINES=$(echo "$DIFF" | wc -l) - if [ $LINES -gt 1000 ]; then - MESSAGE=":warning: Large diff detected ($LINES lines). Would recommend splitting your PR into smaller chunks if possible" - URL=$(echo "${{ github.event.pull_request.url }}" | cut -d/ -f5-7) - curl -H "Authorization: token $GITHUB_TOKEN" -X POST -d "{\"body\": \"$MESSAGE\"}" "https://api.github.com/repos/$URL/issues/$PR_NUMBER/comments" - fi diff --git a/.github/workflows/eks.yml b/.github/workflows/eks.yml deleted file mode 100644 index 75f7ee131..000000000 --- a/.github/workflows/eks.yml +++ /dev/null @@ -1,101 +0,0 @@ -# This workflow will build and push a new container image to Amazon ECR, -# and then will deploy a new task definition to Amazon ECS, when there is a push to the "main" branch. -# -# To use this workflow, you will need to complete the following set-up steps: -# -# 1. Create an ECR repository to store your images. -# For example: `aws ecr create-repository --repository-name my-ecr-repo --region us-east-2`. -# Replace the value of the `ECR_REPOSITORY` environment variable in the workflow below with your repository's name. -# Replace the value of the `AWS_REGION` environment variable in the workflow below with your repository's region. -# -# 2. Create an ECS task definition, an ECS cluster, and an ECS service. -# For example, follow the Getting Started guide on the ECS console: -# https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun -# Replace the value of the `ECS_SERVICE` environment variable in the workflow below with the name you set for the Amazon ECS service. -# Replace the value of the `ECS_CLUSTER` environment variable in the workflow below with the name you set for the cluster. -# -# 3. Store your ECS task definition as a JSON file in your repository. -# The format should follow the output of `aws ecs register-task-definition --generate-cli-skeleton`. -# Replace the value of the `ECS_TASK_DEFINITION` environment variable in the workflow below with the path to the JSON file. -# Replace the value of the `CONTAINER_NAME` environment variable in the workflow below with the name of the container -# in the `containerDefinitions` section of the task definition. -# -# 4. Store an IAM user access key in GitHub Actions secrets named `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. -# See the documentation for each action used below for the recommended IAM policies for this IAM user, -# and best practices on handling the access key credentials. - -name: Push image to Amazon ECR - -# Only trigger, when we push to prod-deploy -on: - push: - branches: - - "prod-deploy" - -env: - AWS_REGION: "us-west-2" # set this to your preferred AWS region, e.g. us-west-1 - ECR_REPOSITORY: "deep-learning-playground" # set this to your Amazon ECR repository name - ECS_SERVICE: "deep-learning-playground-service" # set this to your Amazon ECS service name - ECS_CLUSTER: "deep-learning-playground" # set this to your Amazon ECS cluster name - ECS_TASK_DEFINITION: - ".aws/task-definition.json" # set this to the path to your Amazon ECS task definition - # file, e.g. .aws/task-definition.json - CONTAINER_NAME: - "deep-learning-playground-container" # set this to the name of the container in the - # containerDefinitions section of your task definition - -permissions: - contents: read - actions: write - -jobs: - deploy: - name: Deploy - runs-on: ubuntu-latest - environment: production - steps: - - name: Get current branch - run: echo running on branch ${GITHUB_REF##*/} - - - name: Wait for tests to succeed - if: ${{ github.ref }} = "refs/heads/prod-deploy" - uses: lewagon/wait-on-check-action@v1.1.1 - with: - ref: ${{ github.sha }} - check-name: "build-linux" - repo-token: ${{ secrets.PAT }} - allowed-conclusions: success,skipped - verbose: true - wait-interval: 10 - - - name: Checkout - uses: actions/checkout@v3 - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_DEPLOY_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_DEPLOY_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, tag, and push image to Amazon ECR - id: build-image - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ github.sha }} - run: | - # Build a docker container and - # push it to ECR so that it can - # be deployed to ECS. - - aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 521654603461.dkr.ecr.us-west-2.amazonaws.com - - docker build -t $IMAGE_TAG --build-arg TARGETARCH="x86" --build-arg AWS_REGION=${{ secrets.AWS_REGION }} --build-arg AWS_DEPLOY_ACCESS_KEY_ID=${{ secrets.AWS_DEPLOY_ACCESS_KEY_ID }} --build-arg AWS_DEPLOY_SECRET_ACCESS_KEY=${{ secrets.AWS_DEPLOY_SECRET_ACCESS_KEY }} . - - docker tag $IMAGE_TAG 521654603461.dkr.ecr.us-west-2.amazonaws.com/dlp-eks-container:latest - - docker push 521654603461.dkr.ecr.us-west-2.amazonaws.com/dlp-eks-container:latest diff --git a/.github/workflows/railway-deploy.yml b/.github/workflows/railway-deploy.yml deleted file mode 100644 index c557db6b0..000000000 --- a/.github/workflows/railway-deploy.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Deploy to Railway -on: - pull_request: - types: [labeled] - workflow_dispatch: - inputs: - environment: - description: 'Deployment environment' - required: true - default: 'Development' - type: choice - options: - - Development - - Preview - -jobs: - check_trigger: - runs-on: ubuntu-latest - steps: - - name: Check label or branch - id: check - run: echo ::set-output name=to_run::${{ ((github.event.label.name == 'deploy') || (github.event_name == 'workflow_dispatch')) && 'True' || 'False' }} - outputs: - status: ${{ steps.check.outputs.to_run }} - - deploy: - runs-on: ubuntu-latest - needs: check_trigger - if: needs.check_trigger.outputs.status == 'True' - steps: - - uses: actions/checkout@v3 - - - name: Set Environment - id: environment - run: echo ::set-output name=environment::${{ github.event.label.name == 'deploy' && 'Development' || inputs.environment }} - - - name: Remove Label - uses: andymckay/labeler@master - with: - remove-labels: 'deploy' - - - name: Set Railway Token and Link - id: railway_config - run: | - echo ::set-output name=token::${{ steps.environment.outputs.environment == 'Development' && secrets.RAILWAY_TOKEN_DEV || secrets.RAILWAY_TOKEN_PREV }} - echo ::set-output name=link::${{ steps.environment.outputs.environment == 'Development' && 'https://deep-learning-playground-development.up.railway.app/' || 'https://deep-learning-playground-preview.up.railway.app/' }} - - - name: Display Inputs - run: | - echo "\ - Github Ref: ${{ github.ref }} \ - Github Event: ${{ github.event_name }} \ - Environment: ${{ steps.environment.outputs.environment }} \ - " - - - name: Use Node 16 - uses: actions/setup-node@v3.4.1 - with: - node-version: 16 - - - name: Install Railway - run: npm i -g @railway/cli - - - name: Create GitHub Deployment - uses: chrnorm/deployment-action@releases/v1 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - environment: ${{ steps.environment.outputs.environment }} - - - name: Railway Deploy - run: | - echo "Starting Railway Deployment" - railway up -e ${{ steps.environment.outputs.environment }} - echo "Deployment Complete. View at ${{ steps.railway_config.outputs.link }}" - env: - RAILWAY_TOKEN: ${{ steps.railway_config.outputs.token }} - - - name: Update Deployment Status (success) - if: success() - uses: chrnorm/deployment-status@releases/v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - environment_url: ${{ steps.railway_config.outputs.link }} - state: "success" - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Comment Deployment on PR - if: success() && (github.event_name == 'pull_request') - uses: thollander/actions-comment-pull-request@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - message: ${{ format('Deployment Live at {0}', steps.railway_config.outputs.link) }} - - - name: Update Deployment Status (failure) - if: failure() - uses: chrnorm/deployment-status@releases/v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - state: "failure" - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - -