This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
Update README.md #1072
Workflow file for this run
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: CI | |
on: | |
# push: | |
# branches: | |
# - main | |
# - prod | |
# paths-ignore: | |
# - 'docs/**' | |
# pull_request: | |
# branches: | |
# - main | |
# - prod | |
# paths-ignore: | |
# - 'docs/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PYTEST_ADDOPTS: '--color=yes' | |
jobs: | |
test: | |
name: ${{ matrix.python-version }}-${{ matrix.database }} | |
runs-on: ubuntu-latest | |
# https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers | |
# See also https://remarkablemark.org/blog/2021/03/14/setup-postgresql-in-github-actions/ | |
# and https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_DB: postgres_db | |
POSTGRES_PASSWORD: postgres_password | |
POSTGRES_PORT: 5432 | |
POSTGRES_USER: postgres_user | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9] | |
database: ['sqlite', 'postgres'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: setup miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: pfo | |
python-version: ${{ matrix.python-version }} | |
auto-activate-base: false | |
- name: install pangeo-forge-orchestrator plus deps | |
shell: bash -l {0} | |
run: | | |
pip install -e '.[dev]' | |
- name: print conda env | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Set DATABASE_URL | |
shell: bash -l {0} | |
run: | | |
if [[ "${{ matrix.database }}" == "sqlite" ]]; then \ | |
echo "DATABASE_URL=sqlite:///${{ github.workspace }}/database.sqlite" >> $GITHUB_ENV; \ | |
else \ | |
echo "DATABASE_URL=postgres://postgres_user:postgres_password@localhost:5432/postgres_db" >> $GITHUB_ENV; \ | |
fi | |
- name: Maybe run migrations on postgres database | |
if: matrix.database == 'postgres' | |
shell: bash -l {0} | |
run: | | |
python -m alembic upgrade head | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
pytest tests -v --cov=pangeo_forge_orchestrator \ | |
--cov-config .coveragerc \ | |
--cov-report term-missing \ | |
--cov-report xml \ | |
--durations=10 --durations-min=1.0 | |
- name: Codecov | |
uses: codecov/[email protected] | |
with: | |
file: ./coverage.xml | |
env_vars: OS,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false |