-
Notifications
You must be signed in to change notification settings - Fork 224
171 lines (162 loc) · 4.97 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Linux
on:
push:
branches:
- '**'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI.yml'
- 'setup.py'
tags:
- 'v*.*.*'
pull_request:
branches:
- '*'
paths:
- 'test/**'
- 'pysr/**'
- '.github/workflows/CI.yml'
- 'setup.py'
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
defaults:
run:
shell: bash
strategy:
matrix:
julia-version: ['1.9']
python-version: ['3.10']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
- name: "Cache Julia"
uses: julia-actions/cache@v1
with:
cache-name: ${{ matrix.os }}-test-${{ matrix.julia-version }}-${{ matrix.python-version }}
cache-packages: false
- name: "Set up Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python setup.py install
python -m pysr install
- name: "Install Coverage tool"
run: pip install coverage coveralls
- name: "Run tests"
run: |
coverage run --source=pysr --omit='*/test/*,*/feynman_problems.py' -m pysr.test main
coverage run --append --source=pysr --omit='*/test/*,*/feynman_problems.py' -m pysr.test cli
- name: "Install JAX"
run: pip install jax jaxlib # (optional import)
- name: "Run JAX tests"
run: coverage run --append --source=pysr --omit='*/test/*,*/feynman_problems.py' -m pysr.test jax
- name: "Install Torch"
run: pip install torch # (optional import)
- name: "Run Torch tests"
run: coverage run --append --source=pysr --omit='*/test/*,*/feynman_problems.py' -m pysr.test torch
- name: "Run custom env tests"
run: coverage run --append --source=pysr --omit='*/test/*,*/feynman_problems.py' -m pysr.test env
- name: "Coveralls"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: test-${{ matrix.test-name }}
COVERALLS_PARALLEL: true
run: coveralls --service=github
incremental_install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Build incremental install"
run: docker build -t pysr -f pysr/test/incremental_install_simulator.dockerfile .
- name: "Test incremental install"
run: docker run --rm pysr /bin/bash -l -c 'python3 -m pysr.test main && python3 -m pysr.test env'
conda_test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ['3.9']
os: ['ubuntu-latest']
steps:
- uses: actions/checkout@v3
- name: "Cache conda"
uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
- name: "Set up Conda"
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
auto-activate-base: true
python-version: ${{ matrix.python-version }}
activate-environment: pysr-test
environment-file: environment.yml
- name: "Cache Julia"
uses: julia-actions/cache@v1
with:
cache-name: ${{ matrix.os }}-conda-${{ matrix.python-version }}
cache-packages: false
- name: "Install PySR"
run: |
python3 -m pip install .
python3 -m pysr install
- name: "Run tests"
run: cd /tmp && python -m pysr.test main
coveralls:
name: Indicate completion to coveralls.io
needs:
- test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
container: python:3-slim
steps:
- name: Finished
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install coveralls
coveralls --finish
types:
name: Check types
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v3
- name: "Set up Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: "Install PySR and all dependencies"
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install mypy jax jaxlib torch
python setup.py install
- name: "Run mypy"
run: mypy --install-types --non-interactive pysr