-
Notifications
You must be signed in to change notification settings - Fork 1
111 lines (95 loc) · 3.56 KB
/
reusable-DeployStack-SearchAPI.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
on:
workflow_call:
inputs:
# For building the docker image:
TAG:
required: True
description: The tag of the container. Branch-name or GitHub PR.
type: string
# Where to deploy:
AWS_REGION:
required: False
description: What region in AWS to run in.
default: us-east-1
type: string
NumConcurrentExecutions:
required: True
description: How many lambdas to keep warm at once.
type: number
# Pass into the container, what to run as:
MATURITY:
required: True
description: Passed into the container, what maturity the API runs as.
type: string
environment:
required: True
description: The GitHub Environment to use.
type: string
# Test suite args
PYTEST_ARGS:
required: False
description: Extra commands to append to the pytest command.
type: string
PYTEST_THREADS:
required: False
description: How many threads to use when running the test suite. (Default '0'. Supports 'auto')
default: 0
type: string
secrets:
# AWS Auth:
AWS_ACCESS_KEY_ID:
description: The access key for AWS.
required: True
AWS_SECRET_ACCESS_KEY:
description: The secret access key for AWS.
required: True
CERT_ARN:
description: AWS ARN of the https certificate.
required: True
CLOUDFRONT_LOGS_BUCKET:
description: Bucket to store CloudFront Logs (must already exist).
required: True
jobs:
deploy-SearchAPI:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ inputs.AWS_REGION }}
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: satackey/action-docker-layer-caching@v0.0.11
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- name: Deploy SearchAPI Stack w/ Makefile
run: >
make
-e TAG=${{ inputs.TAG }}
-e MATURITY=${{ inputs.MATURITY }}
-e NumConcurrentExecutions=${{ inputs.NumConcurrentExecutions }}
-e AcmCertificateArn=${{ secrets.CERT_ARN }}
-e CloudFrontLogsBucket=${{ secrets.CLOUDFRONT_LOGS_BUCKET }}
deploy-searchapi-stack
# If it's writing to a branch, the pull request to that branch already
# passed, OR it's a developing branch that doesn't need PR's. No need
# to run suite either way.
- name: Install pytest requirements
if: github.event_name == 'pull_request'
run: |
sudo apt-get update
sudo apt-get install libgdal-dev
export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True
python3 -m pip install --no-cache-dir --upgrade pip
python3 -m pip install --no-cache-dir wheel Cython
python3 -m pip install -r requirements.txt --use-deprecated=legacy-resolver
- name: Run Pytest
if: github.event_name == 'pull_request'
run: |
make -e TAG="${{ inputs.TAG }}" -e NUM_THREADS="${{ inputs.PYTEST_THREADS }}" -e PYTEST_ARGS="${{ inputs.PYTEST_ARGS }}" test-api