Skip to content

Commit

Permalink
Refactor GitHub Actions workflow to update node version file path
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Oct 16, 2024
1 parent f17235e commit 4b1e6f3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 75 deletions.
78 changes: 5 additions & 73 deletions .github/workflows/webapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,87 +18,19 @@ concurrency:
cancel-in-progress: true

jobs:
prep:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Install
run: yarn install

lint:
needs: prep
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Install
run: yarn install
working-directory: ./webapp

- name: Lint
run: yarn lint
working-directory: ./webapp

# Docker container build
build:
needs: prep
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'

- name: Cache node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Install
run: yarn install
working-directory: ./webapp
- name: Checkout
uses: actions/checkout@v2

- name: Build container
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
file: dockerfiles/Dockerfile
push: false
context: ./webapp/
file: ./webapp/Dockerfile
push: true
tags: "polder:dev"
10 changes: 10 additions & 0 deletions ETL/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"source": "CDSE_S5p",
"indicator": "L2_NO2",
"start_date": "2019-01-01",
"end_date": "2024-10-16",
"output_path": "data/S5pL2NO2/",
"tile_resolution": "512",
"grid_division": "10",
"time_step": "1D"
}
20 changes: 18 additions & 2 deletions ETL/curl-get-data.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
curl 'https://sh.dataspace.copernicus.eu/api/v1/process' \
-H 'accept: */*' \
-H 'accept-language: en-US,en;q=0.9,fr;q=0.8,it;q=0.7' \
-H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJYVUh3VWZKaHVDVWo0X3k4ZF8xM0hxWXBYMFdwdDd2anhob2FPLUxzREZFIn0.eyJleHAiOjE3MjkwNjY1NDYsImlhdCI6MTcyOTA2NTY0NiwiYXV0aF90aW1lIjoxNzI5MDY1NjQ2LCJqdGkiOiIwNjYxYjcxZC0xMGY4LTRmNDItYThlYi05ZWM0NjkzZjFmYWYiLCJpc3MiOiJodHRwczovL2lkZW50aXR5LmRhdGFzcGFjZS5jb3Blcm5pY3VzLmV1L2F1dGgvcmVhbG1zL0NEU0UiLCJhdWQiOlsiQ0xPVURGRVJST19QVUJMSUMiLCJhY2NvdW50Il0sInN1YiI6IjZlMDFiZjBiLTQ1ZGEtNDQ5MS05OTFmLWNmZDU3YmRiNGM3ZSIsInR5cCI6IkJlYXJlciIsImF6cCI6InNoLTVmOGI2MzBiLWIwODMtNDllZC1iMzQwLWI4ZjAxZWNiODFjNCIsIm5vbmNlIjoiNDIwODY3OTE4OTk1MDYyNCIsInNlc3Npb25fc3RhdGUiOiI4ODk0YjA0Mi1kNjc0LTQ5YzUtYmQ4OC03NDIzOTQ1YTUyMGYiLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsib2ZmbGluZV9hY2Nlc3MiLCJ1bWFfYXV0aG9yaXphdGlvbiIsImRlZmF1bHQtcm9sZXMtY2RhcyIsImNv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5MWYtY2ZkNTdiZGI0YzdlIiwiZmFtaWx5X25hbWUiOiJDREFCIiwiZW1haWwiOiJlb2QuZXhwQGdtYWlsLmNvbSJ9.GADguHmTiBY0kIEuipGH4AFHWroJim_QSUJw_Oj8SBRlUhaivGHwEHoXn0ks6iM80K_J2UXEvW-VH-XuB-Qxrd8RtZSLMzRHaAuwLeMyPrxivHl3RNE4fMbyQkVAvHMeA0p5U333ozETcZCodON2YjsAL6nz5n3fMRa41wBs3Lst9MywFm4qIHexL7MlEfiv8S45Cw7Hwz_wqG6C7RH00W21DHahIgk23xXjr_CEZtS794DnRqzFo56qB2gG6I8j1C97OmfchjmWVNwY4jxkaRbsWTtVznlicZ8O79mUjWkIbSN7Ye1YP1Q_bwHFJHnVLeNtvVFbuQqeO5XJBZJhxA' \
-H 'content-type: application/json' \
-H 'origin: https://browser.dataspace.copernicus.eu' \
-H 'priority: u=1, i' \
Expand All @@ -13,4 +12,21 @@ curl 'https://sh.dataspace.copernicus.eu/api/v1/process' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-site' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' \
--data-raw '{"input":{"bounds":{"properties":{"crs":"http://www.opengis.net/def/crs/EPSG/0/3857"},"bbox":[0,5009377.085697314,5009377.085697311,10018754.171394628]},"data":[{"dataFilter":{"timeRange":{"from":"2024-10-13T00:00:00.000Z","to":"2024-10-13T23:59:59.999Z"},"mosaickingOrder":"mostRecent","previewMode":"EXTENDED_PREVIEW","maxCloudCoverage":100},"processing":{"upsampling":"NEAREST","downsampling":"NEAREST"},"type":"S5PL2"}]},"output":{"width":512,"height":512,"responses":[{"identifier":"default","format":{"type":"image/tiff"}}]},"evalscript":"//VERSION=3\nvar minVal = 0.0;\nvar maxVal = 0.0001;\nvar diff = maxVal - minVal;\nconst map = [\n\t[minVal, 0x00007f], \n\t[minVal + 0.125 * diff, 0x0000ff],\n\t[minVal + 0.375 * diff, 0x00ffff],\n\t[minVal + 0.625 * diff, 0xffff00],\n\t[minVal + 0.875 * diff, 0xff0000],\n\t[maxVal, 0x7f0000]\n]; \n\nconst visualizer = new ColorRampVisualizer(map)\nfunction setup() {\n return {\n input: [\"NO2\",\"dataMask\"],\n\toutput: [\n { id: \"default\", bands: 4 },\n { id: \"eobrowserStats\", bands: 1 },\n { id: \"dataMask\", bands: 1 },\n ],\n };\n}\n\nfunction evaluatePixel(samples) {\n const [r, g, b] = visualizer.process(samples.NO2);\n const statsVal = isFinite(samples.NO2) ? samples.NO2 : NaN;\n return {\n default: [r, g, b, samples.dataMask],\n eobrowserStats: [statsVal],\n dataMask: [samples.dataMask],\n };\n}"}'
--data-raw '{"input":{"bounds":{"properties":{"crs":"http://www.opengis.net/def/crs/EPSG/0/3857"},"bbox":[0,5009377.085697314,5009377.085697311,10018754.171394628]},"data":[{"dataFilter":{"timeRange":{"from":"2024-10-13T00:00:00.000Z","to":"2024-10-13T23:59:59.999Z"},"mosaickingOrder":"mostRecent","previewMode":"EXTENDED_PREVIEW","maxCloudCoverage":100},"processing":{"upsampling":"NEAREST","downsampling":"NEAREST"},"type":"S5PL2"}]},"output":{"width":512,"height":512,"responses":[{"identifier":"default","format":{"type":"image/tiff"}}]},"evalscript":"//VERSION=3\nvar minVal = 0.0;\nvar maxVal = 0.0001;\nvar diff = maxVal - minVal;\nconst map = [\n\t[minVal, 0x00007f], \n\t[minVal + 0.125 * diff, 0x0000ff],\n\t[minVal + 0.375 * diff, 0x00ffff],\n\t[minVal + 0.625 * diff, 0xffff00],\n\t[minVal + 0.875 * diff, 0xff0000],\n\t[maxVal, 0x7f0000]\n]; \n\nconst visualizer = new ColorRampVisualizer(map)\nfunction setup() {\n return {\n input: [\"NO2\",\"dataMask\"],\n\toutput: [\n { id: \"default\", bands: 4 },\n { id: \"eobrowserStats\", bands: 1 },\n { id: \"dataMask\", bands: 1 },\n ],\n };\n}\n\nfunction evaluatePixel(samples) {\n const [r, g, b] = visualizer.process(samples.NO2);\n const statsVal = isFinite(samples.NO2) ? samples.NO2 : NaN;\n return {\n default: [r, g, b, samples.dataMask],\n eobrowserStats: [statsVal],\n dataMask: [samples.dataMask],\n };\n}"}'

