Skip to content

Commit

Permalink
ci: add default-vagrant workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
juju4 committed Oct 28, 2023
1 parent 18965df commit d7de97b
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/default-vagrant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
name: default-vagrant

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
include:
- molecule_distro: 'jaredeh/ubuntu2204-server'
experimental: false
- molecule_distro: 'generic/ubuntu2004'
experimental: false
- molecule_ditro: 'debian/bullseye64'
experimental: false
env:
ANSIBLE_CALLBACKS_ENABLED: profile_tasks
MOLECULE_NO_LOG: "false"
MOLECULE_SUITE: "vagrant"
ANSIBLE_ROLE: juju4.misp

steps:
- uses: actions/checkout@v3
with:
path: ${{ env.ANSIBLE_ROLE }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install 'molecule-plugins[vagrant]' ansible-lint flake8 testinfra ansible
mkdir -p $HOME/.ansible/roles && ln -s $GITHUB_WORKSPACE/$ANSIBLE_ROLE $HOME/.ansible/roles/
# template search only in currently executed role root/tasks/templates folders and molecule scenario root/templates folders
cp $GITHUB_WORKSPACE/$ANSIBLE_ROLE/templates/misp-snuffleupagus-rules.ini.j2 $GITHUB_WORKSPACE/$ANSIBLE_ROLE/molecule/default/
- name: Set up libvirt
run: |
sudo apt-get update
sudo apt-get install -y \
bridge-utils \
dnsmasq-base \
ebtables \
libarchive-tools \
libguestfs-tools \
libvirt-clients \
libvirt-daemon \
libvirt-daemon-system \
qemu-kvm \
qemu-utils \
;
sudo apt-get install -y \
libvirt-dev \
libz-dev \
;
# start daemon
sudo systemctl start libvirtd
# add user to group
sudo usermod -a -G libvirt $USER
- name: Set up vagrant-libvirt
run: |
vagrant plugin install vagrant-libvirt
- name: Fetch central settings repository
run: |
export settings_repo="https://raw.githubusercontent.com/juju4/ansible-ci-settings/main"
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE
set -x
curl -o requirements.txt "$settings_repo/requirements.txt"
curl -o .ansible-lint "$settings_repo/.ansible-lint"
curl -o .yamllint "$settings_repo/.yamllint"
pip install -r requirements.txt
continue-on-error: true
- name: Environment
run: |
pwd
env
find -ls
- name: run test
run: |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE && molecule test --scenario-name $MOLECULE_SUITE
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.molecule_distro }}

0 comments on commit d7de97b

Please sign in to comment.