-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (61 loc) · 2.14 KB
/
pytest.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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# Helpful article to cache anaconda envs and install using mamba
# https://dev.to/epassaro/caching-anaconda-environments-in-github-actions-5hde
name: Pytest
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Everyday at 00:00 UTC
- cron: '0 0 * * *'
env:
CACHE_NUMBER: 0 # increase to reset cache manually
COINCAP_AUTH_HEADER: ${{ secrets.COINCAP_AUTH_HEADER }} # allow interaction with Coincap API to get BTC data
permissions:
contents: read
jobs:
build-and-test:
strategy:
matrix:
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/bitcoin
- os: macos-latest
label: osx-64
prefix: /Users/runner/miniconda3/envs/bitcoin
- os: windows-latest
label: win-64
prefix: C:\Miniconda3\envs\bitcoin
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: bitcoin
use-mamba: true
- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: |
mamba env update -n bitcoin -f environment.yml
conda init bash
if: steps.cache.outputs.cache-hit != 'true'
- name: Install repo as package and run tests
shell: bash -l {0}
run: |
conda activate bitcoin
pip install .
pytest