-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Attempt dry-run of GitHub Actions and deployment
- Loading branch information
Showing
5 changed files
with
121 additions
and
6 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
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,51 @@ | ||
name: Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- feat/cloud_run | ||
|
||
env: | ||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | ||
|
||
jobs: | ||
docker: | ||
name: Docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.POLICYENGINE_DOCKER }} | ||
- name: Build container | ||
run: docker build -t ghcr.io/policyengine/policyengine docker | ||
- name: Push container | ||
run: docker push ghcr.io/policyengine/policyengine | ||
deploy: | ||
name: Deploy API to Cloud Run | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: GCP authentication | ||
uses: "google-github-actions/auth@v2" | ||
with: | ||
credentials_json: "${{ secrets.GCP_SA_KEY }}" | ||
- name: Set up GCloud | ||
uses: "google-github-actions/setup-gcloud@v1" | ||
- name: Deploy | ||
run: make deploy | ||
env: | ||
POLICYENGINE_DB_PASSWORD: ${{ secrets.POLICYENGINE_DB_PASSWORD }} | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_SA_KEY }} | ||
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN }} | ||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
runtime: custom | ||
service: default | ||
env: flex | ||
resources: | ||
cpu: 16 | ||
|
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,58 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"\n", | ||
"os.environ['POLICYENGINE_DB_PASSWORD'] = \"bokwen-4fedhu-disfIj\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from policyengine_us import Microsimulation\n", | ||
"from policyengine_core.reforms import Reform\n", | ||
"\n", | ||
"reform = Reform.from_dict({\n", | ||
" \"gov.irs.credits.eitc.max[0].amount\": {\n", | ||
" \"2024-01-01.2100-12-31\": 95000\n", | ||
" }\n", | ||
"}, country_id=\"us\")\n", | ||
"\n", | ||
"\n", | ||
"baseline = Microsimulation(dataset=\"enhanced_cps_2022\")\n", | ||
"reformed = Microsimulation(reform=reform, dataset=\"enhanced_cps_2022\")\n", | ||
"baseline_person = baseline.calculate(\"household_net_income\", period=2024, map_to=\"person\")\n", | ||
"reformed_person = reformed.calculate(\"household_net_income\", period=2024, map_to=\"person\")\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "test-pkg-api", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.14" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |