Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
ci: add actions and run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
genaris committed Dec 24, 2022
1 parent 91ff64b commit 3479cc4
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 17 deletions.
18 changes: 18 additions & 0 deletions .github/actions/setup-libindy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup Libindy
description: Download and install the libindy binary from the sovrin repository
author: '[email protected]'

runs:
using: composite
steps:
- name: Setup Indy
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable"
sudo apt-get update -y
sudo apt-get install -y --allow-unauthenticated libindy
shell: bash

branding:
icon: scissors
color: purple
114 changes: 114 additions & 0 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Continuous Deployment - Canary Release

on:
pull_request:
branches:
- main
push:
branches: [main]

# Make sure we're not running multiple release steps at the same time as this can give issues with determining the next npm version to release.
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case:
# "When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other."
concurrency:
group: aries-javascript-user-profile${{ github.ref }}-${{ github.repository }}-{{ github.event_name }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-20.04
name: Validate
steps:
- name: Checkout aries-javascript-user-profile
uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Some packages need indy-sdk for node as part of yarn install
- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: Setup node v16
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
run: yarn install

- name: Prettier
run: yarn check-format

- name: Check typescript
run: yarn check-types
release:
runs-on: ubuntu-20.04
environment: NPM
name: Release
needs: [validate]
steps:
- name: Checkout aries-javascript-user-profile
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: git config
run: |
git config user.name "@github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Some packages need indy-sdk for node as part of yarn install
- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: Setup node v16
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
run: yarn install

# https://github.com/yarnpkg/yarn/issues/6617#issuecomment-436222106
- name: Prepend Node path
run: npm config set scripts-prepend-node-path true

- name: Set Verbose Logging
run: npm config set loglevel verbose --global

- name: Set NPM config
run: |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "always-auth=true" >> .npmrc
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build the library
run: yarn build

- name: Release unstable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release --preRelease alpha --ci
119 changes: 119 additions & 0 deletions .github/workflows/release-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Continuous Deployment

on:
workflow_dispatch:
inputs:
releaseType:
description: The type of release. Should be one of "major", "minor", "patch"
required: true
default: 'patch'
pull_request:
branches:
- main

# Make sure we're not running multiple release steps at the same time as this can give issues with determining the next npm version to release.
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case:
# "When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other."
concurrency:
group: aries-javascript-user-profile${{ github.ref }}-${{ github.repository }}-{{ github.event_name }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-20.04
name: Validate
steps:
- name: Checkout aries-javascript-user-profile
uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Some packages need indy-sdk for node as part of yarn install
- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: Setup node v16
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
run: yarn install

- name: Prettier
run: yarn check-format

- name: Check typescript
run: yarn check-types
release:
runs-on: ubuntu-20.04
name: Release
needs: [validate]
# Only run on workflow dispatch to main branch
if: github.ref == 'refs/heads/main' && github.repository == '2060-io/aries-javascript-user-profile' && github.event_name == 'workflow_dispatch'
steps:
- name: Checkout aries-javascript-user-profile
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: git config
run: |
git config user.name "@github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Some packages need indy-sdk for node as part of yarn install
- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: Setup node v16
uses: actions/setup-node@v2
with:
node-version: 16

- name: Install dependencies
run: yarn install

# https://github.com/yarnpkg/yarn/issues/6617#issuecomment-436222106
- name: Prepend Node path
run: npm config set scripts-prepend-node-path true

- name: Set Verbose Logging
run: npm config set loglevel verbose --global

- name: Set NPM config
run: |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "always-auth=true" >> .npmrc
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build the library
run: yarn build

- name: Release unstable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release ${{ github.event.inputs.releaseType }} --ci
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true
}
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

# Aries JavaScript User Profile plug-in
# User Profile plug-in for Aries Framework JavaScript

This module is used to provide an Aries Agent built with Aries Framework JavaScript means to manage [User Profile protocol](https://github.com/2060-io/aries-rfcs/tree/feature/user-profile/features/xxxx-user-profile).

Expand All @@ -8,19 +7,17 @@ It's conceived as a plug-in for Aries Framework JavaScript which can be injected
```ts
import { UserProfileModule } from 'aries-javascript-user-profile'


const agent = new Agent({
config: { /* agent config */
},
dependencies,
modules: { userProfile: new UserProfileModule() },
config: {
/* agent config */
},
dependencies,
modules: { userProfile: new UserProfileModule() },
})


```

Once instantiated, media module API can be accessed under `agent.modules.userProfile` namespace

## Usage

> **TODO**
> **TODO**
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "aries-javascript-user-profile",
"name": "aries-framework-user-profile",
"version": "0.0.0",
"description": "User Profile protocol implementation for @aries-framework/core",
"description": "User Profile protocol implementation for aries-framework-javascript",
"author": "2060.io",
"homepage": "https://github.com/2060-io/aries-javascript-receipts",
"license": "ISC",
Expand All @@ -15,6 +15,9 @@
"clean": "rimraf -rf ./build",
"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "yarn run build",
"check-types": "tsc --noEmit -p tsconfig.build.json",
"check-format": "yarn prettier --check",
"prettier": "prettier --ignore-path .gitignore '**/*.+(js|json|ts|md|yml|yaml)'",
"release": "release-it"
},
"repository": {
Expand All @@ -27,7 +30,7 @@
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
},
"devDependencies": {
"@aries-framework/node": "^0.3.0",
"@types/jest": "^26.0.23",
Expand Down
2 changes: 1 addition & 1 deletion src/model/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './ConnectionMetadata'
export * from './ConnectionProfile'
export * from './ConnectionType'
export * from './ConnectionType'
2 changes: 1 addition & 1 deletion src/services/UserProfileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class UserProfileService {
public async processGetProfile(messageContext: InboundMessageContext<GetProfileMessage>) {
const connection = messageContext.assertReadyConnection()

const policyId = connection.getTag('communicationPolicyId') as string ?? null
const policyId = (connection.getTag('communicationPolicyId') as string) ?? null
if (policyId) {
const policy = await this.communicationPolicyService.findById(messageContext.agentContext, policyId)

Expand Down
9 changes: 8 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@
"jsx": "react"
},
"include": ["src/**/*", "types"],
"exclude": ["node_modules", "**/build/*", "**/*.test.ts", "**/__tests__/*.ts", "**/__tests__/*.tsx", "**/__mocks__/*.ts"]
"exclude": [
"node_modules",
"**/build/*",
"**/*.test.ts",
"**/__tests__/*.ts",
"**/__tests__/*.tsx",
"**/__mocks__/*.ts"
]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"aries-javascript-user-profile/*": ["src"],
"aries-javascript-user-profile/*": ["src"]
},
"types": ["jest", "node"],
"watch": true
Expand Down

0 comments on commit 3479cc4

Please sign in to comment.