generated from developmentseed/eoapi-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates for deployment via gh actions (#19)
* add deploy job to ci.yaml * upgrade aws-cdk in package.json * Upgrade to new version of aws credentials action
- Loading branch information
Showing
8 changed files
with
967 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ on: | |
- '.github/workflows/ci.yml' | ||
- '.pre-commit-config.yaml' | ||
pull_request: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
tests: | ||
|
@@ -21,32 +24,23 @@ jobs: | |
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- uses: astral-sh/setup-uv@v5 | ||
- name: Install | ||
run: uv sync | ||
- name: Run pre-commit | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pre-commit | ||
pre-commit run --all-files | ||
run: uv run pre-commit run --all-files | ||
|
||
- name: Launch services | ||
run: docker compose up -d | ||
|
||
- name: install lib postgres | ||
uses: nyurik/action-setup-postgis@v2 | ||
|
||
- name: Install python dependencies | ||
run: | | ||
python -m pip install pytest httpx pypgstac==0.9.2 psycopg[pool] | ||
- name: Ingest Stac Items/Collection | ||
run: | | ||
pypgstac pgready --dsn postgresql://username:[email protected]:5439/postgis | ||
pypgstac load collections .github/workflows/data/noaa-emergency-response.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore | ||
pypgstac load items .github/workflows/data/noaa-eri-nashville2020.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore | ||
uv run pypgstac pgready --dsn postgresql://username:[email protected]:5439/postgis | ||
uv run pypgstac load collections .github/workflows/data/noaa-emergency-response.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore | ||
uv run pypgstac load items .github/workflows/data/noaa-eri-nashville2020.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore | ||
psql postgresql://username:[email protected]:5439/postgis -f .github/workflows/data/my_data.sql | ||
# see https://github.com/developmentseed/tipg/issues/37 | ||
|
@@ -59,7 +53,54 @@ jobs: | |
shell: bash | ||
|
||
- name: Integrations tests | ||
run: python -m pytest .github/workflows/tests/ | ||
run: uv run pytest .github/workflows/tests/ | ||
|
||
- name: Stop services | ||
run: docker compose stop | ||
|
||
deploy: | ||
name: Deploy | ||
environment: dev | ||
needs: [tests] | ||
permissions: | ||
id-token: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | ||
env: | ||
STACK_NAME: eoapi-dev | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Create config file | ||
run: | | ||
echo "${{ vars.CONFIG_YAML }}" > config.yaml | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::390960605471:role/eoapi-devseed | ||
role-session-name: eoapi-devseed | ||
aws-region: us-west-2 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
uv sync --only-group deploy | ||
uv run --only-group deploy npm install | ||
- name: CDK Synth | ||
run: uv run --only-group deploy npm run cdk -- synth | ||
|
||
- name: CDK Deploy | ||
run: | | ||
uv run --only-group deploy npm run cdk -- deploy --require-approval never |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
"name": "eoapi-template", | ||
"version": "0.1.0", | ||
"dependencies": { | ||
"aws-cdk": "2.130.0" | ||
"aws-cdk": "^2.177.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[project] | ||
name = "eoapi-devseed" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.12" | ||
dependencies = [] | ||
|
||
[dependency-groups] | ||
deploy = [ | ||
"boto3==1.24.15", | ||
"eoapi-cdk==7.4.1", | ||
"pydantic-settings[yaml]==2.2.1", | ||
"pydantic==2.7", | ||
"typing-extensions>=4.12.2", | ||
] | ||
dev = [ | ||
"httpx>=0.28.1", | ||
"pre-commit>=4.1.0", | ||
"psycopg[pool]>=3.2.4", | ||
"pypgstac==0.9.2", | ||
"pytest>=8.3.4", | ||
] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.