-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-json-to-history-operations
- Loading branch information
Showing
5 changed files
with
122 additions
and
101 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
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,118 @@ | ||
name: Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
envName: | ||
description: "Deploy Environment" | ||
default: "dev" | ||
required: true | ||
type: choice | ||
options: | ||
- dev | ||
- prod | ||
|
||
jobs: | ||
log: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Display Environment Name | ||
run: echo "Hello ${{ inputs.envName }}" | ||
|
||
pre-commit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- id: file_changes | ||
uses: trilom/[email protected] | ||
with: | ||
output: " " | ||
|
||
- uses: pre-commit/[email protected] | ||
env: | ||
extra_args: --color=always --files ${{ steps.file_changes.outputs.files}} | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
cat airflow_variables_dev.json | sed -e s/\\/home\\/airflow\\/gcs\\/dags\\/// > airflow_variables_ci.json | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-ci.txt | ||
- name: Init Airflow SQLite database | ||
run: airflow db init | ||
|
||
- name: Import Airflow variables | ||
run: airflow variables import airflow_variables_ci.json | ||
|
||
- name: Authenticate to test-hubble GCP | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: "${{ secrets.CREDS_TEST_HUBBLE }}" | ||
|
||
- id: "get-credentials" | ||
uses: "google-github-actions/get-gke-credentials@v2" | ||
with: | ||
cluster_name: "us-central1-test-hubble-43c3e190-gke" | ||
location: "us-central1" | ||
|
||
- name: Pytest | ||
run: pytest dags/ | ||
|
||
deploy-to-dev: | ||
runs-on: ubuntu-latest | ||
needs: [tests] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install google-cloud-storage==2.1.0 | ||
- name: Authenticate to test-hubble GCP | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: "${{ secrets.CREDS_TEST_HUBBLE }}" | ||
|
||
- name: Upload files to dev GCS bucket | ||
run: python dags/stellar_etl_airflow/add_files_to_composer.py --bucket $BUCKET | ||
env: | ||
GOOGLE_CLOUD_PROJECT: test-hubble-319619 | ||
BUCKET: us-central1-test-hubble-43c3e190-bucket | ||
|
||
- name: Update Airflow variables | ||
uses: actions-hub/gcloud@master | ||
env: | ||
PROJECT_ID: test-hubble-319619 | ||
APPLICATION_CREDENTIALS: "${{ secrets.CREDS_TEST_HUBBLE }}" | ||
COMPOSER_ENVIRONMENT: test-hubble | ||
LOCATION: us-central1 | ||
with: | ||
args: > | ||
components install kubectl && gcloud composer environments run | ||
$COMPOSER_ENVIRONMENT --location $LOCATION variables import | ||
-- gcsfuse/actual_mount_path/variables.json |
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