-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |