Merge branch 'main' into patch-1

This commit is contained in:
Max Ammann 2022-04-20 15:33:17 +02:00 committed by GitHub
commit 69f086147a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 266 additions and 189 deletions

26
.github/actions/android/action.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: android
description: Build for android
runs:
using: "composite"
steps:
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install just
shell: bash
run: cargo install just
- name: Build
shell: bash
run: just build-apk
- uses: actions/upload-artifact@v2
with:
name: maplibre-rs.apk
path: target/debug/apk/maplibre-rs-demo.apk

21
.github/actions/check/action.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: check
description: Check
runs:
using: "composite"
steps:
- name: Setup
shell: bash
run: |
rustup component add rustfmt
- name: Format
shell: bash
run: cargo fmt --all -- --check
- name: Install Dependencies
shell: bash
run: sudo apt-get install -y libwayland-dev libxkbcommon-dev # Required for winit
- name: Clippy
shell: bash
run: |
rustup component add clippy
cargo clippy --all-targets --all-features

26
.github/actions/deploy/action.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: deploy
description: Deploy on maxammann.org
inputs:
source:
required: true
description: TODO
destination:
required: true
description: TODO
key:
required: true
description: TODO
runs:
using: "composite"
steps:
- name: Deploy to maxammann.org
env:
SSH_KEY: ${{ inputs.key }}
shell: bash
run: |
echo "$SSH_KEY" > id_rsa
chmod 600 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa max@maxammann.org 'mkdir -p ~/public_html/maplibre-rs/${{ inputs.destination }} && find ~/public_html/maplibre-rs/${{ inputs.destination }} -type f -not -name ".htaccess" -delete'
rsync -e "ssh -o StrictHostKeyChecking=no -i id_rsa" -r "${{ inputs.source }}" max@maxammann.org:~/public_html/maplibre-rs/${{ inputs.destination }}/

26
.github/actions/desktop/action.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: desktop
description: Build for desktop
runs:
using: "composite"
steps:
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Dependencies
shell: bash
run: sudo apt-get install -y libwayland-dev libxkbcommon-dev # Required for winit
- name: Build
shell: bash
run: cargo build --example desktop
- uses: actions/upload-artifact@v2
with:
name: maplibre-rs
path: target/debug/maplibre

30
.github/actions/docs/action.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: docs
description: Build documentation
runs:
using: "composite"
steps:
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install mdbook
shell: bash
run: |
cargo install mdbook --no-default-features --vers "^0.4.0"
- name: Install Dependencies
shell: bash
run: sudo apt-get install -y libwayland-dev libxkbcommon-dev # Required for winit
- name: Build
working-directory: docs
shell: bash
run: mdbook build
- name: API Documentation
shell: bash
run: cargo doc --no-deps --workspace --lib --all-features --document-private-items

22
.github/actions/webgl/action.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: webgl
description: Build for webgl
runs:
using: "composite"
steps:
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install just
shell: bash
run: cargo install just
- name: Build
shell: bash
run: just webpack-webgl-production

22
.github/actions/webgpu/action.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: webgpu
description: Build for webgpu
runs:
using: "composite"
steps:
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install just
shell: bash
run: cargo install just
- name: Build
shell: bash
run: just webpack-production

58
.github/workflows/on_main_push.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: Build & Deploy
on:
workflow_dispatch:
push:
branches:
- main
jobs:
run-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/check
build-desktop:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/desktop
build-android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/android
build-deploy-web:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/webgpu
- uses: ./.github/actions/deploy
with:
source: web/dist/demo/.
destination: webgpu
key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
- uses: ./.github/actions/webgl
- uses: ./.github/actions/deploy
with:
source: web/dist/demo/.
destination: webgl
key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
build-deploy-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/docs
- uses: ./.github/actions/deploy
with:
source: target/x86_64-unknown-linux-gnu/doc/.
destination: api-docs
key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
- uses: ./.github/actions/deploy
with:
source: docs/book/.
destination: docs
key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}

35
.github/workflows/on_pull_request.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Pull Request
on:
workflow_dispatch:
pull_request:
branches:
- main
jobs:
run-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/check
build-desktop:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/desktop
build-android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/android
build-web:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/webgpu
- uses: ./.github/actions/webgl
build-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/docs

View File

@ -1,189 +0,0 @@
name: Rust
on: [ workflow_dispatch, push, pull_request ]
jobs:
check-format:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Setup
run: |
rustup component add rustfmt
- name: Format
run: cargo fmt --all -- --check
build-x86:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Dependencies
run: sudo apt-get install -y libwayland-dev libxkbcommon-dev # Required for winit
- name: Build
run: cargo build --example desktop
- name: Clippy
run: |
rustup component add clippy
cargo clippy --all-targets --all-features
- name: API Documentation
run: cargo doc --no-deps --workspace --lib --all-features --document-private-items
- name: Deploy API Documentation
env:
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
run: |
echo "$SSH_KEY" > id_rsa
chmod 600 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa max@maxammann.org 'mkdir -p ~/public_html/maplibre-rs/api-docs && find ~/public_html/maplibre-rs/api-docs -type f -not -name ".htaccess" -delete'
rsync -e "ssh -o StrictHostKeyChecking=no -i id_rsa" -r "target/x86_64-unknown-linux-gnu/doc/." max@maxammann.org:~/public_html/maplibre-rs/api-docs/
- uses: actions/upload-artifact@v2
with:
name: maplibre-rs
path: target/debug/maplibre
build-aarch64-android:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install just
run: cargo install just
- name: Build
run: just build-apk
- uses: actions/upload-artifact@v2
with:
name: maplibre-rs.apk
path: target/debug/apk/maplibre-rs-demo.apk
build-wasm-webgl:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: web
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install just
run: cargo install just
- name: Build
run: just webpack-webgl-production
- name: Deploy to maxammann.org
env:
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
run: |
echo "$SSH_KEY" > id_rsa
chmod 600 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa max@maxammann.org 'mkdir -p ~/public_html/maplibre-rs/webgl && find ~/public_html/maplibre-rs/webgl -type f -not -name ".htaccess" -delete'
rsync -e "ssh -o StrictHostKeyChecking=no -i id_rsa" -r "dist/demo/." max@maxammann.org:~/public_html/maplibre-rs/webgl/
build-wasm-webgpu:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: web
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install just
run: cargo install just
- name: Build
run: just webpack-production
- name: Deploy to maxammann.org
env:
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
run: |
echo "$SSH_KEY" > id_rsa
chmod 600 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa max@maxammann.org 'mkdir -p ~/public_html/maplibre-rs/webgpu && find ~/public_html/maplibre-rs/webgpu -type f -not -name ".htaccess" -delete'
rsync -e "ssh -o StrictHostKeyChecking=no -i id_rsa" -r "dist/demo/." max@maxammann.org:~/public_html/maplibre-rs/webgpu/
book:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: docs
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/.crates*
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install mdbook
run: |
cargo install mdbook --no-default-features --vers "^0.4.0"
- name: Build
run: mdbook build
- name: Deploy to maxammann.org
env:
SSH_KEY: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
run: |
echo "$SSH_KEY" > id_rsa
chmod 600 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa max@maxammann.org 'mkdir -p ~/public_html/maplibre-rs/docs && find ~/public_html/maplibre-rs/docs -type f -not -name ".htaccess" -delete'
rsync -e "ssh -o StrictHostKeyChecking=no -i id_rsa" -r "book/." max@maxammann.org:~/public_html/maplibre-rs/docs/