From 15958b6e557e15e3bfeefc88467b393c1764dc0e Mon Sep 17 00:00:00 2001 From: Mirko Boehm Date: Sun, 1 Feb 2026 12:05:28 +0100 Subject: [PATCH 1/3] Add action to run tests and selftests on PRs Closes #27 --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3d6d3ef --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.21' + - name: Install xmllint + run: sudo apt-get install -y libxml2-utils + - name: Build + run: go build ./... + - name: Test + run: go test ./... + - name: Selftest + run: make selftest From 98b923054248a55b8cde6c6daf6bffe797a9545d Mon Sep 17 00:00:00 2001 From: Mirko Boehm Date: Sun, 1 Feb 2026 12:13:33 +0100 Subject: [PATCH 2/3] Visualize test results from GitHub action --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d6d3ef..20e2dc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,9 @@ on: jobs: test: runs-on: ubuntu-latest + permissions: + contents: read + checks: write steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -22,3 +25,10 @@ jobs: run: go test ./... - name: Selftest run: make selftest + - name: Publish Test Results + uses: dorny/test-reporter@v1 + if: always() + with: + name: Selftest Results + path: results.xml + reporter: java-junit From 1a5484cb64f79a785a51679a9bdd835948d86186 Mon Sep 17 00:00:00 2001 From: Mirko Boehm Date: Sun, 1 Feb 2026 12:34:49 +0100 Subject: [PATCH 3/3] Add test results badge to the front page README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1056edb..7ade549 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # shelldoc: Test Unix shell commands in Markdown documentation +[![CI](https://github.com/mirkoboehm/shelldoc/actions/workflows/ci.yml/badge.svg)](https://github.com/mirkoboehm/shelldoc/actions/workflows/ci.yml) + Markdown is widely used for documentation and README.md files that explain how to use or build some software. Such documentation often contains shell commands that explain how to build the software or how to