You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> You will need to edit the files in `molecule/default` directory (please do not commit those changes)
68
+
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.
69
+
70
+
For more information on using Molecule, see the [Molecule documentation](https://molecule.readthedocs.io/).
Copy file name to clipboardexpand all lines: README.md
+73
Original file line number
Diff line number
Diff line change
@@ -165,6 +165,7 @@ Same example as above, but runner will be added to an organization and deployed
165
165
```
166
166
167
167
If you have a Github Enterprise Cloud license and you want to manage all the self-hosted runners from the enterprise:
168
+
168
169
```yaml
169
170
---
170
171
- name: Install GitHub Actions Runner
@@ -221,6 +222,78 @@ In this example the Ansible role will uninstall the runner service and unregiste
221
222
- role: monolithprojects.github_actions_runner
222
223
```
223
224
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/).
0 commit comments