Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate tox and tox-ansible workflows to test changes #393

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions .github/workflows/run.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
pull_request:
branches:
- "main"
- "releases/**"
- "stable/**"
workflow_call:

concurrency:
Expand All @@ -20,3 +22,81 @@ jobs:
with:
max_python: "3.13"
jobs_producing_coverage: 8

smoke-matrix:
# Uncomment the below line when all tests start passing
needs: tox
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install tox-ansible, includes tox
run: python3 -m pip install .

- name: Generate matrix
id: generate-matrix
working-directory: tests/fixtures/unit/test_type
run: |
python3 -m tox --ansible --gh-matrix --conf tox-ansible.ini

outputs:
envlist: ${{ steps.generate-matrix.outputs.envlist }}

smoke-test:
needs: smoke-matrix
strategy:
fail-fast: false
matrix:
entry: ${{ fromJson(needs.smoke-matrix.outputs.envlist) }}
name: ${{ matrix.entry.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.entry.python }}

- name: Install tox-ansible, includes tox
run: python3 -m pip install .

- name: Install ansible-creator
run: python3 -m pip install ansible-creator

- name: Create test directory to scaffold ansible collection
run: mkdir example

- name: Scaffold an ansible collection using ansible-creator
working-directory: example
run: ansible-creator init collection "foo.bar"

- name: Track files created by ansible-creator
working-directory: example
run: git add .

- name: Run tox test
working-directory: example
run: python3 -m tox --ansible -e ${{ matrix.entry.name }} --conf tox-ansible.ini
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

smoke-check:
needs: smoke-test
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert set([
'${{ needs.smoke-test.result }}',
]) == {'success'}"
Loading