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 name: deploy
description: Deploy on maxammann.org description: Deploy on cloudflare
inputs: inputs:
project: project:

View File

@ -11,10 +11,19 @@ on:
deploy: deploy:
required: true required: true
type: boolean type: boolean
name:
required: true
type: string
webgl:
required: true
type: boolean
multithreading:
required: true
type: boolean
jobs: jobs:
library-webgl: build:
name: Build WebGL name: Build
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -25,13 +34,13 @@ jobs:
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Build lib - name: Build lib
shell: bash shell: bash
run: just web-lib build-webgl --release run: just web-lib build --release ${{ inputs.webgl && '--webgl' || '' }} ${{ inputs.multithreading && '--multithreading' || '' }}
- name: Build demo - name: Build demo
shell: bash shell: bash
run: just web-demo build run: just web-demo build
- name: Check - name: Check
shell: bash shell: bash
run: just web-check "web-webgl" run: just web-check ${{ inputs.webgl && 'web-webgl' || '' }}
- name: Test - name: Test
shell: bash shell: bash
run: | run: |
@ -40,41 +49,11 @@ jobs:
just web-test "web-webgl" just web-test "web-webgl"
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: webgl-demo name: ${{ inputs.name }}
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
path: web/demo/dist/ path: web/demo/dist/
deploy: deploy:
needs: [library-webgl, library-webgpu] needs: [build]
if: inputs.deploy if: inputs.deploy
name: Deploy name: Deploy
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -82,13 +61,10 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: webgl-demo name: ${{ inputs.name }}
path: demo/webgl path: demo
- uses: actions/download-artifact@v2
with:
name: webgpu-demo
path: demo/webgpu
- name: Set HTTP Headers for Cloudflare - name: Set HTTP Headers for Cloudflare
if: inputs.multithreading
shell: bash shell: bash
run: | run: |
echo "/* echo "/*
@ -97,7 +73,7 @@ jobs:
- name: Deploy - name: Deploy
uses: ./.github/actions/cloudflare-deploy uses: ./.github/actions/cloudflare-deploy
with: with:
project: maplibre-rs-demos project: ${{ inputs.name }}
source: demo source: demo
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}

View File

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

View File

@ -19,10 +19,20 @@ jobs:
deploy: false deploy: false
library-android: library-android:
uses: ./.github/workflows/library-android.yml uses: ./.github/workflows/library-android.yml
library-web: library-web-webgl:
uses: ./.github/workflows/library-web.yml uses: ./.github/workflows/library-web.yml
with: 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: library-apple:
uses: ./.github/workflows/library-apple.yml uses: ./.github/workflows/library-apple.yml
demo-linux: demo-linux: