Selectively install targets

This commit is contained in:
Maximilian Ammann 2022-09-17 20:58:06 +02:00
parent 3e1c24e533
commit e7dd2a1a6d
12 changed files with 61 additions and 40 deletions

View File

@ -17,7 +17,7 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install toolchain
shell: bash
run: just default-toolchain
run: just stable-toolchain
- uses: Swatinem/rust-cache@v1
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1

View File

@ -12,7 +12,9 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install toolchain
shell: bash
run: just default-toolchain
run: |
just stable-toolchain
just stable-targets x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v1
- name: Install Dependencies
shell: bash

View File

@ -14,7 +14,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install toolchain
shell: bash
run: just default-toolchain
run: |
just stable-toolchain
just stable-targets x86_64-apple-darwin
- uses: Swatinem/rust-cache@v1
- name: Build
shell: bash
@ -29,4 +31,4 @@ jobs:
with:
name: maplibre-x86_64-apple-darwin-demo
path: apple/xcode/build/Build/Products/Debug/*.app
if-no-files-found: error
if-no-files-found: error

View File

@ -12,7 +12,9 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install toolchain
shell: bash
run: just default-toolchain
run: |
just stable-toolchain
just stable-targets x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v1
- uses: ilammy/msvc-dev-cmd@v1 # Provide access to lib.exe
- name: Build
@ -28,4 +30,4 @@ jobs:
with:
name: maplibre-x86_64-windows-demo
path: target/x86_64-pc-windows-msvc/release/maplibre-demo.exe
if-no-files-found: error
if-no-files-found: error

View File

@ -12,7 +12,9 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install nightly toolchain
shell: bash
run: just nightly-toolchain-android
run: |
just nightly-toolchain
just nightly-targets x86_64-linux-android aarch64-linux-android i686-linux-android
- uses: Swatinem/rust-cache@v1
- name: Set NDK Version
shell: bash
@ -41,4 +43,4 @@ jobs:
#- name: Test
# shell: bash
# # TODO: Additional test runs for different targets
# run: just test maplibre-android aarch64-linux-android
# run: just test maplibre-android aarch64-linux-android

View File

@ -15,7 +15,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install toolchain
shell: bash
run: just default-toolchain
run: |
just stable-toolchain
just stable-targets x86_64-apple-darwin aarch64-apple-darwin x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
- uses: Swatinem/rust-cache@v1
- name: Build
shell: bash

View File

@ -30,7 +30,10 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install nightly toolchain
shell: bash
run: just nightly-toolchain
run: |
just nightly-toolchain
just nightly-targets wasm32-unknown-unknown
just nightly-install-src
- uses: Swatinem/rust-cache@v1
- name: Build lib
shell: bash

View File

@ -12,7 +12,9 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install toolchain
shell: bash
run: just default-toolchain
run: |
just stable-toolchain
just stable-targets x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v1
- name: Install GPU Drivers
uses: ./.github/actions/install-driver
@ -20,4 +22,4 @@ jobs:
uses: ./.github/actions/download-test-data
- name: Benchmark
shell: bash
run: WGPU_BACKEND=vulkan just benchmark
run: WGPU_BACKEND=vulkan just benchmark

View File

@ -12,7 +12,7 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install toolchain
shell: bash
run: just default-toolchain
run: just stable-toolchain
- uses: Swatinem/rust-cache@v1
- name: Format
shell: bash

View File

@ -12,7 +12,9 @@ jobs:
- uses: extractions/setup-just@v1
- name: Install toolchain
shell: bash
run: just default-toolchain
run: |
just stable-toolchain
just stable-targets x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v1
- name: Install GPU Drivers
uses: ./.github/actions/install-driver

View File

@ -5,15 +5,38 @@
set shell := ["bash", "-c"]
export NIGHTLY_TOOLCHAIN := "nightly-2022-07-03"
export STABLE_TOOLCHAIN := "1.62"
export CARGO_TERM_COLOR := "always"
export RUST_BACKTRACE := "1"
install-clippy:
rustup component add clippy
install-nightly-clippy:
stable-toolchain:
rustup toolchain install $STABLE_TOOLCHAIN
stable-targets *FLAGS:
rustup toolchain install $STABLE_TOOLCHAIN --target {{FLAGS}}
stable-install-clippy:
rustup component add clippy --toolchain $STABLE_TOOLCHAIN
nightly-toolchain:
rustup toolchain install $NIGHTLY_TOOLCHAIN
nightly-targets *FLAGS:
rustup toolchain install $NIGHTLY_TOOLCHAIN --target {{FLAGS}}
nightly-install-rustfmt: nightly-toolchain
rustup component add rustfmt --toolchain $NIGHTLY_TOOLCHAIN
nightly-install-src: nightly-toolchain
rustup component add rust-src --toolchain $NIGHTLY_TOOLCHAIN
nightly-install-clippy:
rustup component add clippy --toolchain $NIGHTLY_TOOLCHAIN
fixup:
cargo clippy --no-deps -p maplibre --fix
cargo clippy --allow-dirty --no-deps -p maplibre-winit --fix
@ -27,7 +50,7 @@ fixup:
cargo clippy --allow-dirty --no-deps -p maplibre-winit --target x86_64-linux-android --fix
cargo clippy --allow-dirty --no-deps -p maplibre-android --target x86_64-linux-android --fix
check PROJECT ARCH: install-clippy
check PROJECT ARCH: stable-install-clippy
cargo clippy --no-deps -p {{PROJECT}} --target {{ARCH}}
test PROJECT ARCH:
@ -36,27 +59,13 @@ test PROJECT ARCH:
benchmark:
cargo bench -p benchmarks
install-rustfmt: nightly-toolchain
rustup component add rustfmt --toolchain $NIGHTLY_TOOLCHAIN
fmt: install-rustfmt
fmt: nightly-install-rustfmt
export RUSTUP_TOOLCHAIN=$NIGHTLY_TOOLCHAIN && cargo fmt
fmt-check: install-rustfmt
fmt-check: nightly-install-rustfmt
export RUSTUP_TOOLCHAIN=$NIGHTLY_TOOLCHAIN && cargo fmt -- --check
default-toolchain:
# Setups the toolchain from rust-toolchain.toml
cargo --version > /dev/null
nightly-toolchain:
rustup install $NIGHTLY_TOOLCHAIN
rustup component add rust-src --toolchain $NIGHTLY_TOOLCHAIN
nightly-toolchain-android: nightly-toolchain
rustup target add --toolchain $NIGHTLY_TOOLCHAIN x86_64-linux-android
rustup target add --toolchain $NIGHTLY_TOOLCHAIN aarch64-linux-android
rustup target add --toolchain $NIGHTLY_TOOLCHAIN i686-linux-android
web-install PROJECT:
cd web/{{PROJECT}} && npm install
@ -73,7 +82,7 @@ web-lib TARGET *FLAGS: nightly-toolchain (web-install "lib")
web-demo TARGET *FLAGS: (web-install "demo")
cd web/demo && npm run {{TARGET}} -- {{FLAGS}}
web-check FEATURES: nightly-toolchain install-nightly-clippy
web-check FEATURES: nightly-toolchain nightly-install-clippy
export RUSTUP_TOOLCHAIN=$NIGHTLY_TOOLCHAIN && cargo clippy --no-deps -p web --features "{{FEATURES}}" --target wasm32-unknown-unknown -Z build-std=std,panic_abort
web-test FEATURES: nightly-toolchain

View File

@ -1,7 +1,2 @@
[toolchain]
channel = "1.62"
targets = [
"wasm32-unknown-unknown", "x86_64-unknown-linux-gnu", "x86_64-linux-android", "aarch64-linux-android",
"x86_64-apple-darwin", "aarch64-apple-darwin", "x86_64-apple-ios", "aarch64-apple-ios", "aarch64-apple-ios-sim"
]
components = [ "rust-src" ] # rust-src is required for WASM and android builds which recompile the stdlib