Speed up Ansible tests

Move Molecule Vagrant tests over to QEmu runners on Linux boxes
"Dog-food" the Vagrant VMs
Accelerate linting of Ansible code as well
This commit is contained in:
Greg Hellings
2022-06-08 13:56:47 -05:00
committed by GitHub
parent 0941dd9909
commit 8448e1f187
9 changed files with 39 additions and 53 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ name: Build the boxes
jobs:
collect:
name: Discover distros
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
distros: ${{ steps.distros.outputs.distros }}
build: ${{ steps.time.outputs.time }}
+27 -10
View File
@@ -16,7 +16,7 @@ name: Test the components of it
jobs:
validate:
name: Validate Packer templates are reasonable
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
@@ -34,7 +34,7 @@ jobs:
collect:
name: Collect all Ansible-related jobs
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
all: ${{ steps.zipped.outputs.scenarios }}
steps:
@@ -56,16 +56,18 @@ jobs:
import json
ubuntu = json.loads('${{ steps.collection.outputs.tox-envs }}')
macos = json.loads('${{ steps.vagrant.outputs.tox-envs }}')
ub_zip = [{'os': 'ubuntu-latest', 'scenario': u} for u in ubuntu]
mac_zip = [{'os': 'macos-12', 'scenario': m} for m in macos]
ub_zip = [{'os': 'ubuntu-22.04', 'scenario': u} for u in ubuntu]
mac_zip = [{'os': 'ubuntu-22.04', 'scenario': m} for m in macos]
print("::set-output name=scenarios::" + json.dumps(ub_zip + mac_zip))
lint:
name: Lint Ansible code
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Checkout code
uses: actions/checkout@v3
- name: Setup test environment
uses: ./.github/actions/setup
with:
ansible: true
- name: Run lint
@@ -83,7 +85,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: ./.github/actions/install_virtualbox
if: startsWith(matrix.scenarios.os, 'macos')
- uses: ./.github/actions/install_packer
- name: Install libvirt
shell: bash
run: |
set -exo pipefail
sudo apt-get install libvirt-daemon-system
sudo usermod -a -G libvirt $USER
sudo systemctl start libvirtd
sudo ls -la /var/run/libvirt/
- name: Run scenario
run: tox -e "${{ matrix.scenarios.scenario }}"
run: |
set -ex
TOX="$(which tox)"
sudo -E su -m -c "groups && ${TOX} -e \"${{ matrix.scenarios.scenario }}\" -- --destroy=never" $USER
- name: Get possible output
if: ${{ failure() }}
run: |
set -x
cat /home/runner/.cache/molecule/init/ubuntu18/vagrant.err