From 24b36d0a65cba10f7f306a689c5ab746b08bc667 Mon Sep 17 00:00:00 2001 From: finn Date: Thu, 12 Oct 2023 18:36:03 -0700 Subject: [PATCH] self test in own CI and minor fixes to make the tests do what they should do --- .github/workflows/self-test.yaml | 14 ++++++++++++++ action.yml | 2 +- cmd/web5-spec-test/report-template.md | 7 ++----- cmd/web5-spec-test/reports.go | 4 ++-- 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/self-test.yaml diff --git a/.github/workflows/self-test.yaml b/.github/workflows/self-test.yaml new file mode 100644 index 0000000..67ea4a5 --- /dev/null +++ b/.github/workflows/self-test.yaml @@ -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/ diff --git a/action.yml b/action.yml index 85fc273..8d3c761 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/cmd/web5-spec-test/report-template.md b/cmd/web5-spec-test/report-template.md index 51e334f..ff6c359 100644 --- a/cmd/web5-spec-test/report-template.md +++ b/cmd/web5-spec-test/report-template.md @@ -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 }} diff --git a/cmd/web5-spec-test/reports.go b/cmd/web5-spec-test/reports.go index 364ed0a..8791469 100644 --- a/cmd/web5-spec-test/reports.go +++ b/cmd/web5-spec-test/reports.go @@ -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) @@ -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 }