diff --git a/.github/workflows/CI.md b/.github/workflows/CI.md new file mode 100644 index 000000000..ccb7ae575 --- /dev/null +++ b/.github/workflows/CI.md @@ -0,0 +1,22 @@ +--- +cwd: ../.. +shell: bash +skipPrompts: true +--- + +## CI/CD + +Run all tests with coverage reports. + +```sh {"id":"01J5XTG2WKVR4WG7B2FNPF6VZT","name":"ci-test"} +export SHELL="/bin/bash" +export TZ="UTC" +TAGS="test_with_docker" make test/coverage +make test/coverage/func +``` + +Run parser/serializer against a large quantity of markdown files. + +```sh {"id":"01J5XXFEGPJ5ZJZERQ5YGBBRN8","name":"ci-test-robustness"} +make test/robustness +``` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a334a579b..bc6d5f372 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,11 +62,12 @@ jobs: go build -o runme main.go ./runme --version - name: Test - run: | - export SHELL=/bin/bash - export TZ=UTC - TAGS="test_with_docker" make test/coverage - make test/coverage/func + uses: stateful/runme-action@v2 + with: + workflows: ci-test + env: + NO_COLOR: true + FROM_CI: true if: ${{ matrix.os == 'ubuntu-latest' }} - name: Test run: | @@ -80,6 +81,9 @@ jobs: name: coverage path: cover.out if-no-files-found: error + - name: Debug Build + uses: stateful/vscode-server-action@v1 + if: failure() test-in-docker: name: Test in Docker @@ -93,6 +97,10 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Test run: make test-docker + - name: Test parser + uses: stateful/runme-action@v2 + with: + workflows: test-docker build-and-robustness-test: name: Test parser against vast amount of READMEs @@ -113,17 +121,19 @@ jobs: - name: Install dependencies run: make install/dev - name: Build - run: | - go build -o runme main.go - ./runme --version - - name: Run robustness test - run: make test/robustness + uses: stateful/runme-action@v2 + with: + workflows: build + - name: Test parser + uses: stateful/runme-action@v2 + with: + workflows: | + build + ci-test-robustness timeout-minutes: 5 - - name: 🐛 Debug Build + - name: Debug Build uses: stateful/vscode-server-action@v1.1.0 if: failure() - with: - timeout: "300000" sonarcloud: if: ${{github.actor != 'dependabot[bot]'}} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 61209d96b..8c8c1dca9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,7 +149,7 @@ TAGS="test_with_docker" make test Please notice that our tests include integration tests which depend on additional software like Python or node.js. If you don't want to install them or tests fail because of different versions, you can run all tests in a Docker container: -```sh {"id":"01J5P9MKFZ4SRS1VE6JBKG3EAK","terminalRows":"15"} +```sh {"id":"01J5P9MKFZ4SRS1VE6JBKG3EAK","name":"test-docker","terminalRows":"15"} make test-docker ``` diff --git a/Makefile b/Makefile index 8dc4eb9cf..1fc5bba86 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,7 @@ test/update-snapshots: .PHONY: test/robustness test/robustness: + ./runme --version find "$$GOPATH/pkg/mod/github.com" -name "*.md" | grep -v "\/\." | xargs dirname | uniq | xargs -n1 -I {} ./runme fmt --project {} > /dev/null .PHONY: coverage/html diff --git a/internal/tls/tls.go b/internal/tls/tls.go index fd607425b..2e6cfbc28 100644 --- a/internal/tls/tls.go +++ b/internal/tls/tls.go @@ -92,7 +92,7 @@ func LoadOrGenerateConfig(certFile, keyFile string, logger *zap.Logger) (*tls.Co if config != nil { if ttl, err := validateTLSConfig(config); err == nil { - logger.Info("certificate is valid", zap.Duration("ttl", ttl)) + logger.Info("certificate is valid", zap.Duration("ttl", ttl), zap.String("certFile", certFile), zap.String("keyFile", keyFile)) return config, nil } logger.Warn("failed to validate TLS config; generating new cartificate", zap.Error(err)) diff --git a/internal/tui/model_list.go b/internal/tui/model_list.go index 83e04e2d3..9475e8457 100644 --- a/internal/tui/model_list.go +++ b/internal/tui/model_list.go @@ -268,7 +268,7 @@ func (m ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } cmdSlice := []string{"git", "checkout", "-b", m.selected.Suggestion()} - fmt.Printf("Output: %s", cmdSlice) + _, _ = fmt.Printf("Output: %s", cmdSlice) cmd := exec.Command(cmdSlice[0], cmdSlice[1:]...) cmd.Dir = cwd @@ -300,7 +300,7 @@ func (m ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case confirmMsg: m.confirmed = true - fmt.Printf("Output: %s", msg.response) + _, _ = fmt.Printf("Output: %s", msg.response) return m, tea.Quit case errorMsg: