mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Deduplicate and fix CI (#189)
* Dedublicate and fix CI * Set correct toolchain * Install binstall quicker * Add check for different arch
This commit is contained in:
parent
ec1ad07164
commit
ecaa696430
55
.github/actions/cargo-install/action.yml
vendored
55
.github/actions/cargo-install/action.yml
vendored
@ -9,6 +9,61 @@ inputs:
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install binstall
|
||||
run: |
|
||||
if command -v cargo-binstall &> /dev/null; then
|
||||
echo "binstall already found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
FILE=""
|
||||
|
||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||
FILE="cargo-binstall-x86_64-unknown-linux-gnu.tgz"
|
||||
elif [ "$RUNNER_OS" == "Windows" ]; then
|
||||
FILE="cargo-binstall-x86_64-pc-windows-msvc.zip"
|
||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||
if [ "$RUNNER_ARCH" == "ARM64" ]; then
|
||||
FILE="cargo-binstall-aarch64-apple-darwin.zip"
|
||||
elif [ "$RUNNER_ARCH" == "X64" ]; then
|
||||
FILE="cargo-binstall-x86_64-apple-darwin.zip"
|
||||
else
|
||||
echo "Unable to install on arch: $RUNNER_ARCH"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Install with debug profile -> faster compilation
|
||||
cargo install --debug cargo-binstall
|
||||
fi
|
||||
|
||||
if [ "$FILE" != "" ]; then
|
||||
URL="https://github.com/cargo-bins/cargo-binstall/releases/download/v0.16.0/$FILE"
|
||||
|
||||
echo "Downloading binstall: $URL"
|
||||
|
||||
curl -L -o /tmp/binstall.bin "$URL"
|
||||
|
||||
echo "Installing binstall"
|
||||
INSTALL_PATH="~/.binstall/"
|
||||
mkdir -p "$INSTALL_PATH"
|
||||
if [[ $FILE == *"zip"* ]]; then
|
||||
unzip /tmp/binstall.bin -d "$INSTALL_PATH"
|
||||
elif [[ $FILE == *"tgz"* ]]; then
|
||||
tar xf /tmp/binstall.bin -C "$INSTALL_PATH"
|
||||
else
|
||||
echo "Unknown format: $FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Temporary include binstall in path
|
||||
export PATH="$INSTALL_PATH:$PATH"
|
||||
else
|
||||
echo "Skipping binary install"
|
||||
fi
|
||||
|
||||
# Upgrade
|
||||
cargo binstall --no-confirm --force cargo-binstall
|
||||
shell: bash
|
||||
- name: Install ${{ inputs.name }}
|
||||
shell: bash
|
||||
run: cargo binstall --no-confirm --force ${{ inputs.name }}
|
||||
|
||||
14
.github/actions/setup-binstall/action.yml
vendored
14
.github/actions/setup-binstall/action.yml
vendored
@ -1,14 +0,0 @@
|
||||
name: setup-binstall
|
||||
description: Setup binstall
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup default toolchain
|
||||
shell: bash
|
||||
run: rustup show # Installs toolchain specified in rust-toolchain.toml
|
||||
- name: Install binstall
|
||||
shell: bash
|
||||
run: |
|
||||
# Install with debug profile -> faster compilation
|
||||
cargo install --debug cargo-binstall
|
||||
56
.github/actions/setup/action.yml
vendored
Normal file
56
.github/actions/setup/action.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: setup
|
||||
description: Setup
|
||||
|
||||
|
||||
inputs:
|
||||
nightly:
|
||||
required: false
|
||||
description: If true stable will be installed, if false nightly
|
||||
targets:
|
||||
required: false
|
||||
description: space separated list of rustc targets
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# The Rust version from rust-toolchain.toml is used for the first steps. Later the Rust version is changed
|
||||
# by setting another version in "Set XYZ toolchain".
|
||||
- name: Setup default toolchain
|
||||
shell: bash
|
||||
run: rustup show # Installs toolchain specified in rust-toolchain.toml
|
||||
- name: Install just
|
||||
uses: ./.github/actions/cargo-install
|
||||
with:
|
||||
name: just
|
||||
- name: Install stable toolchain
|
||||
if: ${{ !inputs.nightly }}
|
||||
shell: bash
|
||||
run: just stable-toolchain
|
||||
- name: Install nightly toolchain
|
||||
if: ${{ inputs.nightly }}
|
||||
shell: bash
|
||||
run: just nightly-toolchain
|
||||
# We are now setting the toolchains using override. That way e.g. Swatinem/rust-cache will pick up the right rustc
|
||||
# version
|
||||
- name: Set stable toolchain
|
||||
if: ${{ !inputs.nightly }}
|
||||
shell: bash
|
||||
run: just stable-override-toolchain
|
||||
- name: Set nightly toolchain
|
||||
if: ${{ inputs.nightly }}
|
||||
shell: bash
|
||||
run: just nightly-override-toolchain
|
||||
- name: Install targets
|
||||
if: ${{ inputs.targets && !inputs.nightly }}
|
||||
shell: bash
|
||||
run: just stable-targets ${{ inputs.targets }}
|
||||
- name: Install targets
|
||||
if: ${{ inputs.targets && inputs.nightly }}
|
||||
shell: bash
|
||||
run: just nightly-targets ${{ inputs.targets }}
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
# Install just again because Swatinem/rust-cache might removed it while restoring the cache
|
||||
- name: Install just
|
||||
uses: ./.github/actions/cargo-install
|
||||
with:
|
||||
name: just
|
||||
12
.github/workflows/build-deploy-docs.yml
vendored
12
.github/workflows/build-deploy-docs.yml
vendored
@ -14,16 +14,8 @@ jobs:
|
||||
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 toolchain
|
||||
shell: bash
|
||||
run: just stable-toolchain
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
- name: Install mdbook
|
||||
uses: ./.github/actions/cargo-install
|
||||
with:
|
||||
|
||||
14
.github/workflows/demo-linux.yml
vendored
14
.github/workflows/demo-linux.yml
vendored
@ -9,18 +9,10 @@ jobs:
|
||||
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
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
name: just
|
||||
- name: Install toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
just stable-toolchain
|
||||
just stable-targets x86_64-unknown-linux-gnu
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
- name: Install Dependencies
|
||||
shell: bash
|
||||
run: sudo apt-get install -y libwayland-dev libxkbcommon-dev # Required for winit
|
||||
|
||||
14
.github/workflows/demo-macos.yml
vendored
14
.github/workflows/demo-macos.yml
vendored
@ -9,18 +9,10 @@ jobs:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup binstall
|
||||
uses: ./.github/actions/setup-binstall
|
||||
- name: Install just
|
||||
uses: ./.github/actions/cargo-install
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
name: just
|
||||
- name: Install toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
just stable-toolchain
|
||||
just stable-targets x86_64-apple-darwin
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
targets: x86_64-apple-darwin
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: cd apple/xcode && xcodebuild -scheme "example (macOS)" build CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=10.9 -derivedDataPath build
|
||||
|
||||
21
.github/workflows/demo-windows.yml
vendored
21
.github/workflows/demo-windows.yml
vendored
@ -8,22 +8,17 @@ jobs:
|
||||
name: Build
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Switch shell to msys2
|
||||
- name: Switch to msys2
|
||||
run: echo "C:\msys64\usr\bin" >> $GITHUB_PATH
|
||||
shell: bash
|
||||
- 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 toolchain
|
||||
- name: Install mysys2 dependencies
|
||||
run: pacman -S --noconfirm unzip
|
||||
shell: bash
|
||||
run: |
|
||||
just stable-toolchain
|
||||
just stable-targets x86_64-pc-windows-msvc
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
- uses: ilammy/msvc-dev-cmd@v1 # Provide access to lib.exe
|
||||
- name: Show PATH
|
||||
shell: bash
|
||||
|
||||
15
.github/workflows/library-android.yml
vendored
15
.github/workflows/library-android.yml
vendored
@ -9,18 +9,11 @@ jobs:
|
||||
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
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
name: just
|
||||
- name: Install nightly toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
just nightly-toolchain
|
||||
just nightly-targets x86_64-linux-android aarch64-linux-android i686-linux-android
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
nightly: true
|
||||
targets: x86_64-linux-android aarch64-linux-android i686-linux-android
|
||||
- name: Set NDK Version
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
18
.github/workflows/library-apple.yml
vendored
18
.github/workflows/library-apple.yml
vendored
@ -10,18 +10,10 @@ jobs:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup binstall
|
||||
uses: ./.github/actions/setup-binstall
|
||||
- name: Install just
|
||||
uses: ./.github/actions/cargo-install
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
name: just
|
||||
- name: Install toolchain
|
||||
shell: bash
|
||||
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@v2
|
||||
targets: x86_64-apple-darwin aarch64-apple-darwin x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
|
||||
- name: Swift Version
|
||||
shell: bash
|
||||
run: swift --version
|
||||
@ -34,10 +26,10 @@ jobs:
|
||||
- name: Check x86_64 darwin
|
||||
shell: bash
|
||||
run: just check apple x86_64-apple-darwin
|
||||
- name: Check x86_64 darwin
|
||||
- name: Check aarch64 darwin
|
||||
shell: bash
|
||||
# TODO: Additional clippy checks for different targets (iOS)
|
||||
run: just check apple x86_64-apple-darwin
|
||||
run: just check apple aarch64-apple-darwin
|
||||
- name: Test x86_64 darwin
|
||||
shell: bash
|
||||
# TODO: Additional test runs for different targets (Different targets might require emulation)
|
||||
|
||||
15
.github/workflows/library-web.yml
vendored
15
.github/workflows/library-web.yml
vendored
@ -27,17 +27,11 @@ jobs:
|
||||
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
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
name: just
|
||||
- name: Install nightly toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
just nightly-toolchain
|
||||
just nightly-targets wasm32-unknown-unknown
|
||||
nightly: true
|
||||
targets: wasm32-unknown-unknown
|
||||
- name: Install rust sources (build-std)
|
||||
if: inputs.multithreaded
|
||||
shell: bash
|
||||
@ -49,7 +43,6 @@ jobs:
|
||||
# We want the latest version, as Cargo uses the latest version of wasm-bindgen
|
||||
with:
|
||||
name: wasm-bindgen-cli
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build lib
|
||||
shell: bash
|
||||
run: just web-lib build --release ${{ inputs.webgl && '--webgl' || '' }} ${{ inputs.multithreaded && '--multithreaded' || '' }}
|
||||
|
||||
14
.github/workflows/run-benchmarks.yml
vendored
14
.github/workflows/run-benchmarks.yml
vendored
@ -9,18 +9,10 @@ jobs:
|
||||
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
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
name: just
|
||||
- name: Install toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
just stable-toolchain
|
||||
just stable-targets x86_64-unknown-linux-gnu
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
- name: Install GPU Drivers
|
||||
uses: ./.github/actions/install-driver
|
||||
- name: Download test data
|
||||
|
||||
12
.github/workflows/run-checks.yml
vendored
12
.github/workflows/run-checks.yml
vendored
@ -9,16 +9,8 @@ jobs:
|
||||
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 toolchain
|
||||
shell: bash
|
||||
run: just stable-toolchain
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
- name: Format
|
||||
shell: bash
|
||||
run: just fmt-check
|
||||
|
||||
14
.github/workflows/run-tests.yml
vendored
14
.github/workflows/run-tests.yml
vendored
@ -9,18 +9,10 @@ jobs:
|
||||
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
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
name: just
|
||||
- name: Install toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
just stable-toolchain
|
||||
just stable-targets x86_64-unknown-linux-gnu
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
- name: Install GPU Drivers
|
||||
uses: ./.github/actions/install-driver
|
||||
- name: Test Vulkan
|
||||
|
||||
6
justfile
6
justfile
@ -14,6 +14,9 @@ export RUST_BACKTRACE := "1"
|
||||
stable-toolchain:
|
||||
rustup toolchain install $STABLE_TOOLCHAIN
|
||||
|
||||
stable-override-toolchain:
|
||||
rustup override set $STABLE_TOOLCHAIN
|
||||
|
||||
stable-targets *FLAGS:
|
||||
rustup toolchain install $STABLE_TOOLCHAIN --target {{FLAGS}}
|
||||
|
||||
@ -24,6 +27,9 @@ stable-install-clippy:
|
||||
nightly-toolchain:
|
||||
rustup toolchain install $NIGHTLY_TOOLCHAIN
|
||||
|
||||
nightly-override-toolchain:
|
||||
rustup override set $NIGHTLY_TOOLCHAIN
|
||||
|
||||
nightly-targets *FLAGS:
|
||||
rustup toolchain install $NIGHTLY_TOOLCHAIN --target {{FLAGS}}
|
||||
|
||||
|
||||
@ -1,2 +1,6 @@
|
||||
[toolchain]
|
||||
# This library version should match the $STABLE_TOOLCHAIN version of the justfile. The CI will not use
|
||||
# the rust-toolchain.toml file to build this project. The CI might use it though to build other Rust binaries, required
|
||||
# for building maplibre-rs.
|
||||
# This file is here to give IDEs a hint about which Rust version to use.
|
||||
channel = "1.64"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user