-
Notifications
You must be signed in to change notification settings - Fork 29
54 lines (48 loc) · 1.55 KB
/
python_live_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
name: Python live API tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GBIF_USER: ${{ secrets.GBIF_USER }}
GBIF_PWD: ${{ secrets.GBIF_PWD }}
GBIF_EMAIL: ${{ secrets.GBIF_EMAIL }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install -y libgeos-c1v5 libgeos-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Delete vcr cassettes so that it runs live tests
run: |
rm -rf test/vcr_cassettes/*
if [ "$(ls -A test/vcr_cassettes)" ]; then
echo "Directory is not empty"
exit 1
fi
- name: Tests
run: pytest
- name: Check if vcr cassettes were created today
run: |
for file in test/vcr_cassettes/*; do
file_date=$(stat -c %y "$file" | cut -d ' ' -f 1)
echo "File $file was created on $file_date"
current_date=$(date +%Y-%m-%d)
if [[ "$file_date" != "$current_date" ]]; then
echo "File $file was not created today"
exit 1
fi
done