File size: 2,733 Bytes
00ab5ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
name: CI_conda
# This tests whether conda, a statically-linked libpython, works
# with PySR.

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 }}
    strategy:
      matrix:
        julia-version: ['1.5.0', '1.6.1', '1.7.1']
        python-version: ['3.7', '3.8', '3.9']
        os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
    
    steps:
      - uses: actions/[email protected]
      - name: "Set up Julia"
        uses: julia-actions/[email protected]
        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 Conda"
        uses: conda-incubator/setup-miniconda@v2
        with:
          auto-activate-base: true
          auto-update-conda: true
          channels: conda-forge
          python-version: ${{ matrix.python-version }}
      - name: "Install PySR"
        run: |
            python -m pip install --upgrade pip
            conda install -c conda-forge $(cat requirements.txt | grep -v "julia" | xargs echo | sed "s/_/-/g")
            pip 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
        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