Skip to content

Commit

Permalink
feat: jsonld-credential support
Browse files Browse the repository at this point in the history
Signed-off-by: Karim <karim@animo.id>
  • Loading branch information
karimStekelenburg committed May 19, 2022
1 parent 08d178d commit 7e26829
Show file tree
Hide file tree
Showing 640 changed files with 47,736 additions and 8,268 deletions.
34 changes: 33 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ module.exports = {
'no-console': 'error',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'import/no-cycle': 'error',
'import/newline-after-import': ['error', { count: 1 }],
'import/order': [
'error',
{
Expand All @@ -42,22 +44,52 @@ module.exports = {
'newlines-between': 'always',
},
],
'@typescript-eslint/no-non-null-assertion': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: false,
},
],
'no-restricted-imports': [
'error',
{
patterns: ['packages/*'],
},
],
},
overrides: [
{
files: ['packages/core/**'],
rules: {
'no-restricted-globals': [
'error',
{
name: 'Buffer',
message: 'Global buffer is not supported on all platforms. Import buffer from `src/utils/buffer`',
},
{
name: 'AbortController',
message:
"Global AbortController is not supported on all platforms. Use `import { AbortController } from 'abort-controller'`",
},
],
},
},
{
files: ['jest.config.ts', '.eslintrc.js'],
env: {
node: true,
},
},
{
files: ['*.test.ts', '**/__tests__/**', '**/tests/**', 'jest.*.ts', 'samples/**'],
files: ['demo/**'],
rules: {
'no-console': 'off',
},
},
{
files: ['*.test.ts', '**/__tests__/**', '**/tests/**', 'jest.*.ts', 'samples/**', 'demo/**'],
env: {
jest: true,
node: false,
Expand Down
17 changes: 17 additions & 0 deletions .github/actions/setup-postgres-wallet-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Setup Postgres wallet plugin
description: Setup Postgres wallet plugin
author: 'sairanjit.tummalapalli@ayanworks.com'

runs:
using: composite
steps:
- name: Setup Postgres wallet plugin
run: |
sudo apt-get install -y libzmq3-dev libsodium-dev pkg-config libssl-dev
curl https://sh.rustup.rs -sSf | bash -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
cd ../
git clone https://github.com/hyperledger/indy-sdk.git
cd indy-sdk/experimental/plugins/postgres_storage/
cargo build --release
shell: bash
12 changes: 12 additions & 0 deletions .github/actions/setup-postgres/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Setup Postgres
description: Setup Postgres
author: 'sairanjit.tummalapalli@ayanworks.com'

runs:
using: composite
steps:
- name: Setup Postgres
run: |
docker pull postgres
docker run --name postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
shell: bash
104 changes: 104 additions & 0 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Continuous Deployment

on:
push:
branches:
- main

jobs:
release-canary:
runs-on: ubuntu-20.04
name: Release Canary
if: "!startsWith(github.event.head_commit.message, 'chore(release): v')"
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2
with:
# pulls all commits (needed for lerna to correctly version)
fetch-depth: 0

# setup dependencies
- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 16

- name: Install dependencies
run: yarn install --frozen-lockfile

# On push to main, release unstable version
- name: Release Unstable
run: yarn lerna publish --loglevel=verbose --canary minor --exact --force-publish --yes --no-verify-access --dist-tag alpha
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get version number
id: get-version
run: |
LAST_RELEASED_VERSION=$(npm view @aries-framework/core@alpha version)
echo "::set-output name=version::$LAST_RELEASED_VERSION"
- name: Setup git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Set git tag
run: |
git tag v${{ steps.get-version.outputs.version }}
git push origin v${{ steps.get-version.outputs.version }} --no-verify
release-stable:
runs-on: ubuntu-20.04
name: Create Stable Release
# Only run if the last pushed commit is a release commit
if: "startsWith(github.event.head_commit.message, 'chore(release): v')"
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2

# setup dependencies
- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: 16

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Get updated version
id: new-version
run: |
NEW_VERSION=$(node -p "require('./lerna.json').version")
echo $NEW_VERSION
echo "::set-output name=version::$NEW_VERSION"
- name: Create Tag
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.new-version.outputs.version }}

- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.new-version.outputs.version }}
body: |
Release v${{ steps.new-version.outputs.version }}
You can find the changelog in the [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) file.
- name: Release to NPM
run: yarn lerna publish from-package --loglevel=verbose --yes --no-verify-access
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
90 changes: 66 additions & 24 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ name: Continuous Integration
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, labeled]
push:
branches: [main]
workflow_dispatch:

