-
Notifications
You must be signed in to change notification settings - Fork 38
65 lines (56 loc) · 2.03 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
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
paths:
- 'HinetPy/**'
- 'tests/**'
- '.github/workflows/**'
jobs:
test:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1 # Hinet doesn't allow parallel data request
fail-fast: false
matrix:
python-version: ["3.7", "3.10"]
os: [macos-latest, ubuntu-latest]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- name: Checkout
uses: actions/checkout@v4
with:
# fecth all history so that setuptools-scm works
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest>=6.0 pytest-cov coverage[toml] codecov
python setup.py sdist --formats=zip
pip install dist/*
- name: Install win32tools
run: |
# Download win32tools
python -c "from HinetPy import Client; Client('${{ secrets.HINET_USERNAME }}', '${{ secrets.HINET_PASSWORD }}')._get_win32tools()"
# Compile and install win32tools
tar -xf win32tools.tar.gz && rm win32tools.tar.gz
# patch the win2sac source code on macOS
if [ "$RUNNER_OS" == "macOS" ]; then sed -i.bak 's/malloc.h/stdlib.h/' win32tools/win2sac.src/s4read_data.c; fi
cd win32tools; make; mkdir bin; mv catwin32.src/catwin32 win2sac.src/win2sac_32 bin/; cd ..
# Add to PATH
echo "${{ github.workspace }}/win32tools/bin" >> $GITHUB_PATH
- name: Run tests
run: make test
env:
HINET_USERNAME: ${{ secrets.HINET_USERNAME }}
HINET_PASSWORD: ${{ secrets.HINET_PASSWORD }}
- name: Upload coverage reports
uses: codecov/codecov-action@v4