chore(deps): update dev-dependencies #476
Workflow file for this run
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: Main | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v*" | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
env: | |
ANSIBLE_COLLECTIONS_PATH: ~/.ansible/collections | |
ANSIBLE_HOME: ~/.ansible | |
MOLECULE_PARALLEL: "1" | |
PY_COLORS: "1" | |
jobs: | |
lint-py: | |
name: Lint Python code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
cache: poetry | |
- name: Install deps | |
run: poetry install | |
- name: Lint code | |
run: poetry run poe lint | |
lint: | |
name: Lint Ansible code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ansible requirements | |
id: cache-reqs | |
uses: actions/cache@v4 | |
with: | |
key: reqs-${{ runner.os }}-${{ hashFiles('requirements.yml') }} | |
path: ${{ env.ANSIBLE_COLLECTIONS_PATH }} | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
cache: poetry | |
- name: Install deps | |
run: poetry install --no-root | |
- name: Install requirements | |
if: steps.cache-reqs.outputs.cache-hit != 'true' | |
run: poetry run ansible-galaxy install -r requirements.yml | |
- name: Lint code | |
run: poetry run ansible-lint | |
changes: | |
name: Detect changed scenarios | |
permissions: | |
pull-requests: read | |
runs-on: ubuntu-latest | |
outputs: | |
discover: ${{ steps.filter-edited.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check for file changes | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: filter | |
with: | |
filters: .github/file-filters.yml | |
- name: Filter out `shared` group; If no changes detected, return `hello_world` scenario | |
id: filter-edited | |
run: | | |
JSON=$(echo '${{ steps.filter.outputs.changes }}' | jq -c 'map(select(. != "shared"))') | |
if [[ $JSON == '[]' ]]; then | |
JSON='["plugins/tests/molecule/hello_world"]' | |
fi | |
echo "changes=$JSON" >> $GITHUB_OUTPUT | |
tests: | |
name: Tests | |
needs: [changes] | |
strategy: | |
fail-fast: false | |
matrix: | |
molecule-distro: [debian12, ubuntu2204, ubuntu2404] | |
molecule-discover: ${{ fromJSON(needs.changes.outputs.discover) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ansible requirements | |
id: cache-reqs | |
uses: actions/cache@v4 | |
with: | |
key: reqs-${{ runner.os }}-${{ hashFiles('requirements.yml') }} | |
path: ${{ env.ANSIBLE_COLLECTIONS_PATH }} | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
cache: poetry | |
- name: Install deps | |
run: poetry install --no-root | |
- name: Install requirements | |
if: steps.cache-reqs.outputs.cache-hit != 'true' | |
run: poetry run ansible-galaxy install -r requirements.yml | |
- name: Run tests | |
run: poetry run poe test --discover ${{ matrix.molecule-discover }} | |
env: | |
MOLECULE_DISTRO: ${{ matrix.molecule-distro }} | |
galaxy-deploy: | |
name: Release to Ansible Galaxy | |
if: github.ref_type == 'tag' | |
needs: [lint-py, lint, tests] | |
environment: | |
name: galaxy | |
url: https://galaxy.ansible.com/ui/repo/published/deadnews/util | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set version in galaxy.yml | |
run: | | |
sed "s|^version:.*$|version: ${GITHUB_REF_NAME#v}|" -i galaxy.yml | |
- name: Upload collection to Ansible Galaxy | |
uses: ansible/ansible-publish-action@a56a0328c92c1d4feedf5bd7f7cf7ec7a4ae3f09 # v1.0.0 | |
with: | |
api_key: ${{ secrets.GALAXY_API_KEY }} | |
github-deploy: | |
name: Release to GitHub | |
if: github.ref_type == 'tag' | |
needs: [lint-py, lint, tests] | |
environment: github-releases | |
permissions: | |
contents: write | |
env: | |
CHANGELOG: https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md | |
PRERELEASE: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create GitHub Release | |
run: | | |
gh release create ${{ github.ref_name }} \ | |
--title ${{ github.ref_name }} \ | |
--notes="See [the CHANGELOG](${{ env.CHANGELOG }}) for more details." \ | |
--draft=${{ env.PRERELEASE }} \ | |
--prerelease=${{ env.PRERELEASE }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |