Skip to content

Commit

Permalink
Merge pull request #1 from 2060-io/dev-test
Browse files Browse the repository at this point in the history
feat: update prettier/eslint rules, add ci/cd
  • Loading branch information
genaris authored Mar 19, 2024
2 parents a2216fa + aa552cf commit 7317185
Show file tree
Hide file tree
Showing 63 changed files with 3,004 additions and 1,884 deletions.
39 changes: 39 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import/no-cycle': 'error',
'import/newline-after-import': ['error', { count: 1 }],
'import/order': [
'error',
{
groups: ['type', ['builtin', 'external'], 'parent', 'sibling', 'index'],
alphabetize: {
order: 'asc',
},
'newlines-between': 'always',
},
],
},
}
85 changes: 85 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Continuous Deployment

on:
push:
branches: [main, dev, dev-test]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout service-agent
uses: actions/checkout@v4

- name: Setup node v20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: |
yarn install
- uses: codfish/semantic-release-action@v3
id: semantic
with:
branches: |
[
'main',
{
name: 'dev',
prerelease: true
},
{
name: 'dev-test',
prerelease: true
}
]
plugins: |
[
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{
"type": "refactor",
"release": "patch"
}
]
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
"@semantic-release/release-notes-generator",
[
"@codedependant/semantic-release-docker",
{
"dockerTags":
[
"${RELEASE_MAJOR}-${GITHUB_REF##*/}",
"${RELEASE_MAJOR}.${RELEASE_MINOR}-${GITHUB_REF##*/}",
"${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_PATCH}-${GITHUB_REF##*/}",
"$RELEASE_VERSION",
"${GITHUB_REF##*/}"
],
"dockerImage": "${IMAGE_NAME}"
}
]
]
additional-packages: |
['@codedependant/semantic-release-docker']
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
DOCKER_REGISTRY_PASSWORD : ${{ secrets.DOCKER_HUB_PWD }}
IMAGE_NAME: '2060-service-agent'

- run: echo ${{ steps.semantic.outputs.release-version }}
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Continuous Integration

on:
pull_request:
branches: [main, dev, dev-test]
types: [opened, synchronize, reopened, labeled]
push:
branches: [main, dev, dev-test]
workflow_dispatch:

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout service-agent
uses: actions/checkout@v4

- name: Setup node v20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: |
yarn install --frozen-lockfile
- name: Check Format
run: |
yarn check-format
- name: Check Types
run: |
yarn check-types
- name: Build
run: |
yarn build
9 changes: 6 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"printWidth": 120,
"printWidth": 110,
"singleQuote": true,
"bracketSpacing": true,
"semi": false,
"singleQuote": true
}
"trailingComma": "all",
"arrowParens": "avoid"
}
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,32 @@
## Configuration

At the moment, all configuration is done by environment variables. All of them are optional for development
but likely needed for production and test deployments.

| Variable | Description | Default value |
|----------|------------ | ------------- |
| AGENT_ENDPOINT | Public endpoint where agent DIDComm endpoints will be accessible (including protocol and port) | ws://localhost:3001 |
| AGENT_ENDPOINTS | List of endpoints where agent DIDComm endpoints will be accessible (including protocol and port), comma separated | ws://localhost:3001 |
| AGENT_INVITATION_IMAGE_URL | Public URL for image to be shown in invitations | none |
| AGENT_INVITATION_BASE_URL | Public URL for fallback when no DIDComm agent is found | https://2060.io/i |
| AGENT_PUBLIC_DID | Agent's public DID (in did:web format) | none |
| AGENT_PORT | Port where DIDComm agent will be running | 3001 |
| AGENT_LOG_LEVEL | Aries Agent Log level | 4 (warn) |
| ENABLE_WS | Enable Web Socket transport for Agent | true |
| ENABLE_HTTP | Enable HTTP transport for Agent | true |
| AGENT_NAME | Label to show to other DIDComm agents | Test Service Agent |
| USE_CORS | Enable Cross-Origin Resource Sharing (only for development purposes) | false |
| ANONCREDS_SERVICE_BASE_URL | AnonCreds Service base URL | none |
| ADMIN_PORT | Administration interface port | 3000 |
| ADMIN_LOG_LEVEL | Admin interface Log level | 2 (debug) |
| EVENTS_BASE_URL | Base URL for sending events | http://localhost:5000 |
but likely needed for production and test deployments.

| Variable | Description | Default value |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------- |
| AGENT_ENDPOINT | Public endpoint where agent DIDComm endpoints will be accessible (including protocol and port) | ws://localhost:3001 |
| AGENT_ENDPOINTS | List of endpoints where agent DIDComm endpoints will be accessible (including protocol and port), comma separated | ws://localhost:3001 |
| AGENT_INVITATION_IMAGE_URL | Public URL for image to be shown in invitations | none |
| AGENT_INVITATION_BASE_URL | Public URL for fallback when no DIDComm agent is found | https://2060.io/i |
| AGENT_PUBLIC_DID | Agent's public DID (in did:web format) | none |
| AGENT_PORT | Port where DIDComm agent will be running | 3001 |
| AGENT_LOG_LEVEL | Aries Agent Log level | 4 (warn) |
| ENABLE_WS | Enable Web Socket transport for Agent | true |
| ENABLE_HTTP | Enable HTTP transport for Agent | true |
| AGENT_NAME | Label to show to other DIDComm agents | Test Service Agent |
| USE_CORS | Enable Cross-Origin Resource Sharing (only for development purposes) | false |
| ANONCREDS_SERVICE_BASE_URL | AnonCreds Service base URL | none |
| ADMIN_PORT | Administration interface port | 3000 |
| ADMIN_LOG_LEVEL | Admin interface Log level | 2 (debug) |
| EVENTS_BASE_URL | Base URL for sending events | http://localhost:5000 |

> **Note**: While not mandatory, it is recommended to set an agent public DID matching external hostname (e.g. if your Service Agent instance is accessable in `https://myagent.com:3000` you must set AGENT_PUBLIC_DID to `did:web:myagent.com%3A3000`), which will make possible for the agent to create its own creadential types and therefore issue credentials. Note that you'll need HTTPS in order to fully support did:web specification.
>
>
> Public DID will be used also for agents to easily connect to it using DIDComm without the need of creating an explicit invitation by doing a GET request to `/invitation` endpoint.
Possible log levels:

- 0: test
- 1: trace
- 2: debug
Expand Down Expand Up @@ -76,4 +77,4 @@ Then, a container can be created and deployed:
docker run -e AGENT_PUBLIC_DID=... -e AGENT_ENDPOINT=... -e AGENT_PORT=yyy -e USE_CORS=xxx -p yyy:xxx 2060-service-agent:[tag]
```

where yyy is an publicly accesible port from the host machine.
where yyy is an publicly accesible port from the host machine.
Loading

0 comments on commit 7317185

Please sign in to comment.