mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
94 lines
2.6 KiB
YAML
94 lines
2.6 KiB
YAML
name: Build library for Web
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
CF_API_TOKEN:
|
|
required: false
|
|
CF_ACCOUNT_ID:
|
|
required: false
|
|
inputs:
|
|
deploy:
|
|
required: true
|
|
type: boolean
|
|
name:
|
|
required: true
|
|
type: string
|
|
webgl:
|
|
required: true
|
|
type: boolean
|
|
multithreaded:
|
|
required: true
|
|
type: boolean
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Setup binstall
|
|
uses: ./.github/actions/setup-binstall
|
|
- name: Install just
|
|
uses: ./.github/actions/cargo-install
|
|
with:
|
|
name: just
|
|
- name: Install nightly toolchain
|
|
shell: bash
|
|
run: |
|
|
just nightly-toolchain
|
|
just nightly-targets wasm32-unknown-unknown
|
|
- name: Install rust sources (build-std)
|
|
if: inputs.multithreaded
|
|
shell: bash
|
|
run: |
|
|
just nightly-install-src
|
|
- name: Install wasm-bindgen
|
|
shell: bash
|
|
run: |
|
|
# Install wasm-bindgen with test runner
|
|
cargo binstall wasm-bindgen-cli # We want the latest version, as Cargo uses the latest version of wasm-bindgen
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Build lib
|
|
shell: bash
|
|
run: just web-lib build --release ${{ inputs.webgl && '--webgl' || '' }} ${{ inputs.multithreaded && '--multithreaded' || '' }}
|
|
- name: Build demo
|
|
shell: bash
|
|
run: just web-demo build
|
|
- name: Check
|
|
shell: bash
|
|
run: just nightly-check web wasm32-unknown-unknown ${{ inputs.webgl && 'web-webgl' || '""' }}
|
|
- name: Test
|
|
shell: bash
|
|
run: just web-test "web-webgl"
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
path: web/demo/dist/
|
|
|
|
deploy:
|
|
needs: [build]
|
|
if: inputs.deploy
|
|
name: Deploy
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
path: demo
|
|
- name: Set HTTP Headers for Cloudflare
|
|
if: inputs.multithreaded
|
|
shell: bash
|
|
run: |
|
|
echo "/*
|
|
Cross-Origin-Opener-Policy: same-origin
|
|
Cross-Origin-Embedder-Policy: require-corp" > demo/_headers
|
|
- name: Deploy
|
|
uses: ./.github/actions/cloudflare-deploy
|
|
with:
|
|
project: ${{ inputs.name }}
|
|
source: demo
|
|
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
|
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|