-
Notifications
You must be signed in to change notification settings - Fork 66
110 lines (108 loc) · 3.78 KB
/
tests.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
name: Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
jobs:
julia:
name: julia-${{ matrix.test-type }}-${{ matrix.os }}-jl${{ matrix.jlversion }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
arch: [x64] # x86 unsupported by MicroMamba
os: [ubuntu-latest, windows-latest, macos-latest]
jlversion: ['1','1.6']
test-type: ['unit']
steps:
- uses: actions/checkout@v2
- name: Set up Julia ${{ matrix.jlversion }}
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.jlversion }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Build package
uses: julia-actions/julia-buildpkg@v1
- name: Run tests
uses: julia-actions/julia-runtest@v1
env:
JULIA_DEBUG: PythonCall
JULIA_NUM_THREADS: '2'
- name: Process coverage
uses: julia-actions/julia-processcoverage@v1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
if: ${{ matrix.test-type == 'unit' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
python:
name: python-${{ matrix.test-type }}-${{ matrix.os }}-py${{ matrix.pyversion }}
runs-on: ${{ matrix.os }}
env:
PYTHON_JULIACALL_THREADS: '2'
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
pyversion: ["3.x", "3.8"]
test-type: ['unit']
include:
- os: ubuntu-latest
pyversion: '3.x'
test-type: 'integration'
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.pyversion }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyversion }}
- name: Set up Julia
uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov nbval numpy
cp pysrc/juliacall/juliapkg-dev.json pysrc/juliacall/juliapkg.json
pip install -e .
- name: Install integration test dependencies
if: ${{ matrix.test-type == 'integration' }}
run: |
pip install sympy pandas scikit_learn click setuptools
# Note that the `--no-deps` flag is needed for ensuring
# we avoid installing a newer julicall. The initial `pip install`
# is for the non-juliacall dependencies.
pip install --no-deps pysr
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run unit tests
if: ${{ matrix.test-type == 'unit' }}
run: pytest -s --nbval --cov=pysrc ./pytest/ -k "not integration"
- name: Run integration tests
if: ${{ matrix.test-type == 'integration' }}
run: pytest -s ./pytest/integration/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
if: ${{ matrix.test-type == 'unit' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}