-
Notifications
You must be signed in to change notification settings - Fork 38
73 lines (64 loc) · 2.31 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
66
67
68
69
70
71
72
73
name: Tests
on:
push:
branches: [main]
paths:
- 'HinetPy/**'
- 'tests/**'
- '.github/workflows/tests.yml'
pull_request:
branches: [main]
paths:
- 'HinetPy/**'
- 'tests/**'
- '.github/workflows/tests.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
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.8", "3.9", "3.10", "3.11", "3.12"]
#python-version: ["3.8", "3.12"]
os: [macos-latest, ubuntu-latest]
steps:
- 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: |
python -m pip install -r requirements.txt
python -m pip install --upgrade certifi
python -m pip install build pytest pytest-cov coverage[toml] codecov
python -m build --sdist
python -m 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