Skip to content

improve robustness and correct a couple of bugs #395

improve robustness and correct a couple of bugs

improve robustness and correct a couple of bugs #395

name: Run Pytorch 1 and 2
on:
push:
branches:
- main
paths-ignore:
- .github/workflows/bioimageio_ci.yml
- .github/workflows/test_mac_shm.yml
pull_request:
branches: [ main ]
jobs:
build-and-run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest, macos-12]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- name: Build with Maven
run: mvn clean install
- name: Generate Classpath (Unix)
if: runner.os != 'Windows'
run: |
mvn clean install org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade -Dshade.mainClass=io.bioimage.modelrunner.example.ExampleLoadPytorch1Pytorch2
- name: Generate Classpath (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$classpath = mvn -q exec:exec "-Dexec.executable=echo" "-Dexec.args='%classpath'"
echo "CLASSPATH=$classpath" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Write Version to File
if: runner.os != 'Windows'
run: |
echo "$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" > version.txt
echo "JAR_PATH=target/dl-modelrunner-$(cat version.txt).jar" >> $GITHUB_ENV
shell: bash
- name: Run Specific Class (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
java -cp $JAR_PATH io.bioimage.modelrunner.example.ExampleLoadPytorch1Pytorch2
- name: Run Specific Class (Windows)
if: runner.os == 'Windows'
shell: powershell
run: java -cp "$env:CLASSPATH;target/classes" io.bioimage.modelrunner.example.ExampleLoadPytorch1Pytorch2