refactor: replaced apt with generic package module #33
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
--- | |
name: Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, fedora-latest] | |
runs-on: ${{ matrix.os }} | |
container: | |
image: ${{ matrix.os == 'fedora-latest' && 'fedora:latest' || '' }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.x" | |
- name: Cache Python dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install yamllint ansible ansible-lint | |
- name: Lint code | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
yamllint . | |
ansible-lint -x 403 | |
- name: Set up test environment | |
run: | | |
cp tests/ansible.cfg ./ansible.cfg | |
cp tests/inventory ./inventory | |
cp tests/test_config.yml ./config.yml | |
cp tests/.install.sh /home/runner/.install.sh | |
ansible-galaxy install -r requirements.yml | |
- name: Test the playbook's syntax | |
run: ansible-playbook main.yml --syntax-check | |
env: | |
ANSIBLE_FORCE_COLOR: "1" | |
- name: Test the playbook | |
run: ansible-playbook main.yml | |
env: | |
ANSIBLE_FORCE_COLOR: "1" |