Merge pull request #428 from SchmidtDSE/main #1514
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push] | |
permissions: | |
actions: read | |
contents: read | |
jobs: | |
checkArtifact: | |
environment: build | |
runs-on: ubuntu-latest | |
name: Check Pipeline | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifact | |
run: bash support/get_pipeline_output.sh | |
- name: Move data | |
run: bash support/prepare_data.sh | |
checkScripts: | |
environment: build | |
runs-on: ubuntu-latest | |
name: Check Policy Scripts | |
needs: [checkArtifact] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
- name: Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install node deps | |
run: bash ./support/npm_install.sh | |
- name: Install python deps | |
run: pip install -r requirements.txt | |
- name: Run lint | |
run: npx eslint ./js_standalone/engine/*.js | |
- name: Render index | |
run: bash support/render_index.sh | |
- name: Download artifact | |
run: bash support/get_pipeline_output.sh | |
- name: Move data | |
run: bash support/prepare_data.sh | |
- name: Build | |
run: bash ./support/make.sh | |
- name: Install JS deps | |
run: cd js_standalone; npm install | |
- name: Update scenarios | |
run: bash support/update_scenarios_default.sh | |
- name: Execute example | |
run: bash support/execute_standalone_example.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: standalone-example | |
path: js_standalone/test_output.json | |
if-no-files-found: error | |
test: | |
environment: build | |
runs-on: ubuntu-latest | |
name: Test App | |
needs: [checkScripts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Install node deps | |
run: bash ./support/npm_install.sh | |
- name: Install python deps | |
run: pip install -r requirements.txt | |
- name: Run lint | |
run: npx eslint ./js/*.js | |
- name: Run lint template | |
run: npx eslint ./js/compile_visitor.js_template | |
- name: Render index | |
run: bash support/render_index.sh | |
- name: Check configuration | |
run: python test/test_config.py pt/index.json pt/scenarios.json | |
- name: Render templates | |
run: bash support/render_template.sh | |
- name: Download artifact | |
run: bash support/get_pipeline_output.sh | |
- name: Move data | |
run: bash support/prepare_data.sh | |
- name: Build | |
run: bash ./support/make.sh | |
- name: Install JS deps | |
run: bash ./support/load_deps.sh | |
- name: Update scenarios | |
run: bash support/update_scenarios_default.sh | |
- name: Install browser | |
run: sudo bash ./support/install_browser.sh | |
- name: Run unit tests | |
run: grunt | |
runStandalone: | |
environment: build | |
runs-on: ubuntu-latest | |
name: Run Standalone | |
needs: [checkScripts] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
- name: Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install node deps | |
run: bash ./support/npm_install.sh | |
- name: Install python deps | |
run: pip install -r requirements.txt | |
- name: Run lint | |
run: npx eslint ./js_standalone/engine/*.js | |
- name: Render index | |
run: bash support/render_index.sh | |
- name: Download artifact | |
run: bash support/get_pipeline_output.sh | |
- name: Move data | |
run: bash support/prepare_data.sh | |
- name: Build | |
run: bash ./support/make.sh | |
- name: Install JS deps | |
run: cd js_standalone; npm install | |
- name: Update scenarios | |
run: bash support/update_scenarios_default.sh | |
- name: Execute all | |
run: bash support/run_scenarios_standalone.sh | |
- name: Zip standalone results | |
run: zip -r standalone_tasks.zip standalone_tasks | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: standalone-all | |
path: standalone_tasks.zip | |
if-no-files-found: error | |
buildFigures: | |
environment: build | |
runs-on: ubuntu-latest | |
name: Build Figures | |
needs: [runStandalone] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Download images | |
uses: actions/download-artifact@v4 | |
with: | |
name: standalone-all | |
- name: Unzip standalone | |
run: unzip standalone_tasks.zip | |
- name: Install node deps | |
run: bash ./support/npm_install.sh | |
- name: Install Python deps | |
run: pip install -r requirements.txt | |
- name: Install Processing | |
run: bash support/install_processing.sh | |
- name: Render index | |
run: bash support/render_index.sh | |
- name: Download artifact | |
run: bash support/get_pipeline_output.sh | |
- name: Ensure data folder | |
run: mkdir data | |
- name: Move database | |
run: mv pipeline/combined.db data/combined.db | |
- name: Move overview | |
run: mv pipeline/overview_ml.csv data/overview_ml.csv | |
- name: Load fonts | |
run: bash support/load_fonts.sh | |
- name: Render lines | |
run: bash support/render_line_graphs.sh | |
- name: Render butterfly | |
run: bash support/render_butterfly.sh | |
- name: Render sankey | |
run: bash support/render_sankey.sh | |
- name: Check outputs | |
run: bash support/check_image_outputs.sh | |
- name: Snapshot images | |
run: zip -r img.zip img | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: img-snapshot | |
path: img.zip | |
if-no-files-found: error | |
buildDeployment: | |
name: Build Deployment | |
environment: build | |
runs-on: ubuntu-latest | |
needs: [test, runStandalone, buildFigures] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Install node deps | |
run: bash ./support/npm_install.sh | |
- name: Install python deps | |
run: pip install -r requirements.txt | |
- name: Render index | |
run: bash support/render_index.sh | |
- name: Download artifact | |
run: bash support/get_pipeline_output.sh | |
- name: Download images | |
uses: actions/download-artifact@v4 | |
with: | |
name: img-snapshot | |
- name: Unzip images | |
run: bash support/unzip_images.sh | |
- name: Check images | |
run: bash support/check_image_outputs.sh | |
- name: Download standalone | |
uses: actions/download-artifact@v4 | |
with: | |
name: standalone-all | |
- name: Unzip standalone results | |
run: bash support/unzip_standalone.sh | |
- name: Check standalone results | |
run: bash support/check_standalone.sh | |
- name: Move data | |
run: bash support/prepare_data.sh | |
- name: Build | |
run: bash ./support/make.sh | |
- name: Render templates | |
run: bash support/render_template.sh | |
- name: Install JS deps | |
run: bash ./support/load_deps.sh | |
- name: Update scenarios | |
run: bash support/update_scenarios_default.sh | |
- name: Package website | |
run: bash ./support/package.sh | |
- name: Build zip | |
run: zip -r deploy.zip deploy | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: deploy | |
path: ./deploy.zip | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: index | |
path: ./deploy/index.html | |
validateDeployment: | |
name: Validate Deployment | |
environment: build | |
runs-on: ubuntu-latest | |
needs: [buildDeployment] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: deploy | |
- name: Unzip | |
run: unzip deploy.zip | |
- name: Check deployment | |
run: bash ./support/check_deployment.sh | |
validateStandardizedOutputs: | |
name: Validate Standardized Outputs | |
environment: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Install wget | |
run: sudo apt-get install -y wget | |
- name: Make scratch dir | |
run: mkdir csv_validation | |
- name: Get validator | |
run: cd csv_validation; wget /~https://github.com/digital-preservation/csv-validator/releases/download/1.3.0/csv-validator-distribution-1.3.0-bin.zip | |
- name: Setup validator | |
run: cd csv_validation; unzip csv-validator-distribution-1.3.0-bin.zip | |
- name: Get outputs | |
run: cd csv_validation; wget https://global-plastics-tool.org/data/standardized.zip | |
- name: Unpack outputs | |
run: cd csv_validation; unzip standardized.zip | |
- name: Check internal point summary | |
run: cd csv_validation; ./csv-validator-cmd ./01_output_summary/02_overview.csv ../spec/overview.csvs | |
- name: Check external point summary | |
run: cd csv_validation; ./csv-validator-cmd ./01_output_summary/02_overview.csv ./01_output_summary/02_overview.csvs | |
- name: Check internal monte carlo summary | |
run: cd csv_validation; ./csv-validator-cmd ./01_output_summary/03_montecarlo_summary.csv ../spec/montecarlo_summary.csvs | |
- name: Check external monte carlo summary | |
run: cd csv_validation; ./csv-validator-cmd ./01_output_summary/03_montecarlo_summary.csv ./01_output_summary/03_montecarlo_summary.csvs | |
- name: Check internal monte carlo bau | |
run: cd csv_validation; ./csv-validator-cmd ./01_output_summary/04_montecarlo_bau.csv ../spec/montecarlo_bau.csvs | |
- name: Check external monte carlo bau | |
run: cd csv_validation; ./csv-validator-cmd ./01_output_summary/04_montecarlo_bau.csv ./01_output_summary/04_montecarlo_bau.csvs | |
deploy: | |
name: Deploy Web | |
environment: deploy | |
runs-on: ubuntu-latest | |
needs: [validateDeployment, validateStandardizedOutputs] | |
if: github.ref == 'refs/heads/deploy' | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: deploy | |
- name: Unzip | |
run: unzip deploy.zip | |
- name: Upload | |
uses: Creepios/sftp-action@v1.0.3 | |
with: | |
host: ${{ secrets.SFTPHOST }} | |
port: 22 | |
username: ${{ secrets.SFTPUSER }} | |
password: ${{ secrets.SFTPPASSWORD }} | |
localPath: './deploy' | |
remotePath: './global-plastics-tool.org' |