Skip to content

Commit 54d61fd

Browse files
docs: update readme
1 parent b95b43c commit 54d61fd

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ Same example as above, but runner will be added to an organization and deployed
165165
```
166166
167167
If you have a Github Enterprise Cloud license and you want to manage all the self-hosted runners from the enterprise:
168+
168169
```yaml
169170
---
170171
- name: Install GitHub Actions Runner
@@ -221,6 +222,78 @@ In this example the Ansible role will uninstall the runner service and unregiste
221222
- role: monolithprojects.github_actions_runner
222223
```
223224

225+
## Testing with Molecule
226+
227+
[Molecule](https://molecule.readthedocs.io/) is a testing framework for Ansible. This section is for code contributors.
228+
229+
### Prerequisites
230+
231+
* Python
232+
* Docker
233+
* Ansible
234+
* Molecule
235+
236+
### Installation
237+
238+
1. Install Python, Docker, and Ansible if you haven't already.
239+
2. Install Molecule and its Docker driver with pip:
240+
241+
```bash
242+
pip install molecule[docker]
243+
```
244+
Sure, here's a basic example of how you might structure a README to explain how to test the `monolithprojects.github_actions_runner` Ansible role with Molecule:
245+
246+
```markdown
247+
# monolithprojects.github_actions_runner
248+
249+
This is an Ansible role for setting up GitHub Actions runners.
250+
251+
## Testing with Molecule
252+
253+
[Molecule](https://molecule.readthedocs.io/) is a testing framework for Ansible that we use to test the `monolithprojects.github_actions_runner` role.
254+
255+
### Prerequisites
256+
257+
- Python
258+
- Docker
259+
- Ansible
260+
- Molecule
261+
262+
### Installation
263+
264+
1. Install Python, Docker, and Ansible if you haven't already.
265+
2. Install Molecule and its Docker driver with pip:
266+
267+
```bash
268+
pip install molecule[docker]
269+
```
270+
271+
### Running Tests
272+
273+
1. Navigate to the role's directory:
274+
275+
```bash
276+
cd path/to/monolithprojects.github_actions_runner
277+
```
278+
279+
2. Set Environment variables
280+
281+
```bash
282+
export PERSONAL_ACCESS_TOKEN=your_github_pat # Your Personal Access Token to Github
283+
export GITHUB_ACCOUNT=your_account # Your Github Account
284+
export GITHUB_ACCOUNT=your_repository # Github Repository where you want to setup the Runner
285+
```
286+
287+
3. Run Molecule:
288+
289+
```bash
290+
molecule test
291+
```
292+
293+
This will run the molecule test, create a Docker container, run the role against it, run any associated `default` tests (see [molecule/default](./molecule/default) directory), and then destroy the container.
294+
295+
For more information on using Molecule, see the [Molecule documentation](https://molecule.readthedocs.io/).
296+
224297
## License
225298

226299
MIT

0 commit comments

Comments
 (0)