Skip to content

Commit

Permalink
chore(ci): move setup into reusable workflow (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Jan 5, 2024
1 parent 15d3493 commit a3799ce
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 79 deletions.
20 changes: 20 additions & 0 deletions .github/actions/setup/action.yml
@@ -0,0 +1,20 @@
---

name: Setup - Install python, poetry, and dependencies
runs:
using: "composite"
steps:
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
shell: bash
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
# attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op)
cache: poetry
- name: Install Python dependencies
run: poetry install
shell: bash
99 changes: 20 additions & 79 deletions .github/workflows/tests-on-push.yml
Expand Up @@ -11,27 +11,14 @@ on:

jobs:
build-docs:
name: Build docs
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout source
- name: Checkout dsp-tools repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
# attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op)
cache: poetry
- name: Install Python dependencies
run: poetry install
# run tests
- name: Install python, poetry, and dependencies
uses: ./.github/actions/setup
- name: build docs
run: poetry run mkdocs build --strict
- name: check external links in docs
Expand All @@ -41,28 +28,16 @@ jobs:
- name: markdownlint
run: poetry exec markdownlint


lint:
name: Lint code
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout source
- name: Checkout dsp-tools repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
# attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op)
cache: poetry
- name: Install Python dependencies
run: poetry install
# run tests
- name: Install python, poetry, and dependencies
uses: ./.github/actions/setup
- name: Linting with ruff
run: poetry exec ruff-check-github
- name: Formatting with ruff
Expand All @@ -72,78 +47,43 @@ jobs:
- name: Linting with darglint
run: poetry exec darglint


unittests:
name: Run Unittests
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout source
- name: Checkout dsp-tools repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
# attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op)
cache: poetry
- name: Install Python dependencies
run: poetry install
# run tests
- name: Install python, poetry, and dependencies
uses: ./.github/actions/setup
- name: unittests
run: poetry exec unittests


benchmarking:
name: Run Benchmarking
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout source
- name: Checkout dsp-tools repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
# attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op)
cache: poetry
- name: Install Python dependencies
run: poetry install
# run tests
- name: Install python, poetry, and dependencies
uses: ./.github/actions/setup
- name: benchmarking
run: poetry run pytest -s test/benchmarking/


e2e-tests:
name: Run E2E/Integration Tests
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout source
- name: Checkout dsp-tools repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
# attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op)
cache: poetry
- name: Install Python dependencies
run: poetry install
- name: Install python, poetry, and dependencies
uses: ./.github/actions/setup

# Install programs for local processing (fast xmlupload)
- name: Fast xmlupload - Install ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v2
Expand All @@ -158,6 +98,7 @@ jobs:
- name: Fast xmlupload - ImageMagick - Installation
if: ${{ steps.search-cached-imagemagick.outputs.cache-hit != 'true' }}
uses: mfinelli/setup-imagemagick@v2 # downloads the "magick" AppImage to ~/bin/magick

# run tests
- name: start stack
run: poetry run dsp-tools start-stack --no-prune
Expand Down

0 comments on commit a3799ce

Please sign in to comment.