-
Notifications
You must be signed in to change notification settings - Fork 112
107 lines (105 loc) · 3.84 KB
/
main.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
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on: [push, pull_request]
# Older settings:
# Triggers the workflow on push request events for the master branch,
# and pull request events for all branches.
#on:
# push:
# branches: [ master ]
# pull_request:
# branches: [ '**' ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest] #, windows-latest] # Run macos tests if really required, since they charge 10 times more for macos
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
#- os: windows-latest
# path: ~\AppData\Local\pip\Cache
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Ref: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# Install Poetry and dependencies
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set up cache
uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install
# Runs a single command using the runners shell
- name: Welcome message
run: echo Hello, world! Welcome PyElastica Build, lets start testing!
# Run style checks (black and flake8)
- name: Run style checks
run: |
make check-codestyle
# Test PyElastica using pytest
- name: Run tests
run: |
make test
report-coverage: # Report coverage from python 3.8 and mac-os. May change later
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8"]
os: [macos-latest]
include:
- os: macos-latest
path: ~/Library/Caches/pip
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set up cache
uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install
- name: Run style checks
run: |
make check-codestyle
- name: Test PyElastica using pytest
if: startsWith(runner.os, 'macOS')
run: |
make test_coverage_xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}