-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (139 loc) · 4.76 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Deploy APT API
on:
workflow_dispatch: # allows for manual invocation
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python 3
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install APT-GET dependencies
run: |
sudo apt-get update
sudo apt-get install -y libxml2-dev libxmlsec1-dev libxmlsec1-openssl
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -e .[dev] --no-binary xmlsec
- name: Run linting
run: |
pre-commit run -vvv --all-files
# test:
# needs: [lint]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Setup python 3
# uses: actions/setup-python@v2
# with:
# python-version: 3.8
# - name: Install APT-GET dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y libxml2-dev libxmlsec1-dev libxmlsec1-openssl
# sudo apt-get install texlive-latex-recommended texlive-xetex latexmk
# - name: Install Python dependencies
# run: |
# pip install --upgrade pip setuptools wheel
# pip install -e .[test] --no-binary xmlsec
# - name: Run tests
# run: pytest tests --cov app --cov-report term-missing --ignore=venev
deploy-staging:
needs: [lint]
if: (github.event.ref == 'refs/heads/develop')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python 3
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 18
- name: Configure awscli
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DS_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DS_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Make .env file
run: |
cat <<EOF >> .env
STAGE=staging
API_VERSION_STRING=/v2
# Frontend Url used to set CORS origin for FastAPI
APT_FRONTEND_URL=https://nasa-apt.surge.sh
NOTIFICATIONS_FROM="[email protected]"
APT_FEATURE_JOURNAL_PDF_EXPORT_ENABLED="true"
DATABASE_FROM_SNAPSHOT_ID="nasa-apt-api-staging-db-encrypted"
EOF
- name: Install APT dependencies
run: |
sudo apt-get update
sudo apt-get install -y libxml2-dev libxmlsec1-dev libxmlsec1-openssl
- name: Install python dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -e .[deploy] --no-binary xmlsec
- name: Install CDK
# upgrade cdk version to latest
run: npm install -g [email protected]
# CDK warning 19836 regarding cdk version blocks CDK bootstrap
- name: Bootstrap CDK
run: |
cdk acknowledge 19836
cdk bootstrap
- name: Deploy stack
run: |
cdk acknowledge 19836
cdk synth nasa-apt-api-staging
cdk deploy nasa-apt-api-staging --require-approval never
# deploy-prod:
# needs: [test]
# if: github.event.ref == 'refs/heads/master'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Setup python 3
# uses: actions/setup-python@v2
# with:
# python-version: 3.8
# - name: Setup Node
# uses: actions/setup-node@v1
# with:
# node-version: 14
# - name: Configure awscli
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.UAH_AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.UAH_AWS_SECRET_ACCESS_KEY }}
# aws-region: us-east-2
# - name: Make .env file
# run: |
# cat <<EOF >> .env
# STAGE=prod
# API_VERSION_STRING=/v2
# # Frontend Url used to set CORS origin for FastAPI
# APT_FRONTEND_URL=https://impact.earthdata.nasa.gov/apt
# NOTIFICATIONS_FROM="[email protected]"
# EOF
# - name: Install APT dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y libxml2-dev libxmlsec1-dev libxmlsec1-openssl
# - name: Install python dependencies
# run: |
# pip install --upgrade pip setuptools wheel
# pip install -e .[deploy] --no-binary xmlsec
# - name: Install CDK
# run: npm install -g [email protected]
# - name: Bootstrap CDK
# run: cdk bootstrap
# - name: Deploy stack
# run: cdk deploy nasa-apt-api-lambda-prod --require-approval never