curl 'https://sh.dataspace.copernicus.eu/api/v1/process' \
-H 'accept: */*' \
-H 'accept-language: en-US,en;q=0.9,fr;q=0.8,it;q=0.7' \
-H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJYVUh3VWZKaHVDVWo0X3k4ZF8xM0hxWXBYMFdwdDd2anhob2FPLUxzREZFIn0.eyJleHAiOjE3MjkwODc4MzMsImlhdCI6MTcyOTA4NDIzMywianRpIjoiYWVmMzlmNzAtNjAzYS00ZDE2LWIzOTEtMDhhODExZWFiOTkzIiwiaXNzIjoiaHR0cHM6Ly9pZGVudGl0eS5kYXRhc3BhY2UuY29wZXJuaWN1cy5ldS9hdXRoL3JlYWxtcy9DRFNFIiwiYXVkIjoiQ0xPVURGRVJST19QVUJMSUMiLCJzdWIiOiIyMTBiNTYwYy02NzNiLTRmNTUtYmU5OC1hYjk1OTVkYzhjN2MiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJzaC0xOGJhMDM1Ny1hODY2LTRhMmQtODFmMS1iNjA4NGJlNjU4ODIiLCJzY29wZSI6IkFVRElFTkNFX1BVQkxJQyB1c2VyLWNvbnRleHQiLCJjbGllbnRIb3N0IjoiNjQuMjI1LjEyOC4xNCIsImNsaWVudElkIjoic2gtMThiYTAzNTctYTg2Ni00YTJkLTgxZjEtYjYwODRiZTY1ODgyIiwib3JnYW5pemF0aW9ucyI6WyJzaC1icm93c2VyQW5vbnltb3VzIl0sInVzZXJfY29udGV4dF9pZCI6IjYwMzYyYTc2LWQ4NmMtNGRiYy1iZDc3LTY3MmE3MmMzYTIxMyIsImNvbnRleHRfcm9sZXMiOnt9LCJjb250ZXh0X2dyb3VwcyI6WyIvb3JnYW5pemF0aW9ucy9zaC1icm93c2VyQW5vbnltb3VzLyJdLCJ1c2VyX2NvbnRleHQiOiJzaC1icm93c2VyQW5vbnltb3VzIiwiY2xpZW50QWRkcmVzcyI6IjY0LjIyNS4xMjguMTQifQ.g9dSXfqvN93PKDiKKctA2wqvIT1KxTln-hq30wZ_9La2gkACSDXDq_W4R-NReuUKja5RyfDyCfBRpv8GEw-qrmDFO893mKuW6UFP0zyzyc-_7nisFWN0chG-wmxy7mNgLZGpyt4-4Ss647XNERl-viBMnop0jPI8p8MW4FkS9PecooDUEIHoq4NBq6J30N4lcS_ZXQIV8B2HnqO2emIf7fmuAJq5jjd1bMySV_Vfk_QbSV0RTtTqEBWaDKGbWlpukga9ROqeCb99xVX37zFaLRgHJ6ASSIRsqeAxRB-bLQFXFeHhMuYpasg2CO7ZW-7UO01ohCtG2A3XfL4XNeOz_A' \
-H 'content-type: application/json' \
-H 'origin: https://browser.dataspace.copernicus.eu' \
-H 'priority: u=1, i' \
-H 'referer: https://browser.dataspace.copernicus.eu/' \
-H 'sec-ch-ua: "Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-site' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' \
--data-raw '{"input":{"bounds":{"properties":{"crs":"http://www.opengis.net/def/crs/EPSG/0/3857"},"bbox":[0,5009377.085697314,626172.1357121639,5635549.221409476]},"data":[{"dataFilter":{"timeRange":{"from":"2024-10-16T00:00:00.000Z","to":"2024-10-16T23:59:59.999Z"},"mosaickingOrder":"mostRecent","previewMode":"EXTENDED_PREVIEW","maxCloudCoverage":100},"processing":{"upsampling":"NEAREST","downsampling":"NEAREST"},"type":"S5PL2"}]},"output":{"width":2500,"height":2500,"responses":[{"identifier":"default","format":{"type":"image/tiff"}}]},"evalscript":"//VERSION=3\nvar minVal = 0.0;\nvar maxVal = 0.0001;\nvar diff = maxVal - minVal;\nconst map = [\n\t[minVal, 0x00007f], \n\t[minVal + 0.125 * diff, 0x0000ff],\n\t[minVal + 0.375 * diff, 0x00ffff],\n\t[minVal + 0.625 * diff, 0xffff00],\n\t[minVal + 0.875 * diff, 0xff0000],\n\t[maxVal, 0x7f0000]\n]; \n\nconst visualizer = new ColorRampVisualizer(map)\nfunction setup() {\n return {\n input: [\"NO2\",\"dataMask\"],\n\toutput: [\n { id: \"default\", bands: 4 },\n { id: \"eobrowserStats\", bands: 1 },\n { id: \"dataMask\", bands: 1 },\n ],\n };\n}\n\nfunction evaluatePixel(samples) {\n const [r, g, b] = visualizer.process(samples.NO2);\n const statsVal = isFinite(samples.NO2) ? samples.NO2 : NaN;\n return {\n default: [r, g, b, samples.dataMask],\n eobrowserStats: [statsVal],\n dataMask: [samples.dataMask],\n };\n}"}'
7 changes: 7 additions & 0 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:alpine
WORKDIR /app
RUN corepack enable && corepack prepare yarn@stable --activate
COPY package.json /app
RUN yarn install
COPY . /app
CMD ["yarn", "run", "start"]

0 comments on commit 4b1e6f3

Please sign in to comment.