Universal setup action

pull/388/head
Wyatt Stanke 11 months ago
parent e851966295
commit 3456159e84
No known key found for this signature in database
GPG Key ID: CE6BA5FFF135536D

@ -1,15 +1,20 @@
---
name: "Init Environment"
description: "Initialize environment for tests"
name: "Setup"
description: Setup the environment for the project
inputs:
python-version:
description: "Python version to use"
required: false
default: "3.10"
runs:
using: "composite"
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/checkout@v4
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ inputs.python-version }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
@ -31,3 +36,8 @@ runs:
source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
shell: bash
- name: "Install apt dependencies"
run: |
sudo apt-get update
sudo apt-get install -y python3-opencv
shell: bash

@ -17,14 +17,7 @@ jobs:
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- uses: ./.github/library/setup
- name: Build project for distribution
run: poetry build
- name: Check Version

@ -10,10 +10,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: ./.github/library/setup
- run: pip install mkdocs-material
- run: pip install mkdocs-glightbox
- run: pip install "mkdocstrings[python]"

@ -5,21 +5,19 @@ jobs:
yaml-lint:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
- uses: ./.github/library/setup
- name: yaml Lint
uses: ibiqlik/action-yamllint@v3
flake8-lint:
runs-on: ubuntu-latest
name: flake8 Lint
steps:
- name: Check out source repository
uses: actions/checkout@v4
- uses: ./.github/library/setup
- name: Set up Python environment
uses: py-actions/flake8@v2
ruff-lint:
runs-on: ubuntu-latest
name: ruff Lint
steps:
- uses: actions/checkout@v4
- uses: ./.github/library/setup
- uses: chartboost/ruff-action@v1

@ -8,11 +8,7 @@ jobs:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: ./.github/library/setup
- name: Install dependencies
run: |
python -m pip install --upgrade pip

@ -14,16 +14,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest swarms
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- uses: ./.github/library/setup
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names

@ -16,17 +16,9 @@ jobs:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: ./.github/library/setup
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade swarms
python -m pip install flake8 pytest swarms
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names

@ -9,15 +9,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- uses: ./.github/library/setup
- name: Build package
run: python -m build
- name: Publish package

@ -14,15 +14,8 @@ jobs:
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v4
- uses: ./.github/library/setup
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: "snok/install-poetry@v1"
- name: Install dependencies
run: poetry install --no-root --no-interaction
- name: Run tests
run: pytest

@ -15,10 +15,7 @@ jobs:
name: pytype 3.10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: ./.github/library/setup
- name: Run pytype
run: |
python --version
@ -29,10 +26,7 @@ jobs:
name: Check format with black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: ./.github/library/setup
- name: Check format
run: |
python --version

@ -8,15 +8,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/library/setup
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
- name: Run unit tests
run: pytest

@ -9,16 +9,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: ./.github/library/setup
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
pip install swarms
- name: Run Python unit tests
run: pytest
- name: Verify that the Docker image for the action builds

Loading…
Cancel
Save