Skip to content

Commit

Permalink
refactor: workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Mar 17, 2024
1 parent 8fe5057 commit d647441
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/test.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ jobs:
fail-fast: false

matrix:
config: [Release, Debug]
config:
- Release
- Debug

os:
- macos-latest
- ubuntu-latest
- windows-latest

vtk-system: [true, false]
os: [ubuntu-latest, windows-latest, macos-latest]

exclude:
- os: macos-latest
Expand All @@ -25,7 +32,7 @@ jobs:
runs-on: ${{ matrix.os }}
container: ${{ matrix.os == 'ubuntu-latest' && 'fedora:38' || null }}

name: '🧪 Test on ${{ matrix.os }} [Config: "${{ matrix.config }}", VTK installed: "${{ matrix.vtk-system }}"]'
name: '🧪 Test on ${{ matrix.os }} ["${{ matrix.config }}", VTK: "${{ matrix.vtk-system }}"]'

steps:
- name: 📥 Checkout
Expand All @@ -40,13 +47,11 @@ jobs:
- name: 🦥 Cache Dependencies
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-${{ matrix.config }}-cache
path: |
deps-cache
build
key: test-${{ matrix.os }}-${{ matrix.config }}-${{ matrix.vtk-system }}
path: build

- name: 🏗️ Compile
run: cmake -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCPM_SOURCE_CACHE=deps-cache -DVIENNALS_BUILD_TESTS=ON -B build && cmake --build build
run: cmake -DVIENNALS_BUILD_TESTS=ON -B build && cmake --build build --config ${{ matrix.config }}

- name: 🧪 Test
run: ctest -E "Benchmark|Performance" -C ${{ matrix.config }} --test-dir build
40 changes: 28 additions & 12 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@ jobs:
fail-fast: false

matrix:
vtk-system: [true, false]
os: [ubuntu-latest, windows-latest, macos-latest]

exclude:
- os: macos-latest
vtk-system: true

- os: windows-latest
vtk-system: true

runs-on: ${{ matrix.os }}
container: ${{ matrix.os == 'ubuntu-latest' && 'fedora:38' || null }}

name: '🐍 Build Bindings on ${{ matrix.os }} [VTK installed: "${{ matrix.vtk-system }}"]'
name: "🐍 Build Bindings on ${{ matrix.os }}"

steps:
- name: 📥 Checkout
Expand All @@ -34,7 +26,31 @@ jobs:
uses: ./.github/actions/setup
with:
container: ${{ matrix.os }}
install-vtk: ${{ matrix.vtk-system }}
install-vtk: false

- name: 🐍 Build Python Module
run: pip3 install --user . -v
- name: 🦥 Cache Dependencies
uses: actions/cache@v3
with:
key: python-${{ matrix.os }}
path: build

- name: 🐍 Build and check Python Module (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
python3 -m venv venv
./venv/Scripts/activate.bat
pip install .
python3 -c "import viennals2d; print(viennals2d.__doc__)"
- name: 🐍 Build and check Python Module (Other)
if: ${{ matrix.os != 'windows-latest' }}
run: |
python3 -m venv venv
./venv/bin/pip install .
./venv/bin/python -c "import viennals2d; print(viennals2d.__doc__)"
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Pre-Built (${{ matrix.os }})
path: venv

0 comments on commit d647441

Please sign in to comment.