Skip to content

Adopt ansible-content-actions #694

Adopt ansible-content-actions

Adopt ansible-content-actions #694

Workflow file for this run

name: tox
on:
push:
branches: # any integration branch but not tag
- "main"
tags-ignore:
- "**"
pull_request:
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC
jobs:
# tox --ansible --conf tox-ansible.ini --gh-matrix
# tox --ansible --gh-matrix
prepare:
name: prepare
runs-on: ubuntu-24.04
outputs:
envlist: ${{ steps.generate_matrix.outputs.envlist }}
steps:
- uses: actions/checkout@v4
- name: Determine matrix
id: generate_matrix
# uses: ansible/ansible-content-actions/.github/actions/generate-tox-ansible-matrix@fix/scope-optional
uses: ./.github/actions/generate-tox-ansible-matrix
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'ubuntu-24.04' }}
needs:
- prepare
defaults:
run:
shell: ${{ matrix.shell || 'bash'}}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.envlist) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed by setuptools-scm
submodules: true
- name: Set pre-commit cache
uses: actions/cache@v4
if: ${{ matrix.name == 'lint' }}
with:
path: |
~/.cache/pre-commit
key: pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Set ansible cache(s)
uses: actions/cache@v4
with:
path: |
.cache/eco
examples/playbooks/collections/ansible_collections
~/.cache/ansible-compat
~/.ansible/collections
~/.ansible/roles
key: ${{ matrix.name }}-${{ hashFiles('tools/test-eco.sh', 'requirements.yml', 'examples/playbooks/collections/requirements.yml') }}
- name: Set up Python ${{ matrix.python_version || '3.10' }}
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python_version || '3.10' }}
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: test/schemas/package-lock.json
- name: Run ./tools/test-setup.sh
run: ./tools/test-setup.sh
- name: Install tox
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade "tox>=4.0.0" "tox-uv>=1.16.0" uv
- name: Log installed dists
run: python3 -m pip freeze --all
- run: ${{ matrix.command }}
- run: ${{ matrix.command2 }}
if: ${{ matrix.command2 }}
- run: ${{ matrix.command3 }}
if: ${{ matrix.command3 }}
- run: ${{ matrix.command4 }}
if: ${{ matrix.command4 }}
- run: ${{ matrix.command5 }}
if: ${{ matrix.command5 }}
- name: Archive logs
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.name }}.zip
include-hidden-files: true
path: |
.tox/**/log/
.tox/**/.coverage*
.tox/**/coverage.xml
check:
if: always()
permissions:
id-token: write
checks: read
needs:
- build
runs-on: ubuntu-24.04
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}