File size: 5,052 Bytes
25f8cac
 
a100ffb
 
 
53e9e67
28bb969
 
 
 
1902017
a26da5f
a100ffb
 
53e9e67
28bb969
 
 
 
1902017
a26da5f
a100ffb
 
 
 
eea7daa
 
000f989
a100ffb
 
a34e0f3
 
c01fb54
a100ffb
 
 
 
 
 
 
4ef59ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a100ffb
 
 
 
 
 
 
57b6a78
a100ffb
b3fd9db
34688fd
3ca1cbf
3d7c303
 
41e5fd5
 
 
ebef609
3d7c303
d18011f
3d7c303
 
34688fd
3ca1cbf
 
099a9c6
cd171e8
ebef609
099a9c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
787cf18
099a9c6
 
 
 
 
 
 
 
 
cd171e8
 
099a9c6
 
 
cd171e8
eea7daa
 
 
cd171e8
 
 
 
 
 
 
 
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
name: CI

on:
  push:
    branches:
      - '*'
    paths:
      - 'test/**'
      - 'pysr/**'
      - '.github/workflows/**'
      - 'setup.py'
      - 'Project.toml'
  pull_request:
    branches:
      - '*'
    paths:
      - 'test/**'
      - 'pysr/**'
      - '.github/workflows/**'
      - 'setup.py'
      - 'Project.toml'

jobs:
  test:
    runs-on: ${{ matrix.os }}
    defaults:
      run:
        shell: bash
    strategy:
      matrix:
        julia-version: ['1.7.1']
        python-version: ['3.9']
        os: [ubuntu-latest]
    
    steps:
      - uses: actions/[email protected]
      - name: "Set up Julia"
        uses: julia-actions/[email protected]
        with:
          version: ${{ matrix.julia-version }}
      - name: "Change package server"
        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
            python -c 'import pysr; pysr.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
      - name: "Install JAX"
        run: pip install jax jaxlib # (optional import)
      - name: "Run JAX tests"
        run: coverage run --append --source=pysr --omit='*/feynman_problems.py' -m unittest test.test_jax
      - name: "Install Torch"
        run: pip install torch # (optional import)
      - name: "Run Torch tests"
        run: coverage run --append --source=pysr --omit='*/feynman_problems.py' -m unittest test.test_torch
      - name: Coveralls
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COVERALLS_FLAG_NAME: test-${{ matrix.test-name }}
          COVERALLS_PARALLEL: true
        run: coveralls --service=github

  conda_test:
    runs-on: ${{ matrix.os }}
    defaults:
      run:
        shell: bash -l {0}
    strategy:
      matrix:
        julia-version: ['1.7.1']
        python-version: ['3.9']
        os: ['ubuntu-latest']
    
    steps:
      - uses: actions/[email protected]
      - name: "Set up Julia"
        uses: julia-actions/[email protected]
        with:
          version: ${{ matrix.julia-version }}
      - name: "Change package server"
        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 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: test
          environment-file: environment.yml
      - name: "Install PySR"
        run: |
            python3 -m pip install .
            python3 -c 'import pysr; pysr.install()'
      - name: "Install Coverage tool"
        run: python3 -m pip install coverage coveralls
      - name: "Ensure that static libpython warning appears"
        run: coverage run --source=pysr --omit='*/feynman_problems.py' -m unittest test.test_static_libpython_warning
      - name: "Run tests"
        run: coverage run --append --source=pysr --omit='*/feynman_problems.py' -m unittest test.test
      - name: Coveralls
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COVERALLS_FLAG_NAME: conda-test-${{ matrix.test-name }}
          COVERALLS_PARALLEL: true
        run: coveralls --service=github

  coveralls:
    name: Indicate completion to coveralls.io
    needs: 
      - test
      - conda_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