forked from anon-aadhaar/privado-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring; support new non-merklized issuer contract
- Loading branch information
1 parent
108080a
commit 98d14d7
Showing
105 changed files
with
3,709 additions
and
5,630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.git | ||
.github | ||
|
||
.dockerignore | ||
.gitignore | ||
docker-compose.yaml | ||
|
||
build | ||
tests | ||
|
||
|
||
.golangci.yml | ||
README.md | ||
first-run.sh | ||
|
||
// Ignore client for backend build | ||
client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
SUPPORTED_STATE_CONTRACTS="137=0xdc2A724E6bd60144Cde9DEC0A38a26C619d84B90,80001=0x134B1BE34911E39A8397ec6289782989729807a4" | ||
SUPPORTED_RPC="137=<RPC_POLYGON_MAINNET>,80001=<RPC_POLYGON_MUMBAI>" | ||
|
||
ISSUERS="<ISSUER_DID>" | ||
|
||
MONGODB_CONNECTION_STRING="mongodb://mongodb:27017/credentials" | ||
|
||
EXTERNAL_HOST="<NGROK_URL>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Lint | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21.x | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.55.2 | ||
args: --timeout=5m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: e2e hardhat tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run_e2e: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build docker container | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: build/Dockerfile | ||
load: true | ||
tags: onchain-non-merklized-issuer-demo:latest | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
|
||
- name: Run container | ||
run: | | ||
docker run -d -p 8080:8080 \ | ||
--name onchain-non-merklized-issuer-demo onchain-non-merklized-issuer-demo:latest | ||
- name: Run Newman | ||
run: | | ||
newman run tests/e2e/e2e.postman_collection.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Publish | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish_onchain-non-merklized-issuer-demo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Determine tag | ||
id: tag | ||
run: | | ||
ref=$(echo ${{ github.ref }} | cut -d'/' -f3) | ||
echo "Original ref: $ref" | ||
if [[ "$ref" == "master" ]]; then | ||
echo "::set-output name=tag::latest" | ||
elif [[ "$ref" == "develop" ]]; then | ||
echo "::set-output name=tag::develop" | ||
else | ||
echo "::set-output name=tag::$ref" | ||
fi | ||
- name: Build and Deploy to ghcr.io | ||
run: | | ||
tag=${{ steps.tag.outputs.tag }} | ||
echo "Using tag: $tag" | ||
docker buildx build -f build/Dockerfile --push \ | ||
--platform linux/amd64,linux/arm64 \ | ||
-t ghcr.io/${{ github.repository }}:${tag} . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
on: | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
workflow_dispatch: | ||
jobs: | ||
repo-sync: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: actions-template-sync | ||
uses: AndreasAugustin/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
source_repo_path: iden3/go-service-template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Go unit tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Run unit tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: | ||
- 1.21.x | ||
|
||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache Go Modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go-${{ matrix.go-version }}- | ||
- name: Run tests | ||
run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
# Bin files | ||
onchain-non-merklized-issuer-demo | ||
|
||
# IDE | ||
.vscode | ||
|
||
# Docker volumes | ||
data | ||
|
||
# Env files | ||
.env | ||
.env.* | ||
|
||
!*.env.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
service: | ||
golangci-lint-version: 1.x.x | ||
|
||
run: | ||
tests: false | ||
|
||
timeout: 2m | ||
skip-dirs: | ||
- vendor | ||
|
||
linters-settings: | ||
govet: | ||
check-shadowing: false | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
misspell: | ||
locale: US | ||
lll: | ||
line-length: 140 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- style | ||
- performance | ||
|
||
linters: | ||
enable: | ||
- bodyclose | ||
- megacheck | ||
- revive | ||
- govet | ||
- unconvert | ||
- megacheck | ||
- structcheck | ||
- gas | ||
- gocyclo | ||
- dupl | ||
- misspell | ||
- unparam | ||
- varcheck | ||
- deadcode | ||
- typecheck | ||
- ineffassign | ||
- varcheck | ||
- stylecheck | ||
- gochecknoinits | ||
- exportloopref | ||
- gocritic | ||
- nakedret | ||
- gosimple | ||
- prealloc | ||
- gci | ||
- errcheck | ||
- gofmt | ||
- goimports | ||
- unused | ||
fast: false | ||
disable-all: true | ||
|
||
issues: | ||
exclude-rules: | ||
- text: "exported: type name will be used as" | ||
linters: | ||
- revive | ||
- text: "unexported-return:" | ||
linters: | ||
- revive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Build the application | ||
FROM --platform=$BUILDPLATFORM golang:1.21.3-bookworm as base | ||
ARG build_tags="" | ||
|
||
WORKDIR /build | ||
|
||
COPY . . | ||
RUN go mod download | ||
|
||
ARG TARGETPLATFORM | ||
ARG TARGETARCH | ||
ARG TARGETOS | ||
RUN echo "TARGETARCH: $TARGETARCH"; \ | ||
echo "TARGETOS: $TARGETOS"; \ | ||
echo "TARGETPLATFORM: $TARGETPLATFORM"; | ||
RUN GOARCH=$TARGETARCH GOOS=$TARGETOS go build -tags="${build_tags}" -o ./onchain-non-merklized-issuer-demo main.go | ||
|
||
# Run the application | ||
FROM alpine:3.18.4 | ||
|
||
RUN apk add --no-cache libstdc++ gcompat libgomp; \ | ||
apk add --update busybox>1.3.1-r0; \ | ||
apk add --update openssl>3.1.4-r1 | ||
|
||
RUN apk add doas; \ | ||
adduser -S dommyuser -D -G wheel; \ | ||
echo 'permit nopass :wheel as root' >> /etc/doas.d/doas.conf; | ||
RUN chmod g+rx,o+rx / | ||
|
||
WORKDIR /app | ||
|
||
COPY ./keys /app/keys | ||
COPY --from=base /build/onchain-non-merklized-issuer-demo /app/onchain-non-merklized-issuer-demo | ||
|
||
# Command to run | ||
ENTRYPOINT ["/app/onchain-non-merklized-issuer-demo"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.PHONY: run | ||
run: build | ||
./onchain-non-merklized-issuer-demo | ||
|
||
.PHONY: build | ||
build: | ||
go build -o onchain-non-merklized-issuer-demo . | ||
|
||
.PHONY: test | ||
test: | ||
go test -v ./... | ||
|
||
.PHONY: lint | ||
lint: | ||
golangci-lint run |
Oops, something went wrong.