-
Notifications
You must be signed in to change notification settings - Fork 7
73 lines (64 loc) · 3.02 KB
/
pipeline-bucket3.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
# This workflow will build a new container weekly running the census data pipeline weekly pulls
# The datasets included in this bucket are, communities
name: Data Pipeline Bucket 3 - Communities
on:
workflow_dispatch:
env:
BUCKET_COMMAND: bucket_3
jobs:
run-test:
runs-on: ubuntu-latest
steps:
# checkout the repo
- name: "Checkout GitHub Action"
uses: actions/checkout@master
- name: "Generate env file"
run: |
echo 'POSTGRES_DB = ${{ secrets.POSTGRES_DB_TEST }}' >> .env
echo 'POSTGRES_DJANGO_USER = ${{ secrets.POSTGRES_DJANGO_USER_TEST }}' >> .env
echo 'POSTGRES_DJANGO_PASSWORD = ${{ secrets.POSTGRES_DJANGO_PASSWORD_TEST }}' >> .env
echo 'POSTGRES_HOST = ${{ secrets.POSTGRES_HOST_TEST }}' >> .env
echo 'ROUTE_PLANNER_API_KEY = ${{ secrets.ROUTE_PLANNER_API_KEY }}' >> .env
echo 'BUCKET_COMMAND = ${{ env.BUCKET_COMMAND }}' >> .env
- name: Start containers
run: docker-compose -f cit-api/docker-compose.yml up --build cit-api-pipeline
# docker-compose will return 0 even if python container returns non-zero or crashes
# ensure job fails if python container returns non-zero code or crashes
- name: check Container Status
run: |
container_status=$(docker ps --filter 'status=exited' --format '{{.Status}}')
if [[ $container_status == *"Exited (0)"* ]];
then
echo "Container exited successfully"
else
echo "Container exited with error: $container_status"
exit 1
fi
run-prod:
runs-on: ubuntu-latest
steps:
# checkout the repo
- name: "Checkout GitHub Action"
uses: actions/checkout@master
- name: "Generate env file"
run: |
echo 'POSTGRES_DB = ${{ secrets.POSTGRES_DB_PROD }}' >> .env
echo 'POSTGRES_DJANGO_USER = ${{ secrets.POSTGRES_DJANGO_USER_PROD }}' >> .env
echo 'POSTGRES_DJANGO_PASSWORD = ${{ secrets.POSTGRES_DJANGO_PASSWORD_PROD }}' >> .env
echo 'POSTGRES_HOST = ${{ secrets.POSTGRES_HOST_PROD }}' >> .env
echo 'ROUTE_PLANNER_API_KEY = ${{ secrets.ROUTE_PLANNER_API_KEY }}' >> .env
echo 'BUCKET_COMMAND = ${{ env.BUCKET_COMMAND }}' >> .env
- name: Start containers
run: docker-compose -f cit-api/docker-compose.yml up --build cit-api-pipeline
# docker-compose will return 0 even if python container returns non-zero or crashes
# ensure job fails if python container returns non-zero code or crashes
- name: check Container Status
run: |
container_status=$(docker ps --filter 'status=exited' --format '{{.Status}}')
if [[ $container_status == *"Exited (0)"* ]];
then
echo "Container exited successfully"
else
echo "Container exited with error: $container_status"
exit 1
fi