Skip to content

Commit

Permalink
ci: Added tests workflows improvements (#27)
Browse files Browse the repository at this point in the history
* ci: Added tests workflow improvements
  • Loading branch information
micmurawski authored Aug 10, 2024
1 parent 64752ac commit 0bd3f9b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 45 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,8 @@ on:
types: [published]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
poetry config virtualenvs.create false
poetry install
- name: Install
run: poetry install --with dev
- name: Run Pytest
run: poetry run pytest
deploy:
runs-on: ubuntu-latest
needs: [ tests ]
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/run_tests_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run Tests
on:
workflow_call:
inputs:
python-version:
type: string
runs-on:
type: string
default: "ubuntu-latest"


jobs:
tests:
name: Run Tests for python${{ inputs.python-version }} on ${{ inputs.runs-on }}
runs-on: ${{ inputs.runs-on }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
poetry config virtualenvs.create false
poetry install
- name: Install
run: poetry install --with dev
- name: Run Lint and Format
run: |
poetry run ruff check
- name: Run Pytest
run: poetry run pytest
35 changes: 11 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
name: Test
name: Run Tests

on: [pull_request, workflow_dispatch]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
poetry config virtualenvs.create false
poetry install
- name: Install
run: poetry install --with dev
- name: Run Lint and Format
run: |
poetry run ruff check
poetry run ruff format
- name: Run Pytest
run: poetry run pytest
test_python38:
secrets: inherit
uses: ./.github/workflows/run_tests_linux.yml
with:
python-version: "3.8"
test_python312:
secrets: inherit
uses: ./.github/workflows/run_tests_linux.yml
with:
python-version: "3.12"
5 changes: 3 additions & 2 deletions poetry_plugin_lambda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@


def join_cmds(*cmds: list[list[str]], joiner: str = "&&") -> list[str]:
_cmds = list(filter(lambda x: x, cmds))
result = []
for i, cmd in enumerate(filter(lambda x: x, cmds)):
for i, cmd in enumerate(_cmds):
result += cmd
if i < len(cmds) - 1:
if i < len(_cmds) - 1:
result.append(joiner)
return result

Expand Down

0 comments on commit 0bd3f9b

Please sign in to comment.