Update workflows.

This caches the virtual environment so we don't have to download it every time (the cache can be cleared from the repository > Actions > Caches (on the left).

We also split black formatting into a separate workflow.
This means we can run black ONLY when *.py files are changed.
It also means all other testing jobs don't need to _also_ check formatting.
This commit is contained in:
Rodrigo Girão Serrão
2023-05-16 10:17:45 +01:00
parent 6147c28dbf
commit 9b09b19e5f
4 changed files with 39 additions and 15 deletions

21
.github/workflows/black_format.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Black format check
on:
pull_request:
paths:
- '**.py'
jobs:
black-format-check:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3.5.2
- name: Set up Python 3.11
uses: actions/setup-python@v4.6.0
with:
python-version: 3.11
- name: Install black
run: python -m pip install black
- name: Run black
run: black --check src

View File

@@ -1,7 +1,8 @@
name: issues
name: Closed issue comment
on:
issues:
types: [closed]
jobs:
add-comment:
runs-on: ubuntu-latest
@@ -14,5 +15,5 @@ jobs:
issue-number: ${{ github.event.issue.number }}
body: |
Don't forget to [star](https://github.com/Textualize/textual) the repository!
Follow [@textualizeio](https://twitter.com/textualizeio) for Textual updates.

View File

@@ -1,7 +1,8 @@
name: issues
name: FAQ issue comment
on:
issues:
types: [opened]
jobs:
add-comment:
if: ${{ !contains( 'willmcgugan,darrenburns,davep,rodrigogiraoserrao', github.actor ) }}

View File

@@ -21,27 +21,28 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install and configure Poetry
- uses: actions/checkout@v3.5.2
- name: Install and configure Poetry # This could be cached, too...
uses: snok/install-poetry@v1.3.3
with:
version: 1.4.2
virtualenvs-in-project: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.6.0
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --extras "dev"
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Format check with black
run: |
source $VENV
make format-check
# - name: Typecheck with mypy
# run: |
# source $VENV
# make typecheck
- name: Test with pytest
run: |