Skip to content

test role via molecule #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---

name: CI

on:
push:
pull_request:

env:
galaxy-name: "cvmfs_contrib.cvmfs_client"

jobs:

molecule:
runs-on: ubuntu-latest

strategy:
matrix:
distro: [centos8]
fail-fast: false

steps:

- uses: actions/checkout@v2
with:
path: ${{ env.galaxy-name }}

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Upgrade pip
run: |
pip install --upgrade pip wheel
pip --version

- name: Install requirements
run: |
pip install --use-feature=2020-resolver -r requirements.txt
working-directory: ${{ env.galaxy-name }}

# See https://github.com/geerlingguy/raspberry-pi-dramble/issues/166
- name: Force GitHub Actions' docker daemon to use vfs.
run: |
sudo systemctl stop docker
echo '{"cgroup-parent":"/actions_job","storage-driver":"vfs"}' | sudo tee /etc/docker/daemon.json
sudo systemctl start docker

- name: Run molecule
run: molecule test
working-directory: ${{ env.galaxy-name }}
env:
MOLECULE_DISTRO: ${{ matrix.distro }}

# release:
# name: Publish to ansible-galaxy
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
# needs: [pre-commit, molecule]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: robertdebock/galaxy-action@1.0.3
# with:
# galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
17 changes: 17 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

- name: Converge
hosts: all
become: true

pre_tasks:
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=600
when: ansible_os_family == 'Debian'

roles:
- role: cvmfs_contrib.cvmfs_client
vars:
cvmfs_client_configure_storage: false
cvmfs_cache_size: "1000" # small cache size for CI
cvmfs_http_proxy: "DIRECT"
20 changes: 20 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

dependency:
name: galaxy
options:
role-file: ansible-role-requirements.yml
driver:
name: docker
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1804}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
playbooks:
converge: converge.yml
9 changes: 9 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

- name: Verify
hosts: all
become: true

tasks:
- name: Test loading the Compute Canada module environment
shell: source /cvmfs/soft.computecanada.ca/config/profile/bash.sh
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# for running tests
molecule[docker]~=3.3.0
docker~=4.4.4
ansible~=4.8.0