Skip to content

Render the Solar System #257

Render the Solar System

Render the Solar System #257

Workflow file for this run

name: Render the Solar System
on:
# Runs every day at 04:00
schedule:
- cron: "0 4 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to run this workflow manually from another workflow
workflow_call:
inputs:
test:
default: false
required: false
type: boolean
download_from_artifact:
default: false
required: false
type: boolean
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: ${{ inputs.test == false && 'pages' || 'test'}}
cancel-in-progress: true
jobs:
build_and_render:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Cache
uses: actions/cache@v4
with:
path: ./renderer
key: renderer-${{ hashFiles('./renderer/app/*') }}
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.19.x"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libboost-all-dev libcurl4-openssl-dev
- name: Build Renderer
working-directory: ./renderer
run: |
mkdir -p build
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
- name: Restore orbits cache
uses: actions/cache/restore@v4
if: ${{ inputs.test == false }}
with:
path: ./data
key: data-${{ hashFiles('./collector/*.py') }}
restore-keys: data-${{ hashFiles('./collector/*.py') }}
- name: Download artifact
uses: actions/download-artifact@v4
if: ${{ inputs.download_from_artifact == true }}
with:
name: orbits-latest
path: ./data
- name: Generate the solar system image
working-directory: ./renderer/build/app
env:
SP_CACHE_PATH: ../../../data
OUTPUT_SUFFIX: -latest
run: ./solarpaper
- name: Rename output file
if: ${{ inputs.test == false }}
run: mv ./data/output-latest.png ./data/solarpaper.png
- name: Upload artifact
uses: actions/upload-artifact@v4
if: ${{ inputs.test == false }}
with:
name: solarpaper-latest
path: ./data/solarpaper.png
retention-days: 1
upload:
runs-on: ubuntu-latest
needs: build_and_render
if: ${{ inputs.test == false }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Restore Cache
uses: actions/cache/restore@v4
with:
path: ./data
key: data-${{ hashFiles('./collector/*.py') }}
restore-keys: data-${{ hashFiles('./collector/*.py') }}
- name: Get a random number
run: echo "RANDOM_SUFFIX=${RANDOM}${RANDOM}" >> $GITHUB_ENV
- name: Setup Cache
uses: actions/cache@v4
with:
path: ./data
key: data-${{ hashFiles('./collector/*.py') }}-${{ env.RANDOM_SUFFIX }}
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: solarpaper-latest
path: ./data/latest
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./data
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4