From 4c4f559f6476080430e4fc6915d4cdbc4cc5b1d1 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 13:05:31 -0700 Subject: [PATCH 1/3] ci: Split up dependency install steps for easier debugging --- .github/workflows/checks.yml | 103 ++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 49 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4f793b37f..ef152a495 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,9 +2,9 @@ name: Run Checks on: push: - branches: ["main"] + branches: [ "main" ] pull_request: - branches: ["main"] + branches: [ "main" ] jobs: test: @@ -14,50 +14,55 @@ jobs: os: [ ubuntu-latest, macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python }} - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: .venv - key: ${{ runner.os }}-${{ matrix.python }}-dependencies-${{ hashFiles('**/poetry.lock') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.python }}-dependencies - - name: Install dependencies - run: | - pip install poetry - python -m venv .venv - poetry run python -m pip install --upgrade pip - poetry install - - - name: Run Black - run: poetry run black . --check - - - name: Run isort - run: poetry run isort . --check - - - name: Run flake8 - run: poetry run flake8 openapi_python_client - - - name: Run safety - run: poetry export -f requirements.txt | poetry run safety check --bare --stdin - - - name: Run mypy - run: poetry run mypy --show-error-codes openapi_python_client - - - name: Run pylint - run: poetry run pylint openapi_python_client - - - name: Run pytest - run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py - - - name: Generate coverage report - shell: bash - run: poetry run coverage xml - - - uses: codecov/codecov-action@v2 - with: - files: ./coverage.xml + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: .venv + key: ${{ runner.os }}-${{ matrix.python }}-dependencies-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.python }}-dependencies + - name: Install Poetry + run: pip install poetry + + - name: Create Virtual Environment + run: python -m venv .venv + + - name: Upgrade pip + run: poetry run python -m pip install --upgrade pip + + - name: Install Dependencies + run: poetry install + + - name: Run Black + run: poetry run black . --check + + - name: Run isort + run: poetry run isort . --check + + - name: Run flake8 + run: poetry run flake8 openapi_python_client + + - name: Run safety + run: poetry export -f requirements.txt | poetry run safety check --bare --stdin + + - name: Run mypy + run: poetry run mypy --show-error-codes openapi_python_client + + - name: Run pylint + run: poetry run pylint openapi_python_client + + - name: Run pytest + run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py + + - name: Generate coverage report + shell: bash + run: poetry run coverage xml + + - uses: codecov/codecov-action@v2 + with: + files: ./coverage.xml From 3ab7f4b035fc9d8935826c326bfbc75da46eff8c Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 13:16:00 -0700 Subject: [PATCH 2/3] ci: Use exact Python version for venv cache --- .github/workflows/checks.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ef152a495..65fb4310d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -19,13 +19,18 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} + + - name: Get Python Version + id: get_python_version + run: echo "::set-output name=python_version::$(python --version)" + - name: Cache dependencies uses: actions/cache@v2 with: path: .venv - key: ${{ runner.os }}-${{ matrix.python }}-dependencies-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies-${{ hashFiles('**/poetry.lock') }} restore-keys: | - ${{ runner.os }}-${{ matrix.python }}-dependencies + ${{ runner.os }}-${{ steps.get_python_version.outputs.python_version }}-dependencies - name: Install Poetry run: pip install poetry From 6542831b1df0f46651099d3b4f97429a2e4c2121 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 18 Dec 2021 13:24:34 -0700 Subject: [PATCH 3/3] ci: Enable relative config path tests --- .github/workflows/checks.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 65fb4310d..218ea852e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -62,7 +62,9 @@ jobs: run: poetry run pylint openapi_python_client - name: Run pytest - run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py + run: poetry run pytest --cov=openapi_python_client --cov-report=term-missing tests end_to_end_tests/test_end_to_end.py --basetemp=tests/tmp + env: + TASKIPY: true - name: Generate coverage report shell: bash