-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (94 loc) · 3.48 KB
/
data-pipeline.yaml
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
name: Peskas Malawi Data Pipeline
on:
push:
schedule:
- cron: '0 0 */2 * *'
env:
MALAWI_SSF: ${{ secrets.MALAWI_SSF }}
FISHERIES_ECAS: ${{ secrets.FISHERIES_ECAS }}
FIELDDATAAPP_2024: ${{ secrets.FIELDDATAAPP_2024 }}
FIELDDATAAPP_2024A: ${{ secrets.FIELDDATAAPP_2024A }}
FIELDDATAAPP_2023F: ${{ secrets.FIELDDATAAPP_2023F }}
KOBO_USERNAME: ${{ secrets.KOBO_USERNAME }}
KOBO_PASSWORD: ${{ secrets.KOBO_PASSWORD }}
PDS_TOKEN: ${{ secrets.PDS_TOKEN }}
PDS_SECRET: ${{ secrets.PDS_SECRET }}
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
GOOGLE_SHEET_ID: ${{ secrets.GOOGLE_SHEET_ID }}
jobs:
build-container:
name: Build R container
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build image with cache
id: build-docker
uses: whoan/docker-build-with-cache-action@v5
with:
username: $GITHUB_ACTOR
password: "${{ secrets.GITHUB_TOKEN }}"
registry: docker.pkg.github.com
image_name: r-runner-peskas-malawi
dockerfile: Dockerfile.prod
ingest-landings:
name: Ingest Malawi SSF landings
needs: build-container
runs-on: ubuntu-latest
container:
image: docker.pkg.github.com/worldfishcenter/peskas.malawi.data.pipeline/r-runner-peskas-malawi
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set env to production
if: endsWith(github.ref, '/main')
run: echo "R_CONFIG_ACTIVE=production" >> $GITHUB_ENV
- name: Call ingest_landings()
run: Rscript -e 'peskas.malawi.data.pipeline::ingest_landings()'
preprocess-landings:
name: Preprocess Malawi SSF landings
needs: ingest-landings
runs-on: ubuntu-latest
container:
image: docker.pkg.github.com/worldfishcenter/peskas.malawi.data.pipeline/r-runner-peskas-malawi
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set env to production
if: endsWith(github.ref, '/main')
run: echo "R_CONFIG_ACTIVE=production" >> $GITHUB_ENV
- name: Call preprocess_landings()
run: Rscript -e 'peskas.malawi.data.pipeline::preprocess_landings()'
validate-landings:
name: Validate Malawi SSF landings
needs: preprocess-landings
runs-on: ubuntu-latest
container:
image: docker.pkg.github.com/worldfishcenter/peskas.malawi.data.pipeline/r-runner-peskas-malawi
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set env to production
if: endsWith(github.ref, '/main')
run: echo "R_CONFIG_ACTIVE=production" >> $GITHUB_ENV
- name: Validate landings
run: Rscript -e 'peskas.malawi.data.pipeline::validate_landings()'
export-landings:
name: Export Malawi SSF landings
needs: preprocess-landings
runs-on: ubuntu-latest
container:
image: docker.pkg.github.com/worldfishcenter/peskas.malawi.data.pipeline/r-runner-peskas-malawi
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set env to production
if: endsWith(github.ref, '/main')
run: echo "R_CONFIG_ACTIVE=production" >> $GITHUB_ENV
- name: Export landings
run: Rscript -e 'peskas.malawi.data.pipeline::export_landings()'