-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from undp/xeptagondev-develop
Xeptagondev develop
- Loading branch information
Showing
360 changed files
with
3,102 additions
and
28,732 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
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 |
---|---|---|
|
@@ -6,7 +6,8 @@ on: | |
- main | ||
paths: | ||
- backend/** | ||
- libs/** | ||
# - libs/** | ||
- .github/workflows/server* | ||
|
||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
|
@@ -53,18 +54,18 @@ jobs: | |
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: 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 ../../ | ||
run: cp ../../services/package.json ./ && cp ../../services/yarn.lock ./ | ||
- name: Install Dependency | ||
if: ${{ needs.check_dependency_change.outputs.deps_changed == 'True' }} | ||
working-directory: ./backend/layer/dependency_layer | ||
|
@@ -105,12 +106,12 @@ jobs: | |
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: 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] | ||
|
@@ -140,13 +141,31 @@ jobs: | |
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: carbon-services | ||
IMAGE_TAG: latest | ||
IMAGE_TAG: develop | ||
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" | ||
- name: Deploy docker image to Amazon EC2 | ||
if: github.ref == 'refs/heads/develop' | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: carbon-services | ||
IMAGE_TAG: develop | ||
PRIVATE_KEY: ${{ secrets.AWS_SSH_KEY_PRIVATE }} | ||
HOSTNAME: ${{secrets.HOST_IP}} | ||
USER_NAME: ec2-user | ||
run: | | ||
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key | ||
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} ' | ||
cd repos/carbon-registry && | ||
sudo $(aws ecr get-login --no-include-email --region us-east-1) && | ||
sudo docker stop carbon-registry-national-1 carbon-registry-replicator-1 carbon-registry-stats-1 || true && | ||
sudo docker rm carbon-registry-national-1 carbon-registry-replicator-1 carbon-registry-stats-1 && | ||
sudo docker pull 302213478610.dkr.ecr.us-east-1.amazonaws.com/carbon-services:develop && | ||
docker compose -f docker-compose-image.yml up -d national stats replicator ' | ||
# automated-api-tests: | ||
# runs-on: ubuntu-latest | ||
|
@@ -186,4 +205,4 @@ jobs: | |
|
||
|
||
|
||
|
||
|
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,33 @@ | ||
name: Service Library Version Update | ||
on: | ||
workflow_dispatch | ||
|
||
jobs: | ||
update_service_lib: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
- 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: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Update Version | ||
working-directory: ./backend/services | ||
run: yarn upgrade carbon-services-lib --latest | ||
- name: Commit Changes | ||
working-directory: ./backend/services | ||
run: | | ||
git config --global user.name "System Generated" | ||
git config --global user.email "[email protected]" | ||
git add package.json yarn.lock | ||
git commit -m "Update Service Lib Version" | ||
git push origin HEAD |
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,91 @@ | ||
name: Test Services | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- '**' # matches every branch | ||
- '!develop' | ||
- '!main' # excludes master | ||
paths: | ||
- web/** | ||
- backend/** | ||
- web/** | ||
# - libs/** | ||
- .github/workflows/test-service* | ||
|
||
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: | ||
deploy: | ||
name: test deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- 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: 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-services | ||
IMAGE_TAG: ${{ github.head_ref || github.ref_name }} | ||
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,50 @@ | ||
name: Test Web Build | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- '**' # matches every branch | ||
- '!develop' | ||
- '!main' # excludes master | ||
paths: | ||
- web/** | ||
- backend/** | ||
- .github/workflows/test-web* | ||
|
||
jobs: | ||
Test_web_build: | ||
runs-on: ubuntu-latest | ||
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: 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: ${{ github.head_ref || github.ref_name }} | ||
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="CountryX" --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,33 @@ | ||
name: Web Library Version Update | ||
on: | ||
workflow_dispatch | ||
|
||
jobs: | ||
update_fe_lib: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
- 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: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Update Version | ||
working-directory: ./web | ||
run: yarn upgrade @undp/carbon-library --latest | ||
- name: Commit Changes | ||
working-directory: ./web | ||
run: | | ||
git config --global user.name "System Generated" | ||
git config --global user.email "[email protected]" | ||
git add package.json yarn.lock | ||
git commit -m "Update Web Lib Version" | ||
git push origin HEAD |
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 |
---|---|---|
|
@@ -7,4 +7,6 @@ backend/services/.env.local | |
**/coverage | ||
.env.local | ||
./data/* | ||
!./data/README.md | ||
!./data/README.md | ||
.yalc | ||
yalc.lock |
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
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
Oops, something went wrong.