Skip to content

Commit

Permalink
self test in own CI
Browse files Browse the repository at this point in the history
and minor fixes to make the tests do what they should do
  • Loading branch information
finn-tbd committed Oct 13, 2023
1 parent 85edf30 commit 24b36d0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/self-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: build

on: [push]

jobs:
self-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- name: clone test target
run: git clone -b web5-component-tests https://github.com/TBD54566975/web5-js.git web5-js
- name: self test
run: go run ./cmd/web5-spec-test web5-js/
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
- run: |
spec_test_version="$(basename "${GITHUB_ACTION_PATH}")"
bin="${GITHUB_ACTION_PATH}/web5-spec-test"
wget -O "${bin}" "https://github.com/TBD54566975/web5-spec/releases/download/${spec_test_version}/web5-spec-test-linux-amd64"
wget --quiet -O "${bin}" "https://github.com/TBD54566975/web5-spec/releases/download/${spec_test_version}/web5-spec-test-linux-amd64"
chmod +x "${bin}"
"${bin}"
shell: bash
7 changes: 2 additions & 5 deletions cmd/web5-spec-test/report-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
SDK: [{{ .TestServerID.Name }}]({{ .TestServerID.Url }}) ({{ .TestServerID.Language }})

| Test | Pass | Details |
| ---- | ---- | ------- |

{{ range $test, $result := .Results }}
| {{ $test }} | {{ if $result == nil }}:heavy_check_mark: | {{ else }}:x: | ```{{ $result }}{{ end }} |
{{ end }}
| ---- | ---- | ------- |{{ range $test, $result := .Results }}
| `{{ $test }}` | {{ if $result }}:heavy_check_mark: | {{ else }}:x: | -```{{ $result }}{{ end }} |{{ end }}
4 changes: 2 additions & 2 deletions cmd/web5-spec-test/reports.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (r Report) Text() string {
return b.String()
}

var mdTemplate = template.Must(template.New("").ParseFS(reportTemplate, "*.md"))
var mdTemplate = template.Must(template.New("").ParseFS(reportTemplate, "report-template.md"))

func (r Report) WriteMarkdown(filename string) error {
f, err := os.Create(filename)
Expand All @@ -61,7 +61,7 @@ func (r Report) WriteMarkdown(filename string) error {
}
defer f.Close()

err = mdTemplate.Execute(f, r)
err = mdTemplate.ExecuteTemplate(f, "report-template.md", r)
if err != nil {
return err
}
Expand Down

0 comments on commit 24b36d0

Please sign in to comment.