forked from stravalib/stravalib
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (60 loc) · 2.11 KB
/
build-test.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
name: Pytest unit/integration
on:
pull_request:
push:
branches:
- main
# Use bash by default in all jobs
defaults:
run:
shell: bash
jobs:
build-test:
name: Test Run (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
with:
# fetch more than the last single commit to help scm generate proper version
fetch-depth: 20
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set Variables
id: set_variables
shell: bash
run: |
echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_OUTPUT
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.set_variables.outputs.PIP_CACHE }}
key: ${{ runner.os }}-pip-${{ steps.set_variables.outputs.PY }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nox
- name: List installed packages
run: pip list
# Need tags for setuptools_scm to provide a proper version
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
# For now i made a separate tests run so we can see each version
# build via github actions. There may be a better way to do this.
- name: Run tests with pytest & nox
run: |
nox -s tests-${{ matrix.python-version }}
- name: Upload coverage to Codecov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'}}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
files: ./coverage.xml