Skip to content

Commit

Permalink
Merge branch 'main' into decentralgabe-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
decentralgabe authored Jan 9, 2024
2 parents 39d369f + 6b3ef98 commit ea4ee7c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 14 deletions.
14 changes: 11 additions & 3 deletions reports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

This tool reads junit XML reports from different SDKs and generates an HTML report showing which SDKs support which features.

## Current Status

`./cmd/build-html` will iterate over the repos listed in `sdk.go` and download the most recent junit artifact. It will read
all junit results from it and produce a report to `_site/index.html`
all junit results from it and produce a report to `_site/index.html`. For local testing, generate a
[GitHub Personal Access Token](https://github.com/settings/tokens?type=beta) and put it in an environment variable named
`GITHUB_TOKEN`. It doesn't need any special permissions ("Public Repositories (read-only)"). Note that a GitHub app (explained below) can also be used.

`./cmd/sync-vectors` will check the `main` branch of all SDKs listed in `sdks.go` and ensure their vectors match the ones in this repo.
For local testing, a [GitHub App](https://github.com/settings/apps) must be created. Put it's credentials in the following environment variables:

* `CICD_ROBOT_GITHUB_APP_ID` - shown on the edit page of the app, where you are sent right after app creation.
* `CICD_ROBOT_GITHUB_APP_PRIVATE_KEY` - this should be the contents of the private key, not the path to the file.
* `CICD_ROBOT_GITHUB_APP_NAME` - this is used as a display name and should match the name in the URL of the edit page for the app.
* `CICD_ROBOT_GITHUB_APP_INSTALLATION_ID` - click "Install App" on the sidebar while editing the app in GitHub to install it on your own account.
8 changes: 8 additions & 0 deletions reports/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ var (
ghAppIDString = os.Getenv("CICD_ROBOT_GITHUB_APP_ID")
ghAppInstallationIDString = os.Getenv("CICD_ROBOT_GITHUB_APP_INSTALLATION_ID")

ghToken = os.Getenv("GITHUB_TOKEN")

gh *github.Client
ghTransport *ghinstallation.Transport

ghUserName = fmt.Sprintf("%s[bot]", ghAppName)
)

func init() {
if ghToken != "" {
slog.Info("using GITHUB_TOKEN for auth")
gh = github.NewTokenClient(context.Background(), ghToken)
return
}

ghAppID, err := strconv.ParseInt(ghAppIDString, 10, 32)
if err != nil {
slog.Error("invalid or unset app ID. Please set environment variable CICD_ROBOT_GITHUB_APP_ID to a valid integer")
Expand Down
9 changes: 6 additions & 3 deletions reports/sdks.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ func downloadArtifact(ctx context.Context, sdk SDKMeta) ([]byte, error) {
if err != nil {
return nil, err
}
bearer, err := ghTransport.Token(ctx)
if err != nil {
return nil, fmt.Errorf("error getting github token: %v", err)
bearer := ghToken
if ghToken == "" {
bearer, err = ghTransport.Token(ctx)
if err != nil {
return nil, fmt.Errorf("error getting github token: %v", err)
}
}
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", bearer))
resp, err := http.DefaultClient.Do(req)
Expand Down
3 changes: 3 additions & 0 deletions reports/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ func ConfigureGitAuth() error {
}
gitCredentialStoreFile = f.Name()

if ghTransport == nil {
panic("syncing vecotrs with a PAT not supported. See reports/README.md for instructions to create a GitHub app.")
}
authToken, err := ghTransport.Token(context.Background())
if err != nil {
slog.Error("error getting github auth token")
Expand Down
4 changes: 2 additions & 2 deletions web5-test-vectors/did_jwk/resolve.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
},
"didDocumentMetadata": {}
},
"errors": false
"errors": true
}
]
}
}
21 changes: 15 additions & 6 deletions web5-test-vectors/did_web/resolve.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
}
},
"output": {
"didResolutionMetadata": {},
"didDocument": {
"id": "did:web:example.com"
}
},
"didDocumentMetadata": {},
"didResolutionMetadata": {}
}
},
{
Expand All @@ -29,10 +30,11 @@
}
},
"output": {
"didResolutionMetadata": {},
"didDocument": {
"id": "did:web:w3c-ccg.github.io:user:alice"
}
},
"didDocumentMetadata": {},
"didResolutionMetadata": {}
}
},
{
Expand All @@ -46,10 +48,11 @@
}
},
"output": {
"didResolutionMetadata": {},
"didDocument": {
"id": "did:web:example.com%3A3000:user:alice"
}
},
"didDocumentMetadata": {},
"didResolutionMetadata": {}
}
},
{
Expand All @@ -58,6 +61,8 @@
"didUri": "did:dht:gb46emk73wkenrut43ii67a3o5qctojcaucebth7r83pst6yeh8o"
},
"output": {
"didDocument": null,
"didDocumentMetadata": {},
"didResolutionMetadata": {
"error": "methodNotSupported"
}
Expand All @@ -70,6 +75,8 @@
"didUri": "did:web:doesnotexist.com"
},
"output": {
"didDocument": null,
"didDocumentMetadata": {},
"didResolutionMetadata": {
"error": "notFound"
}
Expand All @@ -82,6 +89,8 @@
"didUri": "did:web:invalidcharø.com"
},
"output": {
"didDocument": null,
"didDocumentMetadata": {},
"didResolutionMetadata": {
"error": "invalidDid"
}
Expand Down

0 comments on commit ea4ee7c

Please sign in to comment.