Skip to content

Commit

Permalink
Merge pull request #577 from communitiesuk/testing_cleanup
Browse files Browse the repository at this point in the history
Testing cleanup
  • Loading branch information
aamircodes authored Mar 4, 2024
2 parents d20b850 + fe642f2 commit eecda74
Show file tree
Hide file tree
Showing 23 changed files with 216 additions and 497 deletions.
21 changes: 21 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
RAILS_ENV=development
INSTANCE_NAME=ukraine-sponsor-resettlement-development
DB_HOST=localhost
DB_USERNAME=ukraine
DB_DATABASE=ukraine_test
DB_PASSWORD=password
REDIS_URL=redis://0.0.0.0:6379
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
AWS_BUCKET_NAME=test-bucket
AWS_REGION=eu-west-2
REMOTE_API_URL=http://mock-api:8081/data
BASIC_AUTH_PASS=password
UAM_GA4_TRACKING_CODE=G-ZT5Q8BV3ZK
EOI_GA4_TRACKING_CODE=G-W9KQ85GQM4
INDIVIDUAL_CONFIRMATION_TEMPLATE_ID=6c80930d-e25a-4dc6-8383-bb83a2c18d19
ORGANISATION_CONFIRMATION_TEMPLATE_ID=3ae2501f-e2be-4ad6-886b-fcf5aa71d448
ADDITIONAL_INFO_CONFIRMATION_TEMPLATE_ID=5b79f75e-fff3-4585-a438-d59966b86dd9
SPONSOR_CONFIRMATION_TEMPLATE_ID=f2a29524-be50-4fc5-9088-35daf4c66c43
SAVE_AND_RETURN_TEMPLATE_ID=856b0664-1f96-463c-8acd-c4ef782cdcad
GOVUK_NOTIFY_API_KEY=test
13 changes: 13 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
RAILS_ENV=test
INSTANCE_NAME=ukraine-sponsor-resettlement-test
DB_HOST=localhost
DB_USERNAME=ukraine
DB_DATABASE=ukraine_test
DB_PASSWORD=password
REDIS_URL=redis://redis
AWS_ACCESS_KEY_ID=test
AWS_SECRET_ACCESS_KEY=test
AWS_BUCKET_NAME=test-bucket
AWS_REGION=eu-west-2
REMOTE_API_URL=http://mock-api:8081/data
GOVUK_NOTIFY_API_KEY=test
145 changes: 1 addition & 144 deletions .github/workflows/deploy-aws-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
name: Deploy to Amazon ECS PRODUCTION

on:
# pull_request:
# push:
# branches:
# - master
workflow_dispatch:
inputs:
refToDeploy:
Expand All @@ -37,149 +33,10 @@ env:
# containerDefinitions section of your task definition

jobs:
# test:
# name: Test
# runs-on: ubuntu-latest

# services:
# postgres:
# image: postgres:13.5
# env:
# POSTGRES_PASSWORD: password
# POSTGRES_USER: ukraine
# POSTGRES_DB: ukraine
# ports:
# - 5432:5432
# # needed because the postgres container does not provide a healthcheck
# # tmpfs makes DB faster by using RAM
# options: >-
# --mount type=tmpfs,destination=/var/lib/postgresql/data
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# redis:
# # Docker Hub image
# image: redis
# # Set health checks to wait until redis has started
# options: >-
# --health-cmd "redis-cli ping"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5

# env:
# RAILS_ENV: test
# INSTANCE_NAME: ukraine-sponsor-resettlement-test
# VCAP_SERVICES: '{"redis":[{"instance_name":"ukraine-sponsor-resettlement-test-redis","credentials":{"uri":"redis://redis"}}],"aws-s3-bucket":[{"instance_name":"ukraine-sponsor-resettlement-test-s3","credentials":{"aws_access_key_id":"access-key-id","aws_secret_access_key":"secret-access-key","aws_region":"eu-west-2","bucket_name":"test-bucket"}}]}'
# GEMFILE_RUBY_VERSION: 3.1.2
# DB_HOST: localhost
# DB_DATABASE: ukraine
# DB_USERNAME: ukraine
# DB_PASSWORD: password
# GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }}

# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: ${{ inputs.refToDeploy }}

# - name: Set up Ruby
# uses: ruby/setup-ruby@v1
# with:
# # runs 'bundle install' and caches installed gems automatically
# bundler-cache: true
# - name: Set up node
# uses: actions/setup-node@v4
# with:
# node-version: "20"

# - name: Create DB
# run: |
# bundle exec rake db:prepare
# - name: Migrate DB
# run: |
# bundle exec rake db:migrate
# - name: Compile Assets
# run: |
# bundle exec rake assets:precompile
# - name: Run tests
# run: |
# bundle exec rake
# #- name: Test coverage
# # uses: joshmfrankel/simplecov-check-action@main
# # with:
# # github_token: ${{ secrets.GITHUB_TOKEN }}
# # minimum_suite_coverage: 70
# # minimum_file_coverage: 0

# lint:
# name: Lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: ${{ inputs.refToDeploy }}

# - name: Set up Ruby
# uses: ruby/setup-ruby@v1
# with:
# # runs 'bundle install' and caches installed gems automatically
# bundler-cache: true

# - name: Rubocop
# run: |
# bundle exec rubocop

# audit:
# name: Audit dependencies
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: ${{ inputs.refToDeploy }}

# - name: Set up Ruby
# uses: ruby/setup-ruby@v1
# with:
# # runs 'bundle install' and caches installed gems automatically
# bundler-cache: true

# - name: Audit
# run: |
# bundle exec bundler-audit

# brakeman-scan:
# name: Brakeman Scan
# runs-on: ubuntu-latest
# steps:
# # Checkout the repository to the GitHub Actions runner
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: ${{ inputs.refToDeploy }}

# # Customize the ruby version depending on your needs
# - name: Setup Ruby
# uses: ruby/setup-ruby@v1

# - name: Setup Brakeman
# run: |
# gem install brakeman

# # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
# - name: Scan
# run: |
# brakeman --color -o /dev/stdout

deploy:
name: Deploy
runs-on: ubuntu-latest
environment: aws-production
# needs: [lint, test, audit, brakeman-scan]

steps:
- name: Checkout
Expand All @@ -206,7 +63,7 @@ jobs:
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile-prod .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/deploy-aws-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
postgres:
image: postgres:13.5
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: ukraine_test
POSTGRES_USER: ukraine
POSTGRES_DB: ukraine
POSTGRES_PASSWORD: password
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
Expand All @@ -69,7 +69,7 @@ jobs:
VCAP_SERVICES: '{"redis":[{"instance_name":"ukraine-sponsor-resettlement-test-redis","credentials":{"uri":"redis://redis"}}],"aws-s3-bucket":[{"instance_name":"ukraine-sponsor-resettlement-test-s3","credentials":{"aws_access_key_id":"access-key-id","aws_secret_access_key":"secret-access-key","aws_region":"eu-west-2","bucket_name":"test-bucket"}}]}'
GEMFILE_RUBY_VERSION: 3.1.4
DB_HOST: localhost
DB_DATABASE: ukraine
DB_DATABASE: ukraine_test
DB_USERNAME: ukraine
DB_PASSWORD: password
GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }}
Expand Down Expand Up @@ -102,12 +102,6 @@ jobs:
- name: Run tests
run: |
bundle exec rake
#- name: Test coverage
# uses: joshmfrankel/simplecov-check-action@main
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# minimum_suite_coverage: 70
# minimum_file_coverage: 0
lint:
name: Lint
Expand Down Expand Up @@ -201,7 +195,7 @@ jobs:
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile-prod .
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ config/master.key
# dotenv, dotenv-rails
# TODO Comment out these rules if environment variables can be committed
.env
.env*.local

## Environment normalization:
/.bundle
Expand Down
File renamed without changes.
28 changes: 0 additions & 28 deletions Dockerfile-dev

This file was deleted.

Loading

0 comments on commit eecda74

Please sign in to comment.