Skip to content

Commit

Permalink
chore: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hatamiarash7 committed Feb 25, 2024
1 parent da4022f commit b7a99fa
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,45 @@ on:

jobs:
init:
name: 🚩 Initialize
runs-on: ubuntu-latest
name: Initialize
runs-on: ubuntu-22.04
steps:
- name: Cancel previous workflow
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

linting:
name: Linting
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4.1.1

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Configure cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip

- name: Install dependencies
run: python -m pip install black flake8 isort

- name: Lint code
run: |
flake8 --exclude=.venv .
black . --check
isort .
release:
name: Release
needs: init
needs: ["init", "linting"]
permissions:
contents: write
strategy:
Expand All @@ -40,15 +68,17 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-2.0.3
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip

- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: "2.0.3"
virtualenvs-create: true
virtualenvs-in-project: true

Expand All @@ -57,11 +87,11 @@ jobs:
uses: actions/cache@v4
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install project
run: poetry install --no-interaction
Expand All @@ -86,4 +116,4 @@ jobs:
if: ${{ matrix.python-version == '3.10' }}
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
ignore_dev_requirements: "yes"
poetry_install_options: "--without dev"

0 comments on commit b7a99fa

Please sign in to comment.