@domenico
To test GitHub CI locally, you can use a tool like act
which allows you to run GitHub Actions locally on your own machine. Here is a step-by-step guide on how to use act
to test GitHub CI locally:
- Install act using the following command:
- Navigate to the root directory of your GitHub repository where the .github/workflows directory is located.
- Run the following command to execute your GitHub Actions workflow locally:
- act will read the GitHub Actions configuration from the .github/workflows directory and simulate the execution of the workflow on your local machine.
- You can also specify which workflow to run if your repository has multiple workflows by providing the workflow file name as an argument:
1
|
act -a <workflow-file-name>.yml
|
- You can also pass in event payloads as JSON files as inputs to your workflows using the --eventpath flag:
1
|
act --eventpath path/to/event-payload.json
|
- Once the workflow execution is complete, act will output the results of the workflow on your terminal.
By following these steps, you can easily test your GitHub CI workflows locally before pushing your changes to the remote repository. This allows you to catch any issues or errors early in the development process.