Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build and push pipeline for dev tag #17

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
newman run tests/e2e/http_nameservice.postman_collection.json \
-g ./tests/e2e/dev_env.json \
--global-var issuer_server=${{ secrets.ISSUER_URL }} \
--global-var username=${{ secrets.ISSUER_NODE_USER }} \
--global-var password=${{ secrets.ISSUER_NODE_PASSWROD }} \
--bail --verbose

- name: Run state tests
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/publis-container-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish driver-did-iden3 to Privado AWS ECR
on:
push:
tags:
- 'v*.*.*-dev'
workflow_dispatch:

env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID_PRIVADO_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION_PRIVADO_ID }}
ECR_REPOSITORY: driver-did-iden3

jobs:
build_driver:
env:
STATE_CONTRACT_ADDRESS_MAIN: "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D"
STATE_CONTRACT_ADDRESS_AMOY: "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124"
STATE_CONTRACT_ADDRESS_PRIVADO_MAIN: "0x0DDd8701C91d8d1Ba35c9DbA98A45fe5bA8A877E"
STATE_CONTRACT_ADDRESS_PRIVADO_TEST: "0xE5BfD683F1Ca574B5be881b7DbbcFDCE9DDBAb90"
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 16

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole
role-session-name: GitHubActionsSession

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr

- name: Build file with supported networks
run: |
cd driver-did-iden3
echo -e "polygon:" > resolvers.settings.yaml
echo -e " amoy:" >> resolvers.settings.yaml
echo -e " contractAddress: ${{ env.STATE_CONTRACT_ADDRESS_AMOY }}" >> resolvers.settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_AMOY_NODE_URL }}" >> resolvers.settings.yaml
echo -e " walletKey: ${{ secrets.SIGNER_PRIVATE_KEY }}" >> resolvers.settings.yaml
echo -e " main:" >> resolvers.settings.yaml
echo -e " contractAddress: ${{ env.STATE_CONTRACT_ADDRESS_MAIN }}" >> resolvers.settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_MAIN_NODE_URL }}" >> resolvers.settings.yaml
echo -e " walletKey: ${{ secrets.SIGNER_PRIVATE_KEY }}" >> resolvers.settings.yaml
echo -e "privado:" >> resolvers.settings.yaml
echo -e " main:" >> resolvers.settings.yaml
echo -e " contractAddress: ${{ env.STATE_CONTRACT_ADDRESS_PRIVADO_MAIN }}" >> resolvers.settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_MAIN_NODE_URL }}" >> resolvers.settings.yaml
echo -e " walletKey: ${{ secrets.SIGNER_PRIVATE_KEY }}" >> resolvers.settings.yaml
echo -e " test:" >> resolvers.settings.yaml
echo -e " contractAddress: ${{ env.STATE_CONTRACT_ADDRESS_PRIVADO_TEST }}" >> resolvers.settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_TEST_NODE_URL }}" >> resolvers.settings.yaml
echo -e " walletKey: ${{ secrets.SIGNER_PRIVATE_KEY }}" >> resolvers.settings.yaml

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: build and deploy to DockerHub
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
run: |
cd driver-did-iden3 && \
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ github.ref_name }} \
8 changes: 6 additions & 2 deletions .github/workflows/push-container.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# This workflow builds a docker image and pushes it to GitHub Container Registry
# We need to have this image in public registry for compatibility with universal resolver
name: Publish driver-did-iden3
on:
release:
types: [published]
push:
tags:
- '!v*.*.*-dev'
- 'v*'
workflow_dispatch:

