feat: Adding support for reading playbooks from collections #749
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: Testing | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pytest: | |
name: Tests Py${{ matrix.python-version }} - Ansible ${{ matrix.ansible-core-version }} | |
env: | |
SVG_FILES_PATH: tests/generated-svgs | |
MERMAID_FILES_PATH: tests/generated-mermaids | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ '3.10', '3.11' ] | |
# See https://www.ansible.com/blog/ansible-3.0.0-qa and https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html | |
ansible-core-version: [ '2.16.*', '2.17.*' ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-python@v5 | |
name: Setup Python ${{ matrix.python-version }} | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
- name: Install prereqs | |
run: | | |
pip install -q ansible-core=='${{ matrix.ansible-core-version }}' virtualenv setuptools wheel coveralls | |
pip install -q -r requirements.txt -r tests/requirements_tests.txt | |
pip freeze | |
sudo apt-get install -yq graphviz | |
cd tests/fixtures | |
ansible-galaxy install -r requirements.yml | |
- name: Pytest | |
env: | |
PY_COLORS: "1" | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.ref }} | |
run: make test | |
- name: Set variables | |
run: | | |
matrix_ansible_version='${{ matrix.ansible-core-version }}' | |
clean_version=${matrix_ansible_version//.\*/} # Remove '.*' from the version name | |
echo "MATRIX_JOB_IDENTIFIER=py${{ matrix.python-version }}-ansible-${clean_version}" >> $GITHUB_ENV | |
- name: Upload generated SVGs as artefacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated-svgs-${{ env.MATRIX_JOB_IDENTIFIER }} | |
path: ${{ env.SVG_FILES_PATH }}/ | |
if-no-files-found: error # the tests should generate SVGs files | |
# - uses: stefanzweifel/git-auto-commit-action@v4 | |
# id: commit-svg-files | |
# with: | |
# commit_message: Adding SVG for the run ${{ env.MATRIX_JOB_IDENTIFIER }} | |
# file_pattern: ${{ env.SVG_FILES_PATH }}/*.svg | |
# skip_dirty_check: true | |
# add_options: '--force' | |
# push_options: '--force' | |
# branch: generated-svgs-${{ github.head_ref || github.ref }}-${{ env.MATRIX_JOB_IDENTIFIER }} | |
# create_branch: true | |
# | |
- name: Publish job summary | |
run: python tests/generate-job-summary.py >> $GITHUB_STEP_SUMMARY | |
- name: Test installation in virtualenv | |
run: make test_install ANSIBLE_CORE_VERSION=${{ matrix.ansible-core-version }} | |
- name: Upload Coverage | |
run: cd tests && coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_FLAG_NAME: py${{ matrix.python-version }}-ansible${{ matrix.ansible-core-version }} | |
COVERALLS_PARALLEL: true | |
coveralls: | |
runs-on: ubuntu-latest | |
name: Finish coverage | |
needs: pytest | |
container: python:3-slim # just need a simple python container to finish the coverage | |
steps: | |
- name: Coveralls finish | |
run: pip install coveralls && coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |