hotfix cache cleanup #534
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
# github action including pymongo see https://github.com/marketplace/actions/mongodb-in-github-actions | |
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ '3.8', '3.12'] | |
mongodb-version: ['5.0', ] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Set Up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install pandoc for ubuntu | |
if: startsWith(matrix.os, 'ubuntu-') | |
run: | | |
sudo apt-get install -y pandoc | |
- name: Install choco for windows | |
if: startsWith(matrix.os, 'windows-') | |
run: choco install pandoc -y | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools | |
pip install -r requirements-dev.txt | |
pip install pymongo | |
# - name: Install MongoDB (Windows) # see: https://github.com/ankane/setup-mongodb | |
# if: startsWith(matrix.os, 'windows-') | |
# uses: ankane/setup-mongodb@v1 | |
# with: | |
# mongodb-version: 5.0 | |
- name: Start MongoDB (Linux) | |
if: startsWith(matrix.os, 'ubuntu-') | |
uses: supercharge/mongodb-github-action@1.3.0 | |
with: | |
mongodb-version: ${{ matrix.mongodb-version }} | |
- name: Run pytest coverage | |
env: | |
ZENODO_SANDBOX_API_TOKEN: ${{ secrets.ZENODO_SANDBOX_API_TOKEN }} | |
ZENODO_API_TOKEN: ${{ secrets.ZENODO_API_TOKEN }} | |
run: pytest --cov --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
zenodo_cleanup: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
# This is the version of the action for setting up Python, not the Python version. | |
uses: actions/setup-python@v4 | |
with: | |
# Semantic version range syntax or exact version of a Python version | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools | |
pip install -r requirements-dev.txt | |
- name: Cleanup Zenodo Sandbox | |
env: | |
ZENODO_SANDBOX_API_TOKEN: ${{ secrets.ZENODO_SANDBOX_API_TOKEN }} | |
ZENODO_API_TOKEN: ${{ secrets.ZENODO_API_TOKEN }} | |
run: python tests/clean_zenodo_sandbox.py |