Split ci into multiple workflows

This commit is contained in:
Maximilian Ammann 2022-04-20 14:27:58 +02:00
parent ee682b89af
commit 3b37875a5b
10 changed files with 271 additions and 189 deletions

32
.github/workflows/android.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: android
on: [ workflow_dispatch ]
jobs:
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

23
.github/workflows/check.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: check
on: [ workflow_dispatch ]
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
- name: Clippy
run: |
rustup component add clippy
cargo clippy --all-targets --all-features

22
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,22 @@
on:
workflow_call:
inputs:
source:
required: true
type: string
destination:
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- 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/${{ 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 }}/

32
.github/workflows/desktop.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: desktop
on: [ workflow_dispatch ]
jobs:
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
- uses: actions/upload-artifact@v2
with:
name: maplibre-rs
path: target/debug/maplibre

32
.github/workflows/docs.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: docs
on: [ workflow_dispatch ]
jobs:
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: API Documentation
run: cargo doc --no-deps --workspace --lib --all-features --document-private-items

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

@ -0,0 +1,45 @@
name: Rust
on: [ workflow_dispatch, push ]
jobs:
run-check:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/check.yml
build-desktop:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/desktop.yml
build-android:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/android.yml
build-web:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/webgpu.yml
- uses: ./.github/workflows/deploy.yml
with:
source: dist/demo/.
destination: webgpu
- uses: ./.github/workflows/webgl.yml
- uses: ./.github/workflows/deploy.yml
with:
source: dist/demo/.
destination: webgl
build-docs:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/docs.yml
- uses: ./.github/workflows/deploy.yml
with:
source: target/x86_64-unknown-linux-gnu/doc/.
destination: api-docs
- uses: ./.github/workflows/deploy.yml
with:
source: book/.
destination: docs

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

@ -0,0 +1,26 @@
name: Pull Request
on: [ workflow_dispatch, pull_request ]
jobs:
run-check:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/check.yml
build-desktop:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/desktop.yml
build-android:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/android.yml
build-web:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/webgpu.yml
- uses: ./.github/workflows/webgl.yml
build-docs:
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/docs.yml

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/

29
.github/workflows/webgl.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: web
on: [ workflow_dispatch ]
jobs:
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

30
.github/workflows/webgpu.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: web
on: [ workflow_dispatch ]
jobs:
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