This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
195 lines (166 loc) · 5.93 KB
/
cd.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: CD
on: workflow_dispatch
# schedule:
# - cron: '0 * * * *'
defaults:
run:
working-directory: .
jobs:
Scrape:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Scrape for new data and append to file
run: |
echo "Dynamically get current datetime - 2 hour and save it in `$since variable"
$since = [DateTime]::Now.AddHours(-2).ToString('yyyy-MM-dd HH:mm:ss')
echo "Scrape since $since and save scraped output to `$output variable"
echo "The output should be appended to the same file"
$output = twint -s \#dhl --since $since --hashtags --stats -l en -o new_data_appended.txt
echo "Printing out the output to console"
$output
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
git add .
git commit -m "CD - Scrape new data $(date)"
git push --set-upstream origin dev
env:
REPO_KEY: ${{secrets.GITHUB_TOKEN}}
username: github-actions
Clean:
needs: Scrape
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
with:
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
service_account_email: ${{ secrets.GCP_COMPUTE_ENGINE_EMAIL }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
export_default_credentials: true
- name: Run clean.py
env:
MLFLOW_TRACKING_URI: ${{ secrets.MLFLOW_TRACKING_URI }}
MLFLOW_TRACKING_USERNAME: ${{ secrets.MLFLOW_TRACKING_USERNAME }}
MLFLOW_TRACKING_PASSWORD: ${{ secrets.MLFLOW_TRACKING_PASSWORD }}
run: |
python pipeline/clean.py
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
git add new_data_cleaned.csv
git commit -m "CD - Clean new data $(date)"
git push --set-upstream origin dev
env:
REPO_KEY: ${{secrets.GITHUB_TOKEN}}
username: github-actions
Append:
needs: Clean
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run append.py
run: |
python pipeline/append.py
- name: Remove fasttext model
uses: JesseTG/rm@v1.0.0
with:
path: ./lid.176.ftz
- name: Remove model.pickle
uses: JesseTG/rm@v1.0.0
with:
path: ./model.pickle
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
git add .
git commit -m "CD - Append new data $(date)"
git push --set-upstream origin dev
env:
REPO_KEY: ${{secrets.GITHUB_TOKEN}}
username: github-actions
Update_data:
needs: Append
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run update.py
env:
GOOGLEDRIVE_ACCESS_TOKEN: ${{ secrets.GOOGLEDRIVE_ACCESS_TOKEN }}
GOOGLEDRIVE_CLIENT_ID: ${{ secrets.GOOGLEDRIVE_CLIENT_ID }}
GOOGLEDRIVE_CLIENT_SECRET: ${{ secrets.GOOGLEDRIVE_CLIENT_SECRET }}
GOOGLEDRIVE_REFRESH_TOKEN: ${{ secrets.GOOGLEDRIVE_REFRESH_TOKEN }}
UPDATE_FILENAME: ${{ 'data.txt' }}
run: |
python pipeline/update.py
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
git add .
git commit -m "CD - Update data on GDrive $(date)"
git push --set-upstream origin dev
env:
REPO_KEY: ${{secrets.GITHUB_TOKEN}}
username: github-actions