-
Notifications
You must be signed in to change notification settings - Fork 40
71 lines (57 loc) · 2.55 KB
/
test_data.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
##############################################################################
# This runs the unit-tests and data-quality tests that use real data from
# the SimFin server. These are combined into a single test, so we only have
# to download the data once from the SimFin server.
##############################################################################
name: Test Data
on:
# Hack to disable this GitHub Action without deleting this file.
# From: https://github.community/t5/GitHub-Actions/How-can-I-disable-a-github-action/m-p/46968#M6668
push:
branches-ignore:
- '**'
# Run this GitHub action on a schedule using the cron.
# schedule:
# Every day at 08:00 UTC, one hour after datasets are updated on server.
#- cron: "0 8 * * *"
# Every 5 minutes for testing, as it cannot be triggered manually.
#- cron: "*/5 * * * *"
jobs:
test:
# We currently only test with the latest ubuntu version.
runs-on: ubuntu-latest
steps:
# Checkout the repo from GitHub to a temporary work-directory.
- name: Checkout GitHub repository
uses: actions/checkout@v1
# Run with a Python version that we know works.
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
# Install all requirements to run these tests.
# Note: The pip cache is not used, because we want a new simfin install.
- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install pytest nbval
# Install the simfin package that was cloned from GitHub.
- name: Install simfin package
run: pip install .
# Ensure the simfin data-dir is removed. This should not be necessary.
- name: Delete simfin data-dir
run: rm -rf ~simfin_data
# Write encrypted SimFin API-key to the key-file used by the test-scripts.
# This allows for download of all SimFin premium datasets. Without this
# API-key it would raise a SimFin server-error for the premium datasets,
# which would cause the tests to fail. The API-key should be hidden from
# everyone except the admins of the main GitHub repository.
- name: Set SimFin API-key
run: echo ${{ secrets.SIMFIN_API_KEY }} > ~/simfin_api_key.txt
# Run the unit-tests that use real data from the SimFin server.
- name: Unit-tests with real data
run: pytest tests/test_load.py
# Run data-quality tests.
- name: Data-quality tests
run: pytest --nbval-lax -v tests/test_bulk_data.ipynb
##############################################################################