Skip to content

Commit

Permalink
Improvced and cleaned workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskar committed Jan 27, 2024
1 parent 7305571 commit 9de8031
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 40 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/build-test-gc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# This workflow will install Python dependencies, the package, and run the tests
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# Build the package with graph-cut support and runs the graphcut tests
# This test is kept separate, as the graphcut functionality is optional and unstable
# Triggered whenever a PR into the main or a Release* branch is opened
# Triggered for each new published release

name: Build and test (w graphcut)

on:
push:
branches: [ "master", "Release*" ]
release:
types: [published]
pull_request:
branches: [ "master", "Release*" ]

Expand All @@ -16,32 +18,19 @@ jobs:
strategy:
fail-fast: false
matrix:
#python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies for graphcut functionality
run: sudo apt-get install -y libboost-python-dev build-essential
- name: Locate libboost
run: |
cat /etc/ld.so.conf.d/*
ls /usr/lib/x86_64-linux-gnu/libboost_*
ls /lib/x86_64-linux-gnu/libboost_*
- name: Find library
run: python -c "import sys; from ctypes.util import find_library; print('boost_python' + str(sys.version_info.major) + str(sys.version_info.minor), find_library('boost_python' + str(sys.version_info.major) + str(sys.version_info.minor)))"
- name: Install with test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -v .[test]
- name: Check install
run: |
python -c "import medpy; print(medpy.__file__)"
python -c "import medpy.graphcut; print(medpy.graphcut.__file__)"
python -c "import medpy.graphcut; print(medpy.graphcut.maxflow.__file__)"
- name: Test with pytest
python -m pip install .[test]
- name: Test with pytest (graphcut test only)
run: pytest tests/graphcut_/*
14 changes: 7 additions & 7 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# This workflow will install Python dependencies, the package, and run the tests
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# Build the package and run all tests except the graph-cut ones
# Triggered whenever a PR into the main or a Release* branch is opened
# Triggered for each new published release

name: Build and test (wo graphcut)

on:
push:
branches: [ "master", "Release*" ]
release:
types: [published]
pull_request:
branches: [ "master", "Release*" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install with test dependencies
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# Runs the pre-commit hooks to make sure that all pushes are properly and consistently treated
# Also triggers for PRs (potentially coming from external) into master and Release* branches

name: Pre-commit hooks

on: [push, pull_request]
on:
push:
branches: ['**'] # note: without branches would execute for tags, too
pull_request:
branches: [ "master", "Release*" ]

jobs:
main:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: 3.x
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()

0 comments on commit 9de8031

Please sign in to comment.