Skip to content

feat(ci): add ansible 7, 8 to test matrix (#151) #554

feat(ci): add ansible 7, 8 to test matrix (#151)

feat(ci): add ansible 7, 8 to test matrix (#151) #554

Workflow file for this run

name: Test Jinja2
permissions: read-all
"on":
workflow_dispatch:
pull_request:
push:
branches:
- master
- renovate/**
paths:
- ".github/workflows/ci.yml"
- ".github/cookiecutter-example.yml"
- "{{ cookiecutter.project_slug }}/**"
- "cookiecutter.json"
- "requirements-dev.txt"
jobs:
test-latest:
name: Test
runs-on: ubuntu-latest
steps:
### GENERIC COOKIECUTTER INITIALIZATION STEPS ###
- name: check out the codebase
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: set up python 3
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: "3.x"
- name: setup/activate pre-commit cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
path: ~/.cache/pre-commit
key: ${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: install cookiecutter development dependencies
run: |
python3 -m venv cookiecutter-venv
source cookiecutter-venv/bin/activate
python3 -m pip install -r requirements-dev.txt
- name: Generate example project from cookiecutter.
run: |
source cookiecutter-venv/bin/activate
cookiecutter . --config-file .github/cookiecutter-example.yml --no-input
- name: install development dependencies of generated project
run: |
python3 -m venv project-venv
source project-venv/bin/activate
pip3 install -r requirements-dev.txt
working-directory: ./ansible-role-myrole
- name: Run pre-commit on all files in generated project
run: |
git init
git add .
source project-venv/bin/activate
pre-commit run --all-files --show-diff-on-failure
working-directory: ./ansible-role-myrole
### COOKIECUTTER SPECIFIC STEPS ###
- name: Run tox in generated project
run: |
source project-venv/bin/activate
tox
working-directory: ./ansible-role-myrole
- name: setup tmate session if any previous step failed and if this is a manual run
if: ${{ failure() && github.event_name == 'workflow_dispatch' }}
uses: mxschmitt/action-tmate@a283f9441d2d96eb62436dc46d7014f5d357ac22 # v3
timeout-minutes: 30