env:
TEST_AGENT_PUBLIC_DID_SEED: 000000000000000000000000Trustee9
GENESIS_TXN_PATH: network/genesis/local-genesis.txn
LIB_INDY_STRG_POSTGRES: /home/runner/work/aries-framework-javascript/indy-sdk/experimental/plugins/postgres_storage/target/release # for Linux

# 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:
Expand All @@ -18,6 +21,28 @@ concurrency:
cancel-in-progress: true

jobs:
# PRs created by github actions won't trigger CI. Before we can merge a PR we need to run the tests and
# validation scripts. To still be able to run the CI we can manually trigger it by adding the 'ci-test'
# label to the pull request
ci-trigger:
runs-on: ubuntu-20.04
outputs:
triggered: ${{ steps.check.outputs.triggered }}
steps:
- name: Determine if CI should run
id: check
run: |
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "ci-test" ]]; then
export SHOULD_RUN='true'
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" != "ci-test" ]]; then
export SHOULD_RUN='false'
else
export SHOULD_RUN='true'
fi
echo "SHOULD_RUN: ${SHOULD_RUN}"
echo "::set-output name=triggered::${SHOULD_RUN}"
validate:
runs-on: ubuntu-20.04
name: Validate
Expand All @@ -43,16 +68,19 @@ jobs:
- name: Prettier
run: yarn check-format

- name: Compile
- name: Check Types
run: yarn check-types

- name: Compile
run: yarn build

integration-test:
runs-on: ubuntu-20.04
name: Integration Tests

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 17.x]
node-version: [12.x, 14.x, 16.x, 17.x, 18.x]

steps:
- name: Checkout aries-framework-javascript
Expand All @@ -66,11 +94,16 @@ jobs:
with:
seed: ${TEST_AGENT_PUBLIC_DID_SEED}

- name: Setup Postgres
uses: ./.github/actions/setup-postgres

- name: Setup Postgres wallet plugin
uses: ./.github/actions/setup-postgres-wallet-plugin

- name: Setup NodeJS
uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install

Expand All @@ -80,11 +113,11 @@ jobs:
- uses: codecov/codecov-action@v1
if: always()

release-canary:
version-stable:
runs-on: ubuntu-20.04
name: Release Canary
name: Release stable
needs: [integration-test, validate]
if: github.ref == 'refs/heads/main' && github.repository == 'hyperledger/aries-framework-javascript' && github.event_name == 'push'
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2
Expand All @@ -104,26 +137,35 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

# On push to main, release unstable version
- name: Release Unstable
run: yarn lerna publish --loglevel=verbose --canary minor --exact --force-publish --yes --no-verify-access --dist-tag latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get version number
id: get-version
- name: Git config
run: |
COMMIT_NUMBER=$(git rev-list --count ${{ github.ref }})
PACKAGE_NUMBER=$((COMMIT_NUMBER-1))
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
echo alpha.$PACKAGE_NUMBER
- name: Update version
run: yarn lerna version --conventional-commits --no-git-tag-version --no-push --yes --exact

- name: Format lerna changes
run: yarn format

- name: Get updated version
id: new-version
run: |
NEW_VERSION=$(node -p "require('./lerna.json').version")
echo $NEW_VERSION
echo "::set-output name=version::$PACKAGE_NUMBER"
echo "::set-output name=version::$NEW_VERSION"
- name: Create Tag
uses: mathieudutour/github-tag-action@v6.0
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.get-version.outputs.version }}
tag_prefix: 'alpha.'
commit-message: |
chore(release): v${{ steps.new-version.outputs.version }}
author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
committer: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
branch: lerna-release
signoff: true
title: |
chore(release): v${{ steps.new-version.outputs.version }}
body: |
Release version ${{ steps.new-version.outputs.version }}
21 changes: 21 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Lint PR'

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
# Please look up the latest version from
# https://github.com/amannn/action-semantic-pull-request/releases
- uses: amannn/action-semantic-pull-request@v3.4.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: true
Loading

0 comments on commit 7e26829

Please sign in to comment.