jobs:
Expand Down
150 changes: 122 additions & 28 deletions tests/e2e/http_nameservice.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"info": {
"_postman_id": "301f6d89-ec5b-42a4-b00f-d3005d9988e6",
"_postman_id": "aefc13c9-2239-409c-ba32-b0c10b4ad7c9",
"name": "Nameservice e2e Iden3",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "37022085"
},
"item": [
{
Expand All @@ -12,11 +13,11 @@
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"pm.test(\"Status code is 201\", function () {",
" pm.response.to.have.status(201);",
"});",
"pm.test(\"Content-Type header is application/json\", () => {",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json; charset=utf-8');",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');",
"});",
"",
"pm.test(\"Identifier is not empty\", () => {",
Expand All @@ -27,29 +28,44 @@
"pm.collectionVariables.set(\"issuer_identity\", pm.response.json().identifier);",
"pm.collectionVariables.set(\"issuer_genesis_state\", pm.response.json().state.state)"
],
"type": "text/javascript"
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{password}}",
"type": "string"
},
{
"key": "username",
"value": "{{username}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"did_metadata\":{\n \"method\": \"iden3\",\n \"blockchain\":\"polygon\",\n \"network\": \"amoy\",\n \"type\": \"BJJ\"\n }\n}",
"raw": "{\n \"didMetadata\": {\n \"method\": \"polygonid\",\n \"blockchain\": \"polygon\",\n \"network\": \"amoy\",\n \"type\": \"BJJ\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{issuer_server}}/api/v1/identities",
"raw": "{{issuer_server}}/v1/identities",
"host": [
"{{issuer_server}}"
],
"path": [
"api",
"v1",
"identities"
]
Expand All @@ -64,11 +80,11 @@
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"pm.test(\"Status code is 201\", function () {",
" pm.response.to.have.status(201);",
"});",
"pm.test(\"Content-Type header is application/json\", () => {",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json; charset=utf-8');",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');",
"});",
"",
"pm.test(\"Identifier is not empty\", () => {",
Expand All @@ -78,29 +94,44 @@
"",
"pm.collectionVariables.set(\"user_identity\", pm.response.json().identifier);"
],
"type": "text/javascript"
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{password}}",
"type": "string"
},
{
"key": "username",
"value": "{{username}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"did_metadata\":{\n \"method\": \"iden3\",\n \"blockchain\":\"polygon\",\n \"network\": \"amoy\",\n \"type\": \"BJJ\"\n }\n}",
"raw": "{\n \"didMetadata\": {\n \"method\": \"polygonid\",\n \"blockchain\": \"polygon\",\n \"network\": \"amoy\",\n \"type\": \"BJJ\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{issuer_server}}/api/v1/identities",
"raw": "{{issuer_server}}/v1/identities",
"host": [
"{{issuer_server}}"
],
"path": [
"api",
"v1",
"identities"
]
Expand Down Expand Up @@ -312,21 +343,37 @@
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 202\", function () {",
" pm.response.to.have.status(202);",
"pm.test(\"Status code is 201\", function () {",
" pm.response.to.have.status(201);",
"});",
"pm.test(\"Content-Type header is application/json\", () => {",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json; charset=utf-8');",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');",
"});",
"",
"pm.collectionVariables.set(\"age_claim_non_merklized_id\", pm.response.json().id);",
""
],
"type": "text/javascript"
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{password}}",
"type": "string"
},
{
"key": "username",
"value": "{{username}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
Expand All @@ -339,21 +386,54 @@
}
},
"url": {
"raw": "{{issuer_server}}/api/v1/identities/{{issuer_identity}}/claims",
"raw": "{{issuer_server}}/v1/{{issuer_identity}}/claims",
"host": [
"{{issuer_server}}"
],
"path": [
"api",
"v1",
"identities",
"{{issuer_identity}}",
"claims"
]
}
},
"response": []
},
{
"name": "Publish issuer state",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{password}}",
"type": "string"
},
{
"key": "username",
"value": "{{username}}",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"url": {
"raw": "{{issuer_server}}/v1/{{issuer_identity}}/state/publish",
"host": [
"{{issuer_server}}"
],
"path": [
"v1",
"{{issuer_identity}}",
"state",
"publish"
]
}
},
"response": []
},
{
"name": "KYCAgeCredential(Non merklized) wait for MTP",
"event": [
Expand All @@ -369,7 +449,7 @@
" pm.response.to.have.status(200);",
"});",
"pm.test(\"Content-Type header is application/json\", () => {",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json; charset=utf-8');",
" pm.expect(pm.response.headers.get('Content-Type')).to.eql('application/json');",
"});",
"",
"pm.test(\"Proof section is NOT empty\", function () {",
Expand All @@ -392,14 +472,30 @@
" postman.setNextRequest(pm.info.requestId); // retry the current request",
"}"
],
"type": "text/javascript"
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "{{password}}",
"type": "string"
},
{
"key": "username",
"value": "{{username}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
Expand All @@ -412,14 +508,12 @@
}
},
"url": {
"raw": "{{issuer_server}}/api/v1/identities/{{issuer_identity}}/claims/{{age_claim_non_merklized_id}}",
"raw": "{{issuer_server}}/v1/{{issuer_identity}}/claims/{{age_claim_non_merklized_id}}",
"host": [
"{{issuer_server}}"
],
"path": [
"api",
"v1",
"identities",
"{{issuer_identity}}",
"claims",
"{{age_claim_non_merklized_id}}"
Expand Down
Loading