Configure Mend for GitHub.com #776
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
# | |
# Copyright (c) 2020, 2022 by Delphix. All rights reserved. | |
# | |
name: "Pre-commit actions for Delphix Virtualization SDK" | |
on: | |
# It is important to check the commits done to master, develop and release branches only. | |
pull_request: | |
branches: | |
- master | |
- develop | |
- release | |
jobs: | |
pytest311: | |
name: Test ${{ matrix.package }} on ${{ matrix.os }} using pytest (Python 3.11) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [ 3.11 ] | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
package: [ common, libs, platform, tools ] | |
steps: | |
- name: Checkout ${{ matrix.package }} project | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install ${{ matrix.package }} dependencies | |
working-directory: ${{ matrix.package }} | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt --find-links https://test.pypi.org/simple/dvp-api/ | |
- name: Install ${{ matrix.package }} project | |
working-directory: ${{ matrix.package }} | |
run: | | |
pip install . --find-links https://test.pypi.org/simple/dvp-api/ | |
# Run all the test cases part of the package. | |
- name: Test ${{ matrix.package }} project with pytest | |
working-directory: ${{ matrix.package }} | |
run: | | |
python -m pytest src/test/python | |
# Install flake8 and run linting on src and test for linting if OS is ubuntu. | |
- name: Install flake8 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
pip install flake8 | |
- name: Run flake8 on src directory | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
working-directory: ${{ matrix.package }} | |
run: python -m flake8 src/main/python --max-line-length 88 | |
- name: Run flake8 on test directory | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
working-directory: ${{ matrix.package }} | |
run: python -m flake8 src/test/python --max-line-length 88 |