Skip to content

Files

Latest commit

 

History

History
106 lines (68 loc) · 3.59 KB

test-go-integration-task.md

File metadata and controls

106 lines (68 loc) · 3.59 KB

"Test Integration" workflow (Go, Task)

Run Python integration tests for a Go module.

This is the version of the workflow for projects using the Task task runner tool.

Installation

Workflow

Install the test-go-integration-task.yml GitHub Actions workflow to .github/workflows/

Assets

  • Taskfile.yml - Test runner task.
    • Install to: repository root (or merge into the existing Taskfile.yml).
  • Taskfile.yml - Build task.
    • Merge into Taskfile.yml.
  • Taskfile.yml - Dependencies installation task.
    • Merge into Taskfile.yml
  • __init__.py - Template for Python integration tests.
    • Install to: tests/
  • test_all.py - Template for Python integration tests.
    • Install to: tests/
  • pytest.ini - pytest configuration file.
    • Install to: tests/

Dependencies

The Python dependencies are managed by Poetry.

Install Poetry by following these instructions:
https://python-poetry.org/docs/#installation

If your project does not already use Poetry, you can initialize the pyproject.toml file using these commands:

poetry init --python="^3.9" --dev-dependency="pytest@^8.3.5" --dev-dependency="invoke@^1.7.0"
poetry install

If already using Poetry, add the tool using this command:

poetry add --dev "pytest@^8.3.5" "invoke@^1.7.0"

Commit the resulting pyproject.toml and poetry.lock files.

Configuration

Workflow

Configure the version of Go used for development of the project in the env.GO_VERSION field of test-go-integration-task.yml.

Configure the version of Python used for development of the project in the env.PYTHON_VERSION field of test-go-integration-task.yml.

Test helpers

Define the project's executable filename in the executable_path variable in test_all.py.

.gitignore

Add the following to .gitignore:

__pycache__/
<application executable>
<application executable>.exe

(where "<application executable>" is the filename of the Go application's executable)

Readme badge

Markdown badge:

[![Test Integration status](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/test-go-integration-task.yml/badge.svg)](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/test-go-integration-task.yml)

Replace the TODO_REPO_OWNER and TODO_REPO_NAME placeholders in the URLs with the final repository owner and name (example).


Asciidoc badge:

image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/test-go-integration-task.yml/badge.svg["Test Integration status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/test-go-integration-task.yml"]

Define the {repository-owner} and {repository-name} attributes and use them throughout the readme (example).

Commit message

Add CI workflow to run integration tests

On every push and pull request that affects relevant files, run the integration tests.

PR message

On every push and pull request that affects relevant files, run the integration tests.