Skip to content

Commit

Permalink
Merge branch 'next' of github.com:uncefact/project-vckit into chore/m…
Browse files Browse the repository at this point in the history
…erge-next-to-main

* 'next' of github.com:uncefact/project-vckit: (90 commits)
  feat: enveloping proof (#207)
  feat: Add `eddsa-rdfc-2022-cryptosuite` Plugin (#200)
  chore: update bitstring status package (#211)
  docs: update identifier creation (#208)
  feat(cd): ghcr.io setup and docker image build workflow (#206)
  changed Dockerfile to use default agent.template.yml (#201) (#205)
  parameterised API Key for Docker builds (#203) (#204)
  feat: setup package workflow
  feat: create git workflow for release tagging and generate the release note (#199)
  fix: Provide meaningful error message when signature verification fails (#197)
  docs: add documentation site (#198)
  feat: implement renderer 2024 provider (#177)
  chore: update arguments and envs for the Dockerfile (#194)
  fix: using revocation list on explorer and handle no hash (#192)
  docs: add yarn to prerequisites
  chore: change node version to 20.12.2 (#187)
  chore: update default agent for Status plugin (#186)
  chore: fix the dockerfile to set entrypoint
  chore: update vckit Dockerfile (#184)
  chore: update DockerFile and agent template (#183)
  ...

Signed-off-by: Nam Hoang <[email protected]>

# Conflicts:
#	.github/workflows/build-test-publish.yml
#	.github/workflows/deploy-to-s3.yml
#	jest.config.mjs
#	package.json
#	packages/core-types/package.json
#	packages/credential-oa/__tests__/action-handler.test.ts
#	packages/credential-oa/src/action-handler.ts
#	pnpm-lock.yaml
  • Loading branch information
namhoang1604 committed Sep 19, 2024
2 parents 1fdcc79 + 998356b commit 430c891
Show file tree
Hide file tree
Showing 610 changed files with 64,812 additions and 32,840 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
docker-compose.yaml
.dockerignore
**/Dockerfile
**/node_modules
**/__test__
**/coverage
**/build
**/tsconfig.tsbuildinfo
.git
.github
.gitignore
jest.*
*.md
LICENSE
database.sqlite
appspec.yml
.prettierrc
.prettierignore
.eslintrc.json
.eslintignore
.editorconfig
.vscode
logs
aws
.DS_Store
97 changes: 97 additions & 0 deletions .github/workflows/build-and-deploy-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build and Deploy Agent

on:
push:
branches:
- dev
tags:
- '*'

env:
environment: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}

jobs:
install_and_build:
runs-on: ubuntu-latest

permissions:
id-token: write

env:
CI: false

environment:
name: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}
url: ${{ env.environment == 'UN' && 'https://test.uncefact.org/vckit/explorer/' || 'https://explorer.vckit.showthething.com/' }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install AWS CLI
run: |
sudo apt-get -q install -y python3-pip
pip3 install awscli --upgrade --user
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Remove Explorer
run: rm -rf packages/demo-explorer packages/react-components packages/vckit-oa-renderers

- name: Overwrite configuration
if: ${{ env.environment == 'dev' }}
run: cp -f packages/cli/default/default-dev.yml packages/cli/default/default.yml

- name: Create env file
if: ${{ env.environment == 'dev' }}
run: |
touch packages/encrypted-storage/.env
echo DATABASE_URL=${{ secrets.DATABASE_URL}} >> packages/encrypted-storage/.env
echo DATABASE_TYPE=postgres >> packages/encrypted-storage/.env
echo DATABASE_DATABASE=${{ secrets.DATABASE_DATABASE}} >> packages/encrypted-storage/.env
cat packages/encrypted-storage/.env
cp packages/encrypted-storage/.env packages/revocation-list-2020/.env
- name: Compress Agent Server
run: tar -czf agent-server.tar.gz *

- name: Upload Artifact to S3
run: aws s3 cp agent-server.tar.gz s3://${{ vars.AGENT_SERVER_AWS_S3_BUCKET_NAME }}/agent-server.tar.gz


deploy:
needs: install_and_build
runs-on: ubuntu-latest

permissions:
id-token: write

environment:
name: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}
url: ${{ env.environment == 'UN' && 'https://test.uncefact.org/vckit/explorer/' || 'https://explorer.vckit.showthething.com/' }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install AWS CLI
run: |
sudo apt-get -q install -y python3-pip
pip3 install awscli --upgrade --user
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }}
aws-region: ${{ vars.AWS_REGION }}

- name: Deploy to EC2
run: aws deploy create-deployment --application-name ${{ vars.AWS_DEPLOY_APP_NAME }} --deployment-group-name ${{ vars.AWS_DEPLOY_GROUP_NAME }} --s3-location bucket=${{ vars.AGENT_SERVER_AWS_S3_BUCKET_NAME }},key=agent-server.tar.gz,bundleType=tgz --ignore-application-stop-failures




46 changes: 46 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Test

on:
pull_request:
branches:
- next

jobs:
test_and_build:
runs-on: ubuntu-latest
env:
EXCLUDED_PACKAGE_OA_RENDERERS: '!./packages/vckit-oa-renderers/'
EXCLUDED_PACKAGE_CREDENTIAL_OA: '!./packages/credential-oa/'
EXCLUDED_PACKAGE_EXPLORER: '!./packages/demo-explorer/'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Install pnpm
run: npm i pnpm --global

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '21'

- name: Install dependencies
run: pnpm i --filter ${{ env.EXCLUDED_PACKAGE_OA_RENDERERS }} --filter ${{ env.EXCLUDED_PACKAGE_CREDENTIAL_OA }} --filter ${{ env.EXCLUDED_PACKAGE_EXPLORER }} --no-frozen-lockfile

- name: Build
run: pnpm build:agent

- name: Run tests
run: |
pnpm test:packages --changedSince=origin/next --ci --json --coverage --testLocationInResults --outputFile=report.json
- name: Coverage
uses: artiomtr/jest-coverage-report-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage-file: report.json
base-coverage-file: report.json
threshold: 80
31 changes: 16 additions & 15 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
CI: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
node-version: '18'

- name: Install pnpm
run: npm install -g [email protected]

- run: pnpm install
- run: pnpm build
Expand All @@ -34,25 +35,25 @@ jobs:
publish:
needs:
- build

env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
CI: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{secrets.GITHUB_TOKEN}}
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
node-version: '18'

- name: Install pnpm
run: npm install -g [email protected]

- name: 'Restore build output'
uses: actions/cache/restore@v3
Expand Down
76 changes: 65 additions & 11 deletions .github/workflows/deploy-to-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,68 @@ name: Deploy to S3
on:
push:
branches:
- demo # Change this to your main branch name
- dev
tags:
- '*'

env:
environment: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}

jobs:
install_and_build:
runs-on: ubuntu-latest

env:
CI: false

environment:
name: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}
url: ${{ env.environment == 'UN' && 'https://test.uncefact.org/vckit/explorer/' || 'https://explorer.vckit.showthething.com/' }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Cache dependencies
id: cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '18'

- name: Install pnpm
run: npm install -g pnpm
run: npm install -g [email protected]

- name: pnpm version
run: pnpm --version

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm run build
- name: 'Create env file'
run: |
touch packages/demo-explorer/.env
echo REACT_APP_WALLET_ENDPOINT=${{ vars.REACT_APP_WALLET_ENDPOINT }} >> packages/demo-explorer/.env
echo REACT_APP_ENCRYPTED_ENDPOINT=${{ vars.REACT_APP_ENCRYPTED_ENDPOINT}} >> packages/demo-explorer/.env
echo REACT_APP_QRCODE_VERIFY_ENDPOINT=${{ vars.REACT_APP_QRCODE_VERIFY_ENDPOINT }} >> packages/demo-explorer/.env
echo REACT_APP_SCHEMA_URL=${{ vars.REACT_APP_SCHEMA_URL }} >> packages/demo-explorer/.env
echo REACT_APP_REMOTE_AGENT_API_KEY=${{ vars.REACT_APP_REMOTE_AGENT_API_KEY }} >> packages/demo-explorer/.env
echo REACT_APP_DEFAULT_AGENT_ID=${{ vars.REACT_APP_DEFAULT_AGENT_ID }} >> packages/demo-explorer/.env
cat packages/demo-explorer/.env
- name: Build explorer
run: PUBLIC_URL=${{ env.environment == 'UN' && '/vckit/explorer/' || '/' }} pnpm build:js

- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: explorer
path: packages/demo-explorer/build/explorer

deploy_to_s3:
needs: install_and_build
Expand All @@ -41,28 +73,50 @@ jobs:
permissions:
id-token: write

environment:
name: ${{ startsWith(github.ref, 'refs/tags/v') && 'UN' || 'dev' }}
url: ${{ env.environment == 'UN' && 'https://test.uncefact.org/vckit/explorer/' || 'https://explorer.vckit.showthething.com/' }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: explorer
path: packages/demo-explorer/build/explorer

- name: Install AWS CLI
run: |
sudo apt-get -q install -y python3-pip
pip3 install awscli --upgrade --user
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
if: ${{ env.environment == 'dev' }}
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }}
aws-region: ${{ vars.AWS_REGION }}

- name: Configure AWS Credentials
if: ${{ env.environment == 'UN' }}
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::017206355635:role/GithubActions/gs-gs_project-vckit
aws-region: ap-southeast-2
role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}

- name: Deploy to S3
run: aws s3 sync packages/demo-explorer/build/ s3://${{ vars.AWS_S3_BUCKET_NAME }} --acl public-read --delete
run: |
S3_PATH=${{ env.environment == 'UN' && '/vckit/explorer/' || '/'}}
aws s3 sync packages/demo-explorer/build/explorer/ s3://${{ vars.AWS_S3_BUCKET_NAME }}$S3_PATH --delete
- name: Invalidate CloudFront
run: |
DISTRIBUTION_ID=${{ vars.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
INVALIDATION_PATH="/*"
INVALIDATION_PATH=${{ env.environment == 'UN' && '/vckit/explorer/*' || '/*'}}
# Create a new CloudFront invalidation
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths $INVALIDATION_PATH
Loading

0 comments on commit 430c891

Please sign in to comment.