diff options
Diffstat (limited to 'ansible_collections/cloud/common/.github')
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/changelog.yaml (renamed from ansible_collections/cloud/common/.github/workflows/changelog.yml) | 5 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/galaxy-import.yaml | 15 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/integration-tests-kubernetes-core.yaml | 141 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/linters.yaml | 25 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/linters.yml | 16 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/sanity-tests.yaml | 15 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml | 172 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml | 63 | ||||
-rw-r--r-- | ansible_collections/cloud/common/.github/workflows/unit-tests.yaml | 15 |
9 files changed, 213 insertions, 254 deletions
diff --git a/ansible_collections/cloud/common/.github/workflows/changelog.yml b/ansible_collections/cloud/common/.github/workflows/changelog.yaml index 40b5bccf9..21ed48ed6 100644 --- a/ansible_collections/cloud/common/.github/workflows/changelog.yml +++ b/ansible_collections/cloud/common/.github/workflows/changelog.yaml @@ -1,8 +1,7 @@ --- -name: CI - +name: Changelog concurrency: - group: changelog-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: diff --git a/ansible_collections/cloud/common/.github/workflows/galaxy-import.yaml b/ansible_collections/cloud/common/.github/workflows/galaxy-import.yaml new file mode 100644 index 000000000..a3f6d29d1 --- /dev/null +++ b/ansible_collections/cloud/common/.github/workflows/galaxy-import.yaml @@ -0,0 +1,15 @@ +--- +name: galaxy-import +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + +jobs: + galaxy_importer: + uses: ansible-network/github_actions/.github/workflows/galaxy_importer.yml@main
\ No newline at end of file diff --git a/ansible_collections/cloud/common/.github/workflows/integration-tests-kubernetes-core.yaml b/ansible_collections/cloud/common/.github/workflows/integration-tests-kubernetes-core.yaml new file mode 100644 index 000000000..a9eb22ad5 --- /dev/null +++ b/ansible_collections/cloud/common/.github/workflows/integration-tests-kubernetes-core.yaml @@ -0,0 +1,141 @@ +--- +name: Integration tests +on: + pull_request: + branches: + - main + - stable-* + +jobs: + splitter: + env: + source_dir: "./source" + runs-on: ubuntu-latest + outputs: + test_targets: ${{ steps.splitter.outputs.test_targets }} + test_targets_json: ${{ steps.splitter.outputs.test_targets_json }} + test_jobs: ${{ steps.splitter.outputs.test_jobs }} + steps: + - name: Checkout the collection repository + uses: actions/checkout@v3 + with: + repository: ansible-collections/kubernetes.core + ref: main + path: ${{ env.source_dir }} + fetch-depth: "0" + + - name: Split all Kubernetes targets into Job + id: splitter + uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@main + with: + collections_to_test: ${{ env.source_dir }} + total_jobs: 8 + env: + ANSIBLE_TEST_ALL_THE_TARGETS: "true" + + - name: Display splitter output + run: | + echo "test_targets=${{ steps.splitter.outputs.test_targets }}" + echo "test_targets_json=${{ steps.splitter.outputs.test_targets_json }}" + echo "test_jobs=${{ steps.splitter.outputs.test_jobs }}" + shell: bash + integration: + runs-on: ubuntu-latest + timeout-minutes: 60 + needs: + - splitter + if: ${{ needs.splitter.outputs.test_targets != '' }} + env: + source: "./cloud_common" + ansible_posix: "./ansible_posix" + kubernetes_core: "./kubernetes_core" + strategy: + fail-fast: false + matrix: + ansible-version: + - milestone + python-version: + - "3.12" + workflow-id: ${{ fromJson(needs.splitter.outputs.test_jobs) }} + name: "integration-kubernetes-core-${{ matrix.python-version }}-${{ matrix.ansible-version }}-${{ matrix.workflow-id }}" + steps: + - name: Read target + id: read-targets + run: | + import json, os + with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh: + fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n') + shell: python + env: + ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }} + WORKFLOW_ID: ${{ matrix.workflow-id }} + + - name: Display ansible test targets + run: | + echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}" + shell: bash + + - name: Checkout cloud.common repository + uses: actions/checkout@v3 + with: + path: ${{ env.source }} + ref: ${{ github.event.pull_request.head.sha }} + + - name: checkout ansible-collections/kubernetes.core + uses: ansible-network/github_actions/.github/actions/checkout_dependency@main + with: + repository: ansible-collections/kubernetes.core + path: ${{ env.kubernetes_core }} + ref: main + + - name: checkout ansible-collections/ansible.posix + uses: ansible-network/github_actions/.github/actions/checkout_dependency@main + with: + repository: ansible-collections/ansible.posix + path: ${{ env.ansible_posix }} + ref: main + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + # install ansible + - name: Install ansible-core (${{ matrix.ansible-version }}) + run: >- + python3 -m pip install + https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz + --disable-pip-version-check + shell: bash + + - name: Build and install kuernetes.core collection + id: install-kubernetes-core + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.kubernetes_core }} + + - name: install cloud.common collection + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.source }} + + - name: install ansible.posix collection + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.ansible_posix }} + + - name: Create kubernetes cluster + uses: helm/kind-action@v1.4.0 + + - name: Run integration tests + uses: ansible-network/github_actions/.github/actions/ansible_test_integration@main + with: + collection_path: ${{ steps.install-kubernetes-core.outputs.collection_path }} + python_version: ${{ matrix.python-version }} + ansible_version: ${{ matrix.ansible-version }} + ansible_test_targets: ${{ steps.read-targets.outputs.ansible_test_targets }} + ansible_test_environment: | + ENABLE_TURBO_MODE=true
\ No newline at end of file diff --git a/ansible_collections/cloud/common/.github/workflows/linters.yaml b/ansible_collections/cloud/common/.github/workflows/linters.yaml new file mode 100644 index 000000000..5c74d3b36 --- /dev/null +++ b/ansible_collections/cloud/common/.github/workflows/linters.yaml @@ -0,0 +1,25 @@ +--- +name: Linters +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + tags: + - '*' + +jobs: + linters: + uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main + + ansible-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run ansible-lint + uses: ansible/ansible-lint@v6.21.0
\ No newline at end of file diff --git a/ansible_collections/cloud/common/.github/workflows/linters.yml b/ansible_collections/cloud/common/.github/workflows/linters.yml deleted file mode 100644 index cafab80ae..000000000 --- a/ansible_collections/cloud/common/.github/workflows/linters.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: CI - -concurrency: - group: linters-${{ github.ref }} - cancel-in-progress: true - -on: # yamllint disable-line rule:truthy - pull_request: - branches: - - main - - stable-* - -jobs: - linters: - uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main
\ No newline at end of file diff --git a/ansible_collections/cloud/common/.github/workflows/sanity-tests.yaml b/ansible_collections/cloud/common/.github/workflows/sanity-tests.yaml new file mode 100644 index 000000000..e3a813060 --- /dev/null +++ b/ansible_collections/cloud/common/.github/workflows/sanity-tests.yaml @@ -0,0 +1,15 @@ +--- +name: Sanity tests +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + +jobs: + sanity: + uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
\ No newline at end of file diff --git a/ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml b/ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml deleted file mode 100644 index c2cc86756..000000000 --- a/ansible_collections/cloud/common/.github/workflows/sanity_and_units.yml +++ /dev/null @@ -1,172 +0,0 @@ ---- -name: CI - -concurrency: - group: sanity-units-${{ github.ref }} - cancel-in-progress: true - -on: # yamllint disable-line rule:truthy - pull_request: - branches: - - main - - stable-* - schedule: - - cron: '0 14 * * 1' - -jobs: - sanity: - uses: ansible-network/github_actions/.github/workflows/sanity.yml@main - with: - matrix_include: "[]" - matrix_exclude: >- - [ - { - "ansible-version": "stable-2.9", - "python-version": "3.9" - }, - { - "ansible-version": "stable-2.9", - "python-version": "3.10" - }, - { - "ansible-version": "stable-2.9", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.9" - }, - { - "ansible-version": "devel", - "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" - } - ] - unit-source: - # Runs on ansible-2.12+ - uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main - with: - matrix_exclude: >- - [ - { - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.9" - }, - { - "ansible-version": "devel", - "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" - } - ] - collection_pre_install: '' - all_green: - if: ${{ always() }} - needs: - - sanity - - unit-source - runs-on: ubuntu-latest - steps: - - run: >- - python -c "assert set([ - '${{ needs.unit-source.result }}' - ]) == {'success'}" - - run: >- - python -c "assert '${{ needs.sanity.result }}' - in ['success', 'failure']" diff --git a/ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml b/ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml deleted file mode 100644 index 779d5474d..000000000 --- a/ansible_collections/cloud/common/.github/workflows/unit-ansible-2.9.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: CI - -concurrency: - group: units-29-${{ github.ref }} - cancel-in-progress: true - -on: # yamllint disable-line rule:truthy - push: - branches: - - main - - stable-* - pull_request: - branches: - - main - - stable-* - schedule: - - cron: '0 14 * * 1' - -jobs: - units: - runs-on: ubuntu-20.04 - name: unit-2.9 - env: - ansible_version: stable-2.9 - python_version: 3.7 - steps: - - name: Checkout the collection repository - uses: ansible-network/github_actions/.github/actions/checkout_dependency@main - with: - path: ${{ env.source_directory }} - - - name: Set up Python ${{ env.python_version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ env.python_version }} - - - name: Install ansible-core (${{ env.ansible_version }}) - run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ env.ansible_version }}.tar.gz --disable-pip-version-check - - - name: Read collection metadata from galaxy.yml - id: identify - uses: ansible-network/github_actions/.github/actions/identify_collection@main - with: - source_path: ${{ env.source_directory }} - - - name: Build and install the collection - uses: ansible-network/github_actions/.github/actions/build_install_collection@main - with: - install_python_dependencies: true - source_path: ${{ env.source_directory }} - collection_path: ${{ steps.identify.outputs.collection_path }} - tar_file: ${{ steps.identify.outputs.tar_file }} - ansible_version: "${{ env.ansible_version }}" - - - name: Print the ansible version - run: ansible --version - - - name: Print the python dependencies - run: python3 -m pip list - - - name: Run unit tests - run: python -m pytest tests/unit --showlocals - working-directory: ${{ steps.identify.outputs.collection_path }} diff --git a/ansible_collections/cloud/common/.github/workflows/unit-tests.yaml b/ansible_collections/cloud/common/.github/workflows/unit-tests.yaml new file mode 100644 index 000000000..0cb2f1892 --- /dev/null +++ b/ansible_collections/cloud/common/.github/workflows/unit-tests.yaml @@ -0,0 +1,15 @@ +--- +name: Unit tests +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + - stable-* + +jobs: + unit-source: + uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
\ No newline at end of file |