diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index b789c470..1fc08557 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -4,126 +4,16 @@ on: push: branches: - master - pull_request: schedule: - cron: 30 6 * * * jobs: - build-collection-artifact: - name: Build collection - runs-on: ${{ matrix.runner-os }} - strategy: - matrix: - runner-os: - - ubuntu-latest - ansible-version: - - git+https://github.com/ansible/ansible.git@devel - runner-python-version: - - 3.8 - steps: - - uses: actions/checkout@v1 - - name: Set up Python ${{ matrix.runner-python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.runner-python-version }} - - name: Set up pip cache - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ github.ref }} - - name: Install Ansible ${{ matrix.ansible-version }} - run: >- - python -m - pip - install - --user - ${{ matrix.ansible-version }} - - name: Build a collection tarball - run: >- - ~/.local/bin/ansible-galaxy - collection - build - --output-path - "${GITHUB_WORKSPACE}/.cache/collection-tarballs" - - name: Store migrated collection artifacts - uses: actions/upload-artifact@v1 - with: - name: >- - collection - path: .cache/collection-tarballs - - sanity-test-collection-via-containers: - name: Sanity Py${{ matrix.python-version }} - needs: - - build-collection-artifact - runs-on: ${{ matrix.runner-os }} - strategy: - fail-fast: false - matrix: - runner-os: - - ubuntu-latest - runner-python-version: - - 3.6 - ansible-version: - - git+https://github.com/ansible/ansible.git@devel - steps: - - name: Set up Python ${{ matrix.runner-python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.runner-python-version }} - - name: Set up pip cache - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ github.ref }}-sanity-containers - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - name: Install Ansible ${{ matrix.ansible-version }} - run: >- - python -m - pip - install - --user - ${{ matrix.ansible-version }} - - name: Download migrated collection artifacts - uses: actions/download-artifact@v1 - with: - name: >- - collection - path: .cache/collection-tarballs - - name: Install the collection tarball - run: >- - ~/.local/bin/ansible-galaxy - collection - install - .cache/collection-tarballs/*.tar.gz - - name: Run collection sanity tests - run: >- - ~/.local/bin/ansible-test - sanity - --color - --requirements - --docker - -vvv - working-directory: >- - /home/runner/.ansible/collections/ansible_collections/ngine_io/cloudstack - integration-test: name: Integration test group${{matrix.group}} Py${{ matrix.python-version }} - needs: - - build-collection-artifact - - sanity-test-collection-via-containers - runs-on: ${{ matrix.runner-os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - runner-os: - - ubuntu-latest - runner-python-version: - - 3.6 - ansible-version: - - git+https://github.com/ansible/ansible.git@devel python-version: - 3.6 - 2.7 @@ -135,40 +25,26 @@ jobs: uses: actions/checkout@v1 with: path: ansible_collections/ngine_io/cloudstack - - name: Set up pip cache - uses: actions/cache@v1 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ github.ref }} - - name: Install Ansible ${{ matrix.ansible-version }} - run: >- - python -m - pip - install - --user - ${{ matrix.ansible-version }} - - name: Install requirements - run: >- - python -m - pip - install - --user - -r requirements.txt - - name: Download migrated collection artifacts - uses: actions/download-artifact@v1 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 with: - name: >- - collection - path: .cache/collection-tarballs - - name: Install collection tarball - run: >- - ~/.local/bin/ansible-galaxy - collection - install - ${GITHUB_WORKSPACE}/.cache/collection-tarballs/*.gz + python-version: ${{ matrix.python-version }} + + - name: Install ansible and collection dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + pip install -r requirements.txt + + - name: Build and install collection + run: | + ansible-galaxy collection build . + ansible-galaxy collection install *.gz + - name: Run the tests run: >- - ~/.local/bin/ansible-test + ansible-test integration --docker -v @@ -179,9 +55,10 @@ jobs: --continue-on-error --coverage shippable/cs/group${{ matrix.group }}/ + - name: Generate coverage report. run: >- - ~/.local/bin/ansible-test + ansible-test coverage xml -v --requirements diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0318edfc..af3230f5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + with: + path: ansible_collections/ngine_io/cloudstack - name: Set up Python uses: actions/setup-python@v1 with: diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml new file mode 100644 index 00000000..6e1522d2 --- /dev/null +++ b/.github/workflows/sanity.yml @@ -0,0 +1,31 @@ +name: Sanity +on: +- pull_request + +jobs: + sanity: + name: Sanity (${{ matrix.ansible }}) + strategy: + matrix: + ansible: + - stable-2.10 + - stable-2.9 + - devel + runs-on: ubuntu-latest + steps: + + - name: Check out code + uses: actions/checkout@v1 + with: + path: ansible_collections/ngine_io/cloudstack + + - name: Set up Python 3.6 + uses: actions/setup-python@v1 + with: + python-version: 3.6 + + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - name: Run sanity tests + run: ansible-test sanity --docker -v --color --python 3.6 diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 971444eb..e69de29b 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -1,24 +0,0 @@ -plugins/modules/cs_disk_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_firewall.py validate-modules:parameter-list-no-elements -plugins/modules/cs_host.py validate-modules:parameter-list-no-elements -plugins/modules/cs_instance.py validate-modules:parameter-list-no-elements -plugins/modules/cs_ip_address.py validate-modules:parameter-list-no-elements -plugins/modules/cs_iso.py validate-modules:parameter-list-no-elements -plugins/modules/cs_loadbalancer_rule.py validate-modules:doc-required-mismatch -plugins/modules/cs_loadbalancer_rule.py validate-modules:parameter-list-no-elements -plugins/modules/cs_loadbalancer_rule_member.py validate-modules:parameter-list-no-elements -plugins/modules/cs_network.py validate-modules:parameter-list-no-elements -plugins/modules/cs_network_acl_rule.py validate-modules:parameter-list-no-elements -plugins/modules/cs_network_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_physical_network.py validate-modules:parameter-list-no-elements -plugins/modules/cs_portforward.py validate-modules:parameter-list-no-elements -plugins/modules/cs_project.py validate-modules:parameter-list-no-elements -plugins/modules/cs_resourcelimit.py validate-modules:invalid-ansiblemodule-schema -plugins/modules/cs_service_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_storage_pool.py validate-modules:parameter-list-no-elements -plugins/modules/cs_template.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vmsnapshot.py validate-modules:parameter-list-no-elements -plugins/modules/cs_volume.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vpc.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vpc_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vpn_customer_gateway.py validate-modules:parameter-list-no-elements diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 971444eb..e69de29b 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -1,24 +0,0 @@ -plugins/modules/cs_disk_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_firewall.py validate-modules:parameter-list-no-elements -plugins/modules/cs_host.py validate-modules:parameter-list-no-elements -plugins/modules/cs_instance.py validate-modules:parameter-list-no-elements -plugins/modules/cs_ip_address.py validate-modules:parameter-list-no-elements -plugins/modules/cs_iso.py validate-modules:parameter-list-no-elements -plugins/modules/cs_loadbalancer_rule.py validate-modules:doc-required-mismatch -plugins/modules/cs_loadbalancer_rule.py validate-modules:parameter-list-no-elements -plugins/modules/cs_loadbalancer_rule_member.py validate-modules:parameter-list-no-elements -plugins/modules/cs_network.py validate-modules:parameter-list-no-elements -plugins/modules/cs_network_acl_rule.py validate-modules:parameter-list-no-elements -plugins/modules/cs_network_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_physical_network.py validate-modules:parameter-list-no-elements -plugins/modules/cs_portforward.py validate-modules:parameter-list-no-elements -plugins/modules/cs_project.py validate-modules:parameter-list-no-elements -plugins/modules/cs_resourcelimit.py validate-modules:invalid-ansiblemodule-schema -plugins/modules/cs_service_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_storage_pool.py validate-modules:parameter-list-no-elements -plugins/modules/cs_template.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vmsnapshot.py validate-modules:parameter-list-no-elements -plugins/modules/cs_volume.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vpc.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vpc_offering.py validate-modules:parameter-list-no-elements -plugins/modules/cs_vpn_customer_gateway.py validate-modules:parameter-list-no-elements