Skip to content

Commit

Permalink
centralize python/hatch install
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoop committed Jan 25, 2024
1 parent 415b794 commit e41d60f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup-python-hatch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup Python env
description: Install Python & Hatch
inputs:
python-version:
description: 'Version of Python to Install'
required: true
default: '3.9'
runs:
using: "composite"
steps:
- name: "Set up Python ${{ inputs.python-version }}"
uses: actions/setup-python@v4
with:
python-version: "${{ inputs.python-version }}"

- name: Install Hatch
shell: bash
run: |
python -m pip install --user --upgrade pip
python -m pip install hatch
16 changes: 3 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,10 @@ jobs:
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: "Set up Python & Hatch - 3.11"
uses: ./.github/actions/setup-python-env
with:
python-version: '3.11'

- name: "Install build specific python dependencies"
run: |
python -m pip install --user --upgrade pip
python -m pip install --upgrade wheel twine check-wheel-contents
python -m pip --version
- name: "Install Hatch"
shell: bash
run: pip3 install hatch
python-version: "3.11"

- name: "Build Python Package"
run: |
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/ci_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,10 @@ jobs:
- name: Check out the repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: "Set up Python & Hatch - 3.11"
uses: ./.github/actions/setup-python-env
with:
python-version: '3.11'

- name: Install Hatch
shell: bash
run: pip3 install hatch
python-version: "3.11"

- name: Install pre-commit
shell: bash
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@ jobs:
- name: "Check out the repository"
uses: actions/checkout@v4

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
- name: "Set up Python & Hatch - 3.11"
uses: ./.github/actions/setup-python-env
with:
python-version: "${{ matrix.python-version }}"

- name: "Install Hatch"
shell: bash
run: pip3 install hatch

- name: "Run Tests"
run: hatch run test:unit

Expand Down

0 comments on commit e41d60f

Please sign in to comment.