using getters and setters #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |