diff --git a/.github/workflows/CI.md b/.github/workflows/CI.md index 828895a6a..72d6d0c18 100644 --- a/.github/workflows/CI.md +++ b/.github/workflows/CI.md @@ -5,22 +5,34 @@ runme: version: v3 shell: bash skipPrompts: true +terminalRows: 26 --- ## CI/CD Run all tests with coverage reports. -```sh {"id":"01J5XTG2WKVR4WG7B2FNPF6VZT","name":"ci-test","promptEnv":"no"} +```sh {"id":"01J5XTG2WKVR4WG7B2FNPF6VZT","name":"ci-coverage","promptEnv":"no"} unset RUNME_SESSION_STRATEGY RUNME_TLS_DIR RUNME_SERVER_ADDR export SHELL="/bin/bash" export TZ="UTC" -export GOCOVERDIR="." export TAGS="test_with_docker" make test/coverage make test/coverage/func ``` +Run txtar-based CLI e2e tests without coverage reports (Go's warnings are getting in the way). + +```sh {"id":"01JAJYWF198MWQXJBADFJVJGXM","name":"ci-txtar"} +unset RUNME_SESSION_STRATEGY RUNME_TLS_DIR RUNME_SERVER_ADDR +export SHELL="/bin/bash" +export TZ="UTC" +export TAGS="test_with_txtar" +export RUN="^TestRunme\w*" +export PKGS="github.com/stateful/runme/v3" +make test +``` + Run parser/serializer against a large quantity of markdown files. ```sh {"id":"01J5XXFEGPJ5ZJZERQ5YGBBRN8","name":"ci-test-parser","promptEnv":"no"} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55d045e05..6ace6e6c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,10 +60,18 @@ jobs: run: | go build -o runme main.go ./runme --version - - name: Test + - name: Test with coverage + uses: stateful/runme-action@v2 + with: + workflows: ci-coverage + env: + NO_COLOR: true + FROM_CI: true + if: ${{ matrix.os == 'ubuntu-latest' }} + - name: Test without coverage (txtar) uses: stateful/runme-action@v2 with: - workflows: ci-test + workflows: ci-txtar env: NO_COLOR: true FROM_CI: true diff --git a/.vscode/settings.json b/.vscode/settings.json index a18592e30..d37c537ed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,7 +13,7 @@ "--proto_path=/usr/local/include/protoc" ] }, - "go.buildTags": "test_with_docker" + "go.buildTags": "test_with_docker,test_with_txtar" // Uncomment if you want to work on files in ./web. // "go.buildTags": "js,wasm", // Uncomment if you want to check compilation errors on Windows. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e16505fb..58a642a0d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -142,10 +142,11 @@ pre-commit run --files */** Tests are run with Go's default test runner wrapped in Makefile targets. So, for example, you can run all tests with: -```sh {"id":"01HF7BT3HEQBTBM9SSTS88ZSCF","name":"test","terminalRows":"15"} +```sh {"id":"01HF7BT3HEQBTBM9SSTS88ZSCF","name":"test","promptEnv":"no","terminalRows":"15"} unset RUNME_SESSION_STRATEGY RUNME_TLS_DIR RUNME_SERVER_ADDR go clean -testcache -TAGS="test_with_docker" make test +export TAGS="test_with_txtar" +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: diff --git a/Makefile b/Makefile index 83f5bcc35..3cb26410e 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ test/execute: build .PHONY: test/coverage test/coverage: PKGS ?= "./..." test/coverage: RUN ?= .* +test/coverage: GOCOVERDIR ?= "." test/coverage: TAGS ?= "" # e.g. TAGS="test_with_docker" # It depends on the build target because the runme binary # is used for tests, for example, "runme env dump". diff --git a/main_test.go b/main_test.go index 6d2257f1c..a206f27d5 100644 --- a/main_test.go +++ b/main_test.go @@ -1,4 +1,4 @@ -//go:build !windows +//go:build !windows && test_with_txtar package main