MilesCranmer's picture
Add test for pytorch export
3d7c303
raw
history blame
2.99 kB
on:
push:
branches:
- master
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/**'
- 'setup.py'
- 'Project.toml'
pull_request:
branches:
- master
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/**'
- 'setup.py'
- 'Project.toml'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1.5.0', '1.6.1']
python-version: ['3.6']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v1.0.0
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1.6.0
with:
version: ${{ matrix.julia-version }}
- name: "Change package server"
shell: bash
env:
JULIA_PKG_SERVER: ""
run: |
julia -e 'using Pkg; Pkg.Registry.add("General")'
- name: "Cache dependencies"
uses: actions/cache@v1 # Thanks FromFile.jl
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: "Set up Python"
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python setup.py install
- name: "Install Coverage tool"
run: pip install coverage coveralls
- name: "Run tests"
run: coverage run --source=pysr --omit='*/feynman_problems.py' -m unittest test.test
shell: bash
- name: "Install JAX"
if: matrix.os != 'windows-latest'
run: pip install jax jaxlib # (optional import)
shell: bash
- name: "Run JAX tests"
if: matrix.os != 'windows-latest'
run: coverage run --append --source=pysr --omit='*/feynman_problems.py' -m unittest test.test_jax
shell: bash
- name: "Install Torch"
run: pip install torch # (optional import)
shell: bash
- name: "Run Torch tests"
run: coverage run --append --source=pysr --omit='*/feynman_problems.py' -m unittest test.test_torch
shell: bash
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.test-name }}
COVERALLS_PARALLEL: true
run: coveralls --service=github
coveralls:
name: Indicate completion to coveralls.io
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install coveralls
coveralls --finish