From fa33954232bf8cdaa0758594d7ab6a2a25d25f76 Mon Sep 17 00:00:00 2001 From: Vlad Emelianov Date: Wed, 25 May 2022 23:54:31 +0300 Subject: [PATCH] Update CI --- .github/workflows/on_push.yml | 53 +++++++++++--------------- .github/workflows/on_push_coverage.yml | 28 +++----------- .github/workflows/on_release.yml | 6 +-- 3 files changed, 30 insertions(+), 57 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 99fd4d7..f04ed6e 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -1,4 +1,4 @@ -name: Code style and test +name: Code style & unit tests on: push: {} @@ -6,12 +6,7 @@ on: jobs: unit-tests: - name: Code style & unit tests runs-on: ubuntu-latest - env: - PIP_NO_CACHE_DIR: false - PIP_USER: 1 - PYTHONUSERBASE: ${{ github.workspace }}/.cache/py-user-base strategy: max-parallel: 4 matrix: @@ -21,46 +16,42 @@ jobs: - "3.9" - "3.10" steps: - - name: Add PYTHONUSERBASE to PATH - id: add-pythonuserbase + - uses: actions/checkout@v3 + - name: Set up Python for Poetry + uses: actions/setup-python@v3 + with: + python-version: "${{ matrix.python-version }}" + - name: Install poetry run: | - echo '${{ env.PYTHONUSERBASE }}/bin/' >> $GITHUB_PATH - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - id: python - uses: actions/setup-python@v2 + python -m pip install poetry pip + - name: Set up Python + uses: actions/setup-python@v3 with: python-version: "${{ matrix.python-version }}" + cache: "poetry" - name: Set up Node.js id: node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: "14" - - name: Cache packages - uses: actions/cache@v2 - with: - path: ${{ env.PYTHONUSERBASE }} - key: ${{ steps.python.outputs.python-version }}-full-${{ secrets.CACHE_KEY }}-${{ hashFiles('**/poetry.lock') }} - restore-keys: | - ${{ steps.python.outputs.python-version }}-full-${{ secrets.CACHE_KEY }}- + node-version: "16" - name: Install dependencies run: | - python -m pip install -U poetry pip wheel - poetry config virtualenvs.create false poetry install -n - sudo npm install -g pyright + - name: Install Node.js dependencies + run: | + npm install -g pyright - name: Code style run: | - python -m black --check awscliv2 - python -m isort -c awscliv2 + poetry run black --check awscliv2 + poetry run isort -c awscliv2 - name: Lint run: | - python -m flake8 awscliv2 - python -m pylint awscliv2 + poetry run flake8 awscliv2 + poetry run pylint awscliv2 - name: Typing run: | - python -m mypy awscliv2 + poetry run mypy awscliv2 npx pyright - name: Test run: | - python -m pytest + poetry run pytest diff --git a/.github/workflows/on_push_coverage.yml b/.github/workflows/on_push_coverage.yml index 4fdab03..f9854e8 100644 --- a/.github/workflows/on_push_coverage.yml +++ b/.github/workflows/on_push_coverage.yml @@ -11,38 +11,20 @@ on: jobs: coverage: - name: Coverage runs-on: ubuntu-latest - env: - PIP_NO_CACHE_DIR: false - PIP_USER: 1 - PYTHONUSERBASE: ${{ github.workspace }}/.cache/py-user-base steps: - - name: Add PYTHONUSERBASE to PATH - id: add-pythonuserbase - run: | - echo '${{ env.PYTHONUSERBASE }}/bin/' >> $GITHUB_PATH - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - - name: Cache packages - uses: actions/cache@v2 - with: - path: ${{ env.PYTHONUSERBASE }} - key: ${{ steps.python.outputs.python-version }}-full-${{ secrets.CACHE_KEY }}-${{ hashFiles('**/poetry.lock') }} - restore-keys: | - ${{ steps.python.outputs.python-version }}-full-${{ secrets.CACHE_KEY }}- + cache: "poetry" - name: Install dependencies run: | - python -m pip install -U poetry pip wheel - poetry config virtualenvs.create false poetry install -n - name: Send coverage report env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | - python -m pytest --cov-report term --cov awscliv2 - python -m codecov + poetry run pytest --cov-report term --cov awscliv2 + poetry run codecov diff --git a/.github/workflows/on_release.yml b/.github/workflows/on_release.yml index 72c43ff..4a929c5 100644 --- a/.github/workflows/on_release.yml +++ b/.github/workflows/on_release.yml @@ -13,14 +13,14 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.10" - name: Get version id: version - uses: actions/github-script@v4 + uses: actions/github-script@v6 with: result-encoding: string script: |