Initial commit with content #177
This file contains hidden or 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: CI | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.x" | |
| - run: pip install uv | |
| - run: uv sync --group dev | |
| - run: uv run pre-commit run --all-files | |
| get-python-version: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pre-commit | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Extract minimum Python version from pyproject.toml | |
| id: version | |
| run: | | |
| # Extract requires-python value and get minimum version | |
| # e.g., ">=3.12" becomes "3.12" | |
| VERSION=$(grep 'requires-python' pyproject.toml | sed 's/.*>=//' | sed 's/".*//' | xargs) | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| ansible-lint: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pre-commit | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.x" | |
| - run: pip install uv | |
| - run: uv sync --group dev | |
| - name: Run ansible-lint on collection | |
| run: make lint-ansible | |
| ansible-collection-integration: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pre-commit | |
| - get-python-version | |
| - ansible-lint | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ needs.get-python-version.outputs.version }} | |
| - name: Install Ansible | |
| run: pip install ansible | |
| - name: Run Ansible collection sanity tests | |
| run: cd client/ansible_collections/fermilab/fact_inventory && ansible-test sanity | |
| - name: Run Ansible collection integration tests | |
| run: cd client/ansible_collections/fermilab/fact_inventory && ansible-test integration --allow-destructive | |
| pytest: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pre-commit | |
| - get-python-version | |
| strategy: | |
| matrix: | |
| python-version: | |
| - ${{ needs.get-python-version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: pip install uv | |
| - run: uv sync --python ${{ matrix.python-version }} --group dev | |
| - run: uv run --python ${{ matrix.python-version }} pytest | |
| ansible-role-live-api: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - pytest | |
| - ansible-collection-integration | |
| - get-python-version | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ needs.get-python-version.outputs.version }} | |
| - name: Install Ansible | |
| run: pip install ansible | |
| - run: pip install uv | |
| - run: uv sync --python ${{ needs.get-python-version.outputs.version }} --group dev | |
| - name: Run Ansible role integration test with live API | |
| run: make test-ansible-role |