Skip to content

Commit

Permalink
Combine the makefiles and delete batect
Browse files Browse the repository at this point in the history
  • Loading branch information
lcard committed May 2, 2024
1 parent b942e84 commit 5bcbe28
Show file tree
Hide file tree
Showing 22 changed files with 228 additions and 870 deletions.
22 changes: 19 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
AWS_ACCOUNT=123456
AWS_REGION=eu-west-2

# API Specific
# API

## Application variables
ALLOWED_EMAIL_DOMAINS=example1.com,example2.com
DATA_BUCKET=the-bucket
RESOURCE_PREFIX=rapid
DOMAIN_NAME=example.com
COGNITO_USER_POOL_ID=11111111
LAYERS=raw,layer
CUSTOM_USER_NAME_REGEX="regex_expression"
# SDK Specific

## Build variables
ECS_SERVICE=rapid-ecs-service
ECS_CLUSTER=rapid-cluster
API_IMAGE_NAME=rapid

# SDK

RAPID_CLIENT_ID=
RAPID_CLIENT_SECRET=
RAPID_URL=
# UI Specific

# UI

## Application variables
NEXT_PUBLIC_API_URL=
NEXT_PUBLIC_API_URL_PROXY=

## Build variables
UI_IMAGE_NAME=rapid-image


# UI Specific for integration tests
DOMAIN=
RESOURCE_PREFIX=
5 changes: 5 additions & 0 deletions .github/.github.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ LAYERS=raw,layer
DOMAIN_NAME=example.com
DATA_BUCKET=the-bucket
CUSTOM_USER_NAME_REGEX=[a-zA-Z][a-zA-Z0-9@._-]{2,127}

ECS_SERVICE=rapid-preprod-ecs-service
ECS_CLUSTER=rapid-preprod-cluster
API_IMAGE_NAME=data-f1-registry
UI_IMAGE_NAME=ui-f1-registry
23 changes: 11 additions & 12 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ jobs:
echo AWS_DEFAULT_REGION=${{ secrets.AWS_REGION }} >> .env
- name: Build API Image
run: make api-create-image
run: make api/create-image

- name: API Static Analysis
run: make api-lint
run: make api/lint

- name: API Tests
run: make api-test
run: make api/test

- name: API Tag and Upload
run: make api-tag-and-upload
run: make api/tag-and-upload

sdk-dev:
needs:
Expand All @@ -84,18 +84,17 @@ jobs:

- name: Setup Python Environment
run: |
make sdk-setup
source sdk/.venv/bin/activate
make sdk/setup
- name: SDK Test
run: make sdk-test
run: make sdk/test

- name: Set env variable
run: echo "TEST_SDK_VERSION=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV

- name: SDK Test Deploy
run: make sdk-release-test
run: make sdk/release-test

ui-dev:
needs:
- setup
Expand All @@ -111,10 +110,10 @@ jobs:
node-version: 19

- name: Install UI Packages
run: make ui-setup
run: make ui/setup

- name: UI Test
run: make ui-test
run: make ui/test

cleanup:
needs:
Expand All @@ -130,4 +129,4 @@ jobs:

- name: Clean Docker Context
if: always()
run: make clean-pipeline-docker-context
run: make api/clean-docker
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,32 @@ jobs:
echo AWS_DEFAULT_REGION=${{ secrets.AWS_REGION }} >> .env
- name: Build API Image
run: make api-create-image
run: make api/create-image

- name: API Static Analysis
run: make api-lint
run: make api/lint

- name: API Tests
run: make api-test
run: make api/test

- name: API Tag and Upload
run: make api-tag-and-upload
run: make api/tag-and-upload

- name: API Check Image Scan for Vulnerabilities
run: make api-scan-for-vulns-and-tag
run: make api/scan-for-vulns-and-tag

- name: API Tag PROD Candidate
run: make api-tag-prod-candidate
run: make api/tag-prod-candidate

- name: API Deploy Image to Prod
run: make api-app-live-in-prod
run: make api/app-live-in-prod

- name: API Allow for Application to Start
run: sleep 120

- name: API Wait for Running Application
id: await-running-app
run: make api-check-app-is-running
run: make api/check-app-is-running

- name: API E2E Tests
id: e2e-tests
Expand All @@ -85,11 +85,11 @@ jobs:
run: |
# Export AWS credentials to env for e2e tests
eval "$(aws configure export-credentials --format env)"
make api-test-e2e
make api/test-e2e
- name: API Tag Image as Failure
if: always() && steps.await-running-app.conclusion == 'failure' || steps.e2e-tests.conclusion == 'failure'
run: make api-tag-prod-failure
run: make api/tag-prod-failure

cleanup:
needs:
Expand All @@ -103,4 +103,4 @@ jobs:

- name: Clean Docker Context
if: always()
run: make clean-pipeline-docker-context
run: make api/clean-docker
26 changes: 6 additions & 20 deletions .github/workflows/release_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env
- name: Build API Image
run: make api-create-image
run: make api/create-image

- name: API Tag and Upload Release Image
run: make api-tag-and-upload-release-image
run: make api/tag-and-upload-release-image

ui-release:
needs:
Expand All @@ -46,30 +46,16 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 19
node-version: 20

- name: Install UI Packages
run: make ui-setup
run: make ui/setup

- name: UI Build Static Files
run: make ui-create-static-out
run: make ui/create-static-out

- name: UI Zip and Release
env:
TAG: ${{ github.event.release.tag_name }}
GH_TOKEN: ${{ github.token }}
run: make ui-zip-and-release tag=$TAG

cleanup:
needs:
- setup
- api-release
- ui-release
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Clean Docker Context
if: always()
run: make clean-pipeline-docker-context
run: make ui/zip-and-release tag=$TAG
18 changes: 2 additions & 16 deletions .github/workflows/release_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,7 @@ jobs:

- name: Setup Python Environment
run: |
make sdk-setup
source sdk/.venv/bin/activate
make sdk/setup
- name: SDK Release
run: make sdk-release

cleanup:
needs:
- setup
- sdk-release
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Clean Docker Context
if: always()
run: make clean-pipeline-docker-context
run: make sdk/release
2 changes: 1 addition & 1 deletion .github/workflows/scheduled-vulnerability-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
run: echo AWS_REGION=${{ secrets.AWS_REGION }} >> .env

- name: Check for vulnerabilities
run: make api-scheduled-prod-scan
run: make api/scheduled-prod-scan
2 changes: 1 addition & 1 deletion .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
npx playwright install
- name: Run playwright tests
run: make ui-test-e2e
run: make ui/test-e2e
env:
E2E_DOMAIN_NAME: ${{ secrets.E2E_DOMAIN_NAME }}
E2E_RESOURCE_PREFIX: ${{ secrets.E2E_RESOURCE_PREFIX }}
Expand Down
8 changes: 8 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
brew "pyenv"
brew "terraform"
brew "checkov"
brew "pre-commit"
brew "nvm"
brew "mkdocs"
brew "gh"
brew "jq"
Loading

0 comments on commit 5bcbe28

Please sign in to comment.