Update Workflow files and README.md #1217
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 | |
| on: | |
| - pull_request | |
| jobs: | |
| sanity: | |
| strategy: | |
| matrix: | |
| python_version: ["3.9", "3.10"] | |
| ansible_version: ["stable-2.15"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| path: ansible_collections/hpe/oneview | |
| - name: Set up Python ${{ matrix.python_version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install future | |
| cd ansible_collections/hpe/oneview | |
| if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Install ansible ${{ matrix.ansible_version }} | |
| run: pip install ansible~=8.5.0 | |
| - name: Run sanity tests | |
| run: | | |
| cd ansible_collections/hpe/oneview | |
| ansible-test sanity --docker -v --color --python ${{ matrix.python_version }} | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: ansible_collections/hpe/oneview | |
| - name: Install ansible-lint | |
| run: | | |
| pip install ansible ansible-lint | |
| - name: Run ansible-lint | |
| run: | | |
| cd ansible_collections/hpe/oneview | |
| ansible-lint | |
| units: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| # As soon as the first unit test fails, cancel the others to free up the CI queue | |
| fail-fast: true | |
| matrix: | |
| python_version: | |
| - 3.9 | |
| - '3.10' | |
| ansible: | |
| - stable-2.15 | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| path: ansible_collections/hpe/oneview | |
| - name: Set up Python ${{ matrix.python_version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip3 install future pytest-cov | |
| cd ansible_collections/hpe/oneview | |
| if [ -f tests/requirements.txt ]; then pip3 install -r tests/requirements.txt; fi | |
| if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi | |
| - name: Install ansible-base (${{ matrix.ansible }}) | |
| run: pip install ansible~=8.5.0 --disable-pip-version-check | |
| - name: Setting Python env path | |
| run: | | |
| echo "PYTHONPATH=/home/runner/work/oneview-ansible-collection/oneview-ansible-collection:$PYTHONPATH" >> $GITHUB_ENV | |
| - name: Generating coverage report | |
| run: | | |
| cd ansible_collections/hpe/oneview | |
| pytest --cov-report xml --cov=plugins/modules tests/unit/ | |
| - name: "Upload coverage to Codecov" | |
| uses: codecov/[email protected] | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: alisha-k-kalladassery/oneview-ansible-collection | |
| fail_ci_if_error: true |