Skip to content

Fix check_doi

Fix check_doi #92

Workflow file for this run

name: pytest
on: [push, pull_request]
jobs:
pytest:
runs-on: ubuntu-22.04
strategy:
matrix:
mock: [true, false]
python-version: ['3.8', '3.11']
services:
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: postgres_password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up ssh
run: |
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" -C "" -q
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh-keyscan -t rsa localhost >> ~/.ssh/known_hosts
ssh localhost
- name: Install package
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install coveralls
python3 -m pip install -e .
python3 -m pip install -e .[pytest]
- name: Prepare database
run: |
psql postgres://postgres:postgres_password@localhost -c 'CREATE DATABASE test_isimip_metadata;'
psql postgres://postgres:postgres_password@localhost/test_isimip_metadata -c 'CREATE EXTENSION pg_trgm;'
- name: Setup environment file
run: |
echo "LOG_LEVEL=DEBUG" >> $GITHUB_ENV
echo "LOG_FILE=isimip-publisher.log" >> $GITHUB_ENV
echo "REMOTE_DEST=localhost" >> $GITHUB_ENV
echo "REMOTE_DIR=${GITHUB_WORKSPACE}/testing/remote/" >> $GITHUB_ENV
echo "LOCAL_DIR=${GITHUB_WORKSPACE}/testing/local/" >> $GITHUB_ENV
echo "PUBLIC_DIR=${GITHUB_WORKSPACE}/testing/public/" >> $GITHUB_ENV
echo "ARCHIVE_DIR=${GITHUB_WORKSPACE}/testing/archive/" >> $GITHUB_ENV
echo "DATABASE=postgresql+psycopg2://postgres:postgres_password@localhost/test_isimip_metadata" >> $GITHUB_ENV
echo "PROTOCOL_LOCATIONS=${GITHUB_WORKSPACE}/testing/protocol/" >> $GITHUB_ENV
echo "ISIMIP_DATA_URL=http://localhost:8000/" >> $GITHUB_ENV
echo "MOCK=${{ matrix.mock }}" >> $GITHUB_ENV
- name: Run pytest
run: |
pytest --cov=isimip_publisher
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
coveralls:
needs: pytest
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Run coveralls finish
run: |
pip install coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}