This document explains how to test Forma's GitHub Actions workflows locally before pushing to the repository.
-
Docker: Make sure Docker is installed and running on your system
-
act: A tool for running GitHub Actions locally
- Windows:
winget install nektos.act - macOS/Linux:
brew install act - Linux (alternative):
curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
- Windows:
We've created scripts to simplify local workflow testing:
# Test the core release workflow (Forma.Core, Forma.Mediator, Forma.Decorator)
.\scripts\test-workflow.ps1 -WorkflowType core -Version 2.0.0-test
# Test a specific component release workflow
.\scripts\test-workflow.ps1 -WorkflowType component -Component chains -Version 1.3.0-test
.\scripts\test-workflow.ps1 -WorkflowType component -Component pubsub -Version 1.1.0-test# Make the script executable
chmod +x ./scripts/test-workflow.sh
# Test the core release workflow
./scripts/test-workflow.sh -t core -v 2.0.0-test
# Test a specific component release workflow
./scripts/test-workflow.sh -t component -c chains -v 1.3.0-test
./scripts/test-workflow.sh -t component -c pubsub -v 1.1.0-testThe scripts perform the following operations:
- Verify that Docker is running
- Verify that
actis installed - Create a temporary event file that simulates a workflow dispatch
- Run the workflow with
--dry-runto show what would happen - Ask for confirmation before actually running the workflow
- Run the workflow in a Docker container
actuses Docker images to simulate GitHub Actions environments- Some aspects of the official GitHub runners may differ from the local environment
- Actions that require access to GitHub APIs may require authentication tokens
- Git operations (tag creation) and GitHub CLI operations (release creation) may not work in the containerized environment
- The new automated release features (Git tags and GitHub releases) are best tested in actual CI/CD environments
The scripts test the core workflow functionality including:
- NuGet package building and publishing
- Version detection using Nerdbank.GitVersioning
- Workflow job dependencies and conditions
The following features require actual GitHub environment:
- Git tag creation and pushing
- GitHub release creation
- Repository permissions and authentication
If you encounter issues:
- Make sure Docker is running
- Verify that
actis installed correctly - For Docker image issues, try
act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 - For more memory:
act --container-options="-e DOCKER_OPTS=--memory=4g"