Deduplicate workflow for more demos

This commit is contained in:
Maximilian Ammann 2022-09-17 15:07:51 +02:00
parent 12bb06a86e
commit 4fb78c4b64
4 changed files with 35 additions and 46 deletions

View File

@ -1,5 +1,5 @@
name: deploy
description: Deploy on maxammann.org
description: Deploy on cloudflare
inputs:
project:

View File

@ -11,10 +11,19 @@ on:
deploy:
required: true
type: boolean
name:
required: true
type: string
webgl:
required: true
type: boolean
multithreading:
required: true
type: boolean
jobs:
library-webgl:
name: Build WebGL
build:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
@ -25,13 +34,13 @@ jobs:
- uses: Swatinem/rust-cache@v1
- name: Build lib
shell: bash
run: just web-lib build-webgl --release
run: just web-lib build --release ${{ inputs.webgl && '--webgl' || '' }} ${{ inputs.multithreading && '--multithreading' || '' }}
- name: Build demo
shell: bash
run: just web-demo build
- name: Check
shell: bash
run: just web-check "web-webgl"
run: just web-check ${{ inputs.webgl && 'web-webgl' || '' }}
- name: Test
shell: bash
run: |
@ -40,41 +49,11 @@ jobs:
just web-test "web-webgl"
- uses: actions/upload-artifact@v2
with:
name: webgl-demo
path: web/demo/dist/
library-webgpu:
name: Build WebGPU
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: extractions/setup-just@v1
- name: Install nightly toolchain
shell: bash
run: just nightly-toolchain
- uses: Swatinem/rust-cache@v1
- name: Build lib
shell: bash
run: just web-lib build --release
- name: Build demo
shell: bash
run: just web-demo build
- name: Check
shell: bash
run: just web-check ""
- name: Test
shell: bash
run: |
# Install test runner
cargo install wasm-bindgen-cli # We want the latest version, as Cargo uses the latest version of wasm-bindgen
just web-test ""
- uses: actions/upload-artifact@v2
with:
name: webgpu-demo
name: ${{ inputs.name }}
path: web/demo/dist/
deploy:
needs: [library-webgl, library-webgpu]
needs: [build]
if: inputs.deploy
name: Deploy
runs-on: ubuntu-20.04
@ -82,13 +61,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: webgl-demo
path: demo/webgl
- uses: actions/download-artifact@v2
with:
name: webgpu-demo
path: demo/webgpu
name: ${{ inputs.name }}
path: demo
- name: Set HTTP Headers for Cloudflare
if: inputs.multithreading
shell: bash
run: |
echo "/*
@ -97,7 +73,7 @@ jobs:
- name: Deploy
uses: ./.github/actions/cloudflare-deploy
with:
project: maplibre-rs-demos
project: ${{ inputs.name }}
source: demo
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}

View File

@ -27,6 +27,9 @@ jobs:
library-web:
uses: ./.github/workflows/library-web.yml
with:
name: maplibre-rs-demo-webgl
webgl: true
multithreading: false
deploy: true
secrets: inherit
library-apple:

View File

@ -19,10 +19,20 @@ jobs:
deploy: false
library-android:
uses: ./.github/workflows/library-android.yml
library-web:
library-web-webgl:
uses: ./.github/workflows/library-web.yml
with:
deploy: false
name: maplibre-rs-demo-webgl
webgl: true
multithreading: false
deploy: true
library-web-webgpu:
uses: ./.github/workflows/library-web.yml
with:
name: maplibre-rs-demo-webgpu
webgl: false
multithreading: false
deploy: true
library-apple:
uses: ./.github/workflows/library-apple.yml
demo-linux: