forked from undp/Digital-Transparency-System-NDC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2a33ad
commit 404ce58
Showing
515 changed files
with
81,002 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Deploy Front end in S3 | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
paths: | ||
- web/** | ||
|
||
jobs: | ||
deploy_front_end: | ||
runs-on: ubuntu-latest | ||
env: | ||
REACT_APP_BACKEND: https://api.carbreg.org | ||
# https://ck5kt5uaw1.execute-api.us-east-1.amazonaws.com/dev | ||
COUNTRY_NAME: 'Antarctic Region' | ||
COUNTRY_FLAG_URL: 'https://carbon-common-dev.s3.amazonaws.com/flag.png' | ||
COUNTRY_CODE: 'NG' | ||
REACT_APP_MAPBOXGL_ACCESS_TOKEN: ${{ secrets.MAPBOXGL_ACCESS_TOKEN }} | ||
REACT_APP_MAP_TYPE : "Mapbox" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Cache modules | ||
uses: actions/cache@v1 | ||
id: yarn-cache | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: ${{ runner.os }}-yarn- | ||
- 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-east-1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
working-directory: ./web | ||
run: CI=false yarn | ||
- name: Build | ||
working-directory: ./web | ||
run: CI=false yarn build | ||
- name: Deploy | ||
run: aws s3 sync ./web/build s3://carbon-www-dev | ||
# - name: Deploy Test | ||
# run: aws s3 sync ./web/build s3://www-test-carbon | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Build, tag, and push the image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: carbon-web | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and push it to ECR | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f web/Dockerfile . --build-arg PORT=3030 --build-arg REACT_APP_BACKEND=http://localhost:3000 --build-arg REACT_APP_STAT_URL=http://localhost:3100 --build-arg COUNTRY_NAME="Antarctic Region" --build-arg COUNTRY_FLAG_URL="https://carbon-common-dev.s3.amazonaws.com/flag.png" --build-arg COUNTRY_CODE="NG" --build-arg REACT_APP_MAP_TYPE="Mapbox" --build-arg REACT_APP_MAPBOXGL_ACCESS_TOKEN=${{ secrets.MAPBOXGL_ACCESS_TOKEN }} | ||
echo "Pushing image to ECR..." | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Deploy Front end in S3 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- web/** | ||
|
||
jobs: | ||
deploy_front_end: | ||
runs-on: ubuntu-latest | ||
env: | ||
REACT_APP_BACKEND: https://api.carbreg.org | ||
COUNTRY_NAME: 'Antarctic Region' | ||
COUNTRY_FLAG_URL: 'https://carbon-common-prod.s3.amazonaws.com/flag.png' | ||
COUNTRY_CODE: 'NG' | ||
REACT_APP_MAPBOXGL_ACCESS_TOKEN: ${{ secrets.MAPBOXGL_ACCESS_TOKEN }} | ||
REACT_APP_MAP_TYPE : "Mapbox" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Cache modules | ||
uses: actions/cache@v1 | ||
id: yarn-cache | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: ${{ runner.os }}-yarn- | ||
- 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-east-1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
working-directory: ./web | ||
run: CI=false yarn | ||
- name: Build | ||
working-directory: ./web | ||
run: CI=false yarn build | ||
- name: Deploy | ||
run: aws s3 sync ./web/build s3://carbon-www-prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
name: Deploy Services | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
paths: | ||
- backend/** | ||
- libs/** | ||
|
||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: us-east-1 | ||
|
||
jobs: | ||
check_dependency_change: | ||
runs-on: ubuntu-latest | ||
# Declare outputs for next jobs | ||
outputs: | ||
deps_changed: ${{ steps.check_file_changed.outputs.deps_changed }} | ||
stage: ${{ steps.branch_check.outputs.stage }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- id: check_file_changed | ||
run: | | ||
if [[ $(git diff --name-only HEAD^ HEAD | grep backend/services/package.json) ]] || [[ $(git diff --name-only HEAD^ HEAD | grep libs/) ]]; then | ||
echo "deps_changed=True" >> $GITHUB_OUTPUT | ||
else | ||
echo "deps_changed=False" >> $GITHUB_OUTPUT | ||
fi | ||
- id: branch_check | ||
run: | | ||
if [[ ${GITHUB_REF} == 'refs/heads/main' ]]; then | ||
echo "stage=prod" >> $GITHUB_OUTPUT | ||
else | ||
echo "stage=dev" >> $GITHUB_OUTPUT | ||
fi | ||
layer: | ||
name: layer | ||
runs-on: ubuntu-latest | ||
needs: check_dependency_change | ||
steps: | ||
- name: check_file_changed | ||
run: | | ||
echo ${{needs.check_dependency_change.outputs.deps_changed}} | ||
echo ${{needs.check_dependency_change.outputs}} | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Build Serial Generator Package | ||
if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' }} | ||
working-directory: ./libs/serial-number-gen | ||
run: yarn run build | ||
- name: Build Carbon Credit Package | ||
if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' }} | ||
working-directory: ./libs/carbon-credit-calculator | ||
run: yarn run build | ||
- name: Copy package.json | ||
if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' }} | ||
working-directory: ./backend/layer/dependency_layer | ||
run: cp ../../services/package.json ./ && cp ../../services/yarn.lock ./ && cp -r ../../../libs ../../ | ||
- name: Install Dependency | ||
if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' }} | ||
working-directory: ./backend/layer/dependency_layer | ||
run: yarn install --production --frozen-lockfile | ||
# - name: Copy Dependency | ||
# if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' }} | ||
# working-directory: ./backend/layer | ||
# run: | | ||
# cp -r node_modules ./dependency_layer | ||
# ls | ||
- name: serverless deploy develop | ||
if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True'}} | ||
uses: serverless/[email protected] | ||
with: | ||
args: -c "cd ./backend/layer && serverless deploy --stage ${{ needs.check_dependency_change.outputs.stage }}" | ||
entrypoint: /bin/sh | ||
# - name: serverless deploy main | ||
# if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' && github.ref == 'refs/heads/main'}} | ||
# uses: serverless/[email protected] | ||
# with: | ||
# args: -c "cd ./backend/layer && serverless deploy --stage prod" | ||
# entrypoint: /bin/sh | ||
deploy: | ||
name: deploy | ||
runs-on: ubuntu-latest | ||
needs: [layer, check_dependency_change] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install Dependency | ||
working-directory: ./backend/services | ||
run: yarn install --frozen-lockfile | ||
- name: version | ||
run: | | ||
echo "ARN1=$(aws lambda list-layer-versions --layer-name service-dependencies-${{ needs.check_dependency_change.outputs.stage }}-1 --region us-east-1 --query 'LayerVersions[0].LayerVersionArn')" >> $GITHUB_OUTPUT | ||
echo "ARN2=$(aws lambda list-layer-versions --layer-name service-dependencies-${{ needs.check_dependency_change.outputs.stage }}-2 --region us-east-1 --query 'LayerVersions[0].LayerVersionArn')" >> $GITHUB_OUTPUT | ||
id: layerArn | ||
- name: Build Serial Generator Package | ||
working-directory: ./libs/serial-number-gen | ||
run: yarn run build | ||
- name: Build Carbon Credit Package | ||
working-directory: ./libs/carbon-credit-calculator | ||
run: yarn run build | ||
- name: serverless deploy develop | ||
# if: github.ref == 'refs/heads/develop' | ||
uses: serverless/[email protected] | ||
with: | ||
args: -c "cd ./backend/services && serverless deploy --stage ${{ needs.check_dependency_change.outputs.stage }} --param='depLayerArn1=${{ steps.layerArn.outputs.ARN1 }}' --param='depLayerArn2=${{ steps.layerArn.outputs.ARN2 }}'" | ||
entrypoint: /bin/sh | ||
# - name: serverless deploy main | ||
# if: github.ref == 'refs/heads/main' | ||
# uses: serverless/[email protected] | ||
# with: | ||
# args: -c "cd ./backend/services && serverless deploy --stage prod" | ||
# entrypoint: /bin/sh | ||
- name: Configure AWS credentials | ||
if: github.ref == 'refs/heads/develop' | ||
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-east-1 | ||
- name: Login to Amazon ECR | ||
if: github.ref == 'refs/heads/develop' | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Build, tag, and push the image to Amazon ECR | ||
if: github.ref == 'refs/heads/develop' | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: carbon-services | ||
IMAGE_TAG: latest | ||
run: | | ||
# Build a docker container and push it to ECR | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f backend/services/Dockerfile . | ||
echo "Pushing image to ECR..." | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | ||
# automated-api-tests: | ||
# runs-on: ubuntu-latest | ||
# needs: [deploy] | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Install Postman CLI | ||
# run: | | ||
# curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh | ||
# - name: Login to Postman CLI | ||
# run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }} | ||
# - name: Run User Create Tests | ||
# if: always() | ||
# run: | | ||
# postman collection run "20428472-45dd524a-c260-44f4-b9c9-5f164db2264d" -e "20428472-778eb1c8-aac1-4484-a217-bcfd9a8d0df0" -d ./testing/api/user_onboarding_company4.csv | ||
# - name: Run User Password Reset Tests | ||
# if: always() | ||
# run: | | ||
# postman collection run "24647866-ba48ade2-732f-40c5-a304-509b44389ff6" -e "20428472-778eb1c8-aac1-4484-a217-bcfd9a8d0df0" -d ./testing/api/reset_password_3.csv | ||
# - name: Run User View Tests | ||
# if: always() | ||
# run: | | ||
# postman collection run "20428472-a9ecb4af-70a2-4997-a478-e554138ec3ea" -e "20428472-778eb1c8-aac1-4484-a217-bcfd9a8d0df0" -d ./testing/api/view_user_company4.csv | ||
# - name: Run Programme Create Tests | ||
# if: always() | ||
# run: | | ||
# postman collection run "24716950-471a5534-87f8-482d-93e2-6613e15d55e0" -e "20428472-778eb1c8-aac1-4484-a217-bcfd9a8d0df0" -d ./testing/api/create_project_7.csv | ||
# - name: Run Programme Authorisation and Credit Transfer Tests | ||
# if: always() | ||
# run: | | ||
# postman collection run "20428472-140d1d13-d387-4952-b956-a1a5ff7b01af" -e "20428472-778eb1c8-aac1-4484-a217-bcfd9a8d0df0" -d ./testing/api/credit_transfer_1.csv | ||
# - name: Run Programme Certification and Certification Revocation Tests | ||
# if: always() | ||
# run: | | ||
# postman collection run "20428472-d4e57d08-53ad-42a5-ba0e-3e85f449a1ed" -e "20428472-778eb1c8-aac1-4484-a217-bcfd9a8d0df0" -d ./testing/api/credit_transfer_certify_1.csv | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
**/node_modules/ | ||
**/.serverless/ | ||
**/dist/ | ||
**/.build/ | ||
backend/services/.env.local | ||
**/yarn-error.log | ||
**/coverage | ||
.env.local | ||
./data/* | ||
!./data/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Serverless", | ||
"request": "launch", | ||
"type": "pwa-node", | ||
"cwd": "${workspaceFolder}/backend/services/", | ||
"program": "/usr/local/bin/serverless", | ||
"args": [ | ||
"offline", | ||
"--stage", | ||
"local" | ||
] | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"cSpell.words": [ | ||
"antd", | ||
"cmpt", | ||
"Popconfirm", | ||
"Sider" | ||
], | ||
"compile-hero.disable-compile-files-on-did-save-code": true | ||
} |
Oops, something went wrong.