-
Notifications
You must be signed in to change notification settings - Fork 75
153 lines (150 loc) · 7.36 KB
/
main.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
142
143
144
145
146
147
148
149
150
151
152
153
# This is a basic workflow to help you get started with Actions
name: update-data
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch: {}
push:
branches:
- master
schedule:
- cron: "20 1 * * *"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
fetch-data:
runs-on: ubuntu-latest
steps:
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Check out repo
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Fetch data
uses: githubocto/flat@v3
with:
http_url: https://www.ndbc.noaa.gov/activestations.xml
downloaded_filename: ./noaa-ndbc-data/active-stations.xml
- name: Fetch data
uses: githubocto/flat@v3
with:
http_url: https://www.ndbc.noaa.gov/data/latest_obs/latest_obs.txt
downloaded_filename: ./noaa-ndbc-data/latest-observations.txt
postprocess: ./noaa-ndbc-data/postprocess.js
- name: Fetch data
uses: githubocto/flat@v3
with:
http_url: https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson
downloaded_filename: ./usgs-earthquake-data/all_week.geojson
postprocess: ./usgs-earthquake-data/postprocess.js
- name: Fetch bitcoin data
uses: githubocto/flat@v3
with:
http_url: https://api.coindesk.com/v1/bpi/currentprice.json
downloaded_filename: ./bitcoin-price-data/currentprice.json
postprocess: ./bitcoin-price-data/postprocess.js
process-data:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: fetch-data
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Setup Ruby, JRuby and TruffleRuby
uses: ruby/[email protected]
with:
ruby-version: 3.0.1
- name: InfluxDB Action
uses: influxdata/influxdb-action@v3
with:
influxdb_version: 2.0.7
influxdb_org: influxdata
influxdb_user: ci_user
influxdb_password: password
influxdb_bucket: dummy
- name: Generate Air Sensor LP
run: |
ruby $GITHUB_WORKSPACE/air-sensor-data/air-sensor-data.rb > $GITHUB_WORKSPACE/air-sensor-data/air-sensor-data.lp
- name: Generate Air Sensor CSV
run: |
/usr/local/bin/influx write -f $GITHUB_WORKSPACE/air-sensor-data/air-sensor-data.lp -b dummy
/usr/local/bin/influx query "from(bucket: \"dummy\") |> range(start: -1y) |> drop(columns: [\"_start\",\"_stop\"])" --raw > $GITHUB_WORKSPACE/air-sensor-data/air-sensor-data-annotated.csv
/usr/local/bin/influx bucket delete -n dummy
- name: Generate NOAA LP and CSV
run: |
/usr/local/bin/influx bucket create -n dummy
/usr/local/bin/influx write dryrun -f $GITHUB_WORKSPACE/noaa-ndbc-data/latest-observations.csv --format csv --header "#constant measurement,ndbc" --header "#datatype double,double,double,double,double,double,long,double,double,double,double,double,double,double,tag,double,double,double,tag,tag,tag,tag,string,string,string,string,dateTime:number" > $GITHUB_WORKSPACE/noaa-ndbc-data/latest-observations.lp
/usr/local/bin/influx write -f $GITHUB_WORKSPACE/noaa-ndbc-data/latest-observations.lp -b dummy
/usr/local/bin/influx query "from(bucket: \"dummy\") |> range(start: -1y) |> drop(columns: [\"_start\",\"_stop\"])" --raw > $GITHUB_WORKSPACE/noaa-ndbc-data/latest-observations-annotated.csv
/usr/local/bin/influx bucket delete -n dummy
- name: Generate USGS CSV
run: |
/usr/local/bin/influx bucket create -n dummy
/usr/local/bin/influx write -f $GITHUB_WORKSPACE/usgs-earthquake-data/all_week.lp -b dummy
/usr/local/bin/influx query "from(bucket: \"dummy\") |> range(start: -1y) |> drop(columns: [\"_start\",\"_stop\"])" --raw > $GITHUB_WORKSPACE/usgs-earthquake-data/all_week-annotated.csv
/usr/local/bin/influx bucket delete -n dummy
- name: Generate Bitcoin CSV
run: |
/usr/local/bin/influx bucket create -n dummy
/usr/local/bin/influx write -f ./bitcoin-price-data/currentprice.lp -b dummy
/usr/local/bin/influx query "from(bucket: \"dummy\") |> range(start: -1y) |> drop(columns: [\"_start\",\"_stop\"])" --raw > ./bitcoin-price-data/bitcoin-currentprice-annotated.csv
/usr/local/bin/influx bucket delete -n dummy
/usr/local/bin/influx bucket create -n dummy
/usr/local/bin/influx write -f ./bitcoin-price-data/currentprice.lp -b dummy
/usr/local/bin/influx write -f ./bitcoin-price-data/bitcoin-historical-annotated.csv --format csv -b dummy
/usr/local/bin/influx query "from(bucket: \"dummy\") |> range(start: -30d) |> drop(columns: [\"_start\",\"_stop\"])" --raw > ./bitcoin-price-data/bitcoin-historical-annotated.csv
/usr/local/bin/influx bucket delete -n dummy
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Adding LP and annotated CSV file
sync-to-s3:
runs-on: ubuntu-latest
needs: process-data
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Copy Air Sensor Data to S3
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.S3_TOKEN }}
aws_secret_access_key: ${{ secrets.S3_KEY }}
aws_region: ${{ secrets.S3_REGION }}
source: './air-sensor-data/air-sensor-data-annotated.csv'
dest: 's3://${{ secrets.S3_BUCKET }}/air-sensor-data-annotated.csv'
flags: --acl public-read --follow-symlinks
- name: Copy NOAA Data to S3
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.S3_TOKEN }}
aws_secret_access_key: ${{ secrets.S3_KEY }}
aws_region: ${{ secrets.S3_REGION }}
source: './noaa-ndbc-data/latest-observations-annotated.csv'
dest: 's3://${{ secrets.S3_BUCKET }}/noaa-ndbc-latest-observations-annotated.csv'
flags: --acl public-read --follow-symlinks
- name: Copy USGS Data to S3
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.S3_TOKEN }}
aws_secret_access_key: ${{ secrets.S3_KEY }}
aws_region: ${{ secrets.S3_REGION }}
source: './usgs-earthquake-data/all_week-annotated.csv'
dest: 's3://${{ secrets.S3_BUCKET }}/usgs-earthquake-all-week-annotated.csv'
flags: --acl public-read --follow-symlinks
- name: Copy Bitcoin Data to S3
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.S3_TOKEN }}
aws_secret_access_key: ${{ secrets.S3_KEY }}
aws_region: ${{ secrets.S3_REGION }}
source: './bitcoin-price-data/bitcoin-historical-annotated.csv'
dest: 's3://${{ secrets.S3_BUCKET }}/bitcoin-historical-annotated.csv'
flags: --acl public-read --follow-symlinks