Skip to content

Support for Google Cloud Storage URLs (like WeatherBench2 data) #394

Support for Google Cloud Storage URLs (like WeatherBench2 data)

Support for Google Cloud Storage URLs (like WeatherBench2 data) #394

Workflow file for this run

name: Test and Deploy
# Triggers on pushes to main, dev and tags.
on:
workflow_dispatch:
push:
branches:
- main
- dev
tags:
- 'v*'
paths:
# Only run test and docker publish if some code have changed
- 'pyproject.toml'
- 'infrastructure/aws/**'
- 'titiler/**'
- '.pre-commit-config.yaml'
# Run tests on pull requests.
pull_request:
env:
LATEST_PY_VERSION: '3.10'
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .["test"]
- name: run pre-commit
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }}
run: |
python -m pip install pre-commit
pre-commit run --all-files
- name: Run tests
run: python -m pytest --cov titiler.xarray --cov-report term-missing -s -vv
deploy:
needs: [tests]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/v')
defaults:
run:
working-directory: infrastructure/aws
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::444055461661:role/github-actions-role-eodc
role-session-name: samplerolesession
aws-region: us-west-2
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Install cdk
run: npm install -g aws-cdk
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-cdk.txt
# Build and deploy to the development environment whenever there is a push to main or dev
- name: Build & Deploy Development
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
run: npm run cdk -- deploy titiler-xarray-development --require-approval never
env:
TITILER_XARRAY_PYTHONWARNINGS: ignore
TITILER_XARRAY_DEBUG: True
STACK_ALARM_EMAIL: ${{ secrets.ALARM_EMAIL }}
STACK_STAGE: development
# Build and deploy to production deployment whenever there a new tag is pushed
- name: Build & Deploy Production
if: startsWith(github.ref, 'refs/tags/v')
run: npm run cdk -- deploy titiler-xarray-production --require-approval never
env:
TITILER_XARRAY_PYTHONWARNINGS: ignore
TITILER_XARRAY_DEBUG: True
STACK_ALARM_EMAIL: ${{ secrets.ALARM_EMAIL }}
STACK_STAGE: production