Skip to content

Commit

Permalink
initial testing stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rlex committed Dec 10, 2023
1 parent e7f9d7c commit 3adcb67
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI
'on':
pull_request:
push:
branches:
- master

defaults:
run:
working-directory: 'rlex.k3s'

jobs:

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'rlex.k3s'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install yamllint

- name: Lint code.
run: |
yamllint .
molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
distro:
# - rockylinux8
- ubuntu2004
- ubuntu2204
- debian11

steps:
- name: Checkout codebase
uses: actions/checkout@v2
with:
path: 'rlex.k3s'

- name: Setup python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install ansible molecule molecule-plugins[docker] docker

- name: Run Molecule tests.
run: molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
20 changes: 20 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- name: Converge
hosts: all
become: true

vars:
k3s_test_var: true

pre_tasks:
- name: Update apt cache.
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
when: ansible_os_family == 'Debian'
changed_when: false

roles:
- role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
test_var: test
19 changes: 19 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
role_name_check: 1
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
1 change: 1 addition & 0 deletions molecule/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
molecule-plugins[docker]

0 comments on commit 3adcb67

Please sign in to comment.