mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-11 05:10:27 -07:00
ansible-lint was updated and the GitHub action did not pin the dependency, resulting in the repository to fail sanity tests. Updating the repository to adhere to new fatal linter rules, but also pinning the linter to prevent failures that may be unrelated to the particular commit. Updating usages for python3.8 to 3.9 as ansible-lint is dropping support for 3.8.
68 lines
No EOL
2.4 KiB
YAML
68 lines
No EOL
2.4 KiB
YAML
name: "Run tests for the cloud.google collection"
|
|
on: [pull_request]
|
|
env:
|
|
PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14
|
|
jobs:
|
|
sanity-and-lint:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ansible_collections/google/cloud
|
|
strategy:
|
|
matrix:
|
|
ansible_version:
|
|
- stable-2.14
|
|
steps:
|
|
- name: check out code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: ansible_collections/google/cloud
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
# Automation-hub requires python2.7 sanity tests
|
|
- name: setup python2.7
|
|
run: |
|
|
sudo apt-add-repository universe
|
|
sudo apt update
|
|
sudo apt install python2.7
|
|
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
|
|
sudo /usr/bin/python2.7 get-pip.py
|
|
pip2 install virtualenv
|
|
- name: Install ansible-base (${{ matrix.ansible_version }})
|
|
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
|
|
- name: Run ansible-test sanity
|
|
# validate-modules cannot be turned on until #498 is resolved.
|
|
run: ansible-test sanity -v --color --skip validate-modules
|
|
- name: Install ansible-lint
|
|
run: pip install ansible-lint==6.13.1
|
|
- name: Run ansible-lint
|
|
run: ansible-lint
|
|
unit:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ansible_collections/google/cloud
|
|
strategy:
|
|
matrix:
|
|
ansible_version:
|
|
- stable-2.14
|
|
- stable-2.11
|
|
steps:
|
|
- name: check out code
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: ansible_collections/google/cloud
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: "${{ env.PYTHON_VERSION }}"
|
|
- name: Install dependencies
|
|
run: pip install -r requirements.txt
|
|
- name: Install test dependencies
|
|
run: pip install -r requirements-test.txt
|
|
- name: Install ansible-base (${{ matrix.ansible_version }})
|
|
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
|
|
- name: Run unit tests
|
|
run: ansible-test units -v --color --python "$PYTHON_VERSION" |