Skip to content

Commit

Permalink
Leverage Runme's GHA (#658)
Browse files Browse the repository at this point in the history
Rewiring Runme's CI to leverage tasks specified in its documentation.
  • Loading branch information
sourishkrout authored Aug 22, 2024
1 parent 97faded commit 4b01d78
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 17 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/CI.md
Original file line number Diff line number Diff line change
@@ -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
```
36 changes: 23 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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]'}}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/tls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions internal/tui/model_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4b01d78

Please sign in to comment.