Skip to content

Commit

Permalink
refactor setup into common action
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgjs committed Dec 1, 2023
1 parent 6f26bc2 commit ca938e7
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 54 deletions.
21 changes: 21 additions & 0 deletions .github/actions/deps/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup
description: Setup Dependencies for testing
inputs:
python-version:
required: true
description: Python version to install
runs:
using: composite
steps:
- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{inputs.python-version}}
- name: Setup pip
shell: sh
run: |
python3 -m ensurepip
python3 -m pip install --upgrade pip
- name: Install project
shell: sh
run: pip install ".[dev,train]"
10 changes: 2 additions & 8 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
- name: Setup Dependencies
uses: ./.github/actions/deps
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi
pip install .
- name: Install notebook requirements
run: |
sudo apt-get install pandoc
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: Setup Dependencies
uses: ./.github/actions/deps
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Analyze code with linter
uses: psf/black@stable
with:
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/pre-commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
- name: Setup Dependencies
uses: ./.github/actions/deps
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev, train]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- uses: pre-commit/[email protected]
with:
extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Setup Dependencies
uses: ./.github/actions/deps
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: List dependencies
run: |
pip list
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/testing-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,10 @@ jobs:
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Setup Dependencies
uses: ./.github/actions/deps
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev, train]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unit tests with pytest
run: |
python -m pytest tests --cov=autora_doc --cov-report=xml
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/type-checking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Setup Dependencies
uses: ./.github/actions/deps
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev,train]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Analyze code with mypy

run: |
Expand Down

0 comments on commit ca938e7

Please sign in to comment.