From e7dd2a1a6d220f6d9bf21d945935bdbe5802734b Mon Sep 17 00:00:00 2001 From: Maximilian Ammann Date: Sat, 17 Sep 2022 20:58:06 +0200 Subject: [PATCH] Selectively install targets --- .github/workflows/build-deploy-docs.yml | 2 +- .github/workflows/demo-linux.yml | 4 +- .github/workflows/demo-macos.yml | 6 ++- .github/workflows/demo-windows.yml | 6 ++- .github/workflows/library-android.yml | 6 ++- .github/workflows/library-apple.yml | 4 +- .github/workflows/library-web.yml | 5 ++- .github/workflows/run-benchmarks.yml | 6 ++- .github/workflows/run-checks.yml | 2 +- .github/workflows/run-tests.yml | 4 +- justfile | 51 +++++++++++++++---------- rust-toolchain.toml | 5 --- 12 files changed, 61 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build-deploy-docs.yml b/.github/workflows/build-deploy-docs.yml index 45945010..da00f7cf 100644 --- a/.github/workflows/build-deploy-docs.yml +++ b/.github/workflows/build-deploy-docs.yml @@ -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 diff --git a/.github/workflows/demo-linux.yml b/.github/workflows/demo-linux.yml index b112daed..eb10b84b 100644 --- a/.github/workflows/demo-linux.yml +++ b/.github/workflows/demo-linux.yml @@ -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 diff --git a/.github/workflows/demo-macos.yml b/.github/workflows/demo-macos.yml index 69ec7eee..56e7ad52 100644 --- a/.github/workflows/demo-macos.yml +++ b/.github/workflows/demo-macos.yml @@ -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 \ No newline at end of file + if-no-files-found: error diff --git a/.github/workflows/demo-windows.yml b/.github/workflows/demo-windows.yml index b2a187b1..5c873cb9 100644 --- a/.github/workflows/demo-windows.yml +++ b/.github/workflows/demo-windows.yml @@ -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 \ No newline at end of file + if-no-files-found: error diff --git a/.github/workflows/library-android.yml b/.github/workflows/library-android.yml index 99a5c6e8..90f76f89 100644 --- a/.github/workflows/library-android.yml +++ b/.github/workflows/library-android.yml @@ -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 \ No newline at end of file + # run: just test maplibre-android aarch64-linux-android diff --git a/.github/workflows/library-apple.yml b/.github/workflows/library-apple.yml index 36a1c22d..4cbffac7 100644 --- a/.github/workflows/library-apple.yml +++ b/.github/workflows/library-apple.yml @@ -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 diff --git a/.github/workflows/library-web.yml b/.github/workflows/library-web.yml index b32c0daf..ca325ace 100644 --- a/.github/workflows/library-web.yml +++ b/.github/workflows/library-web.yml @@ -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 diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index 65b09b21..9bfa7fd0 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -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 \ No newline at end of file + run: WGPU_BACKEND=vulkan just benchmark diff --git a/.github/workflows/run-checks.yml b/.github/workflows/run-checks.yml index 52d1ffc4..ac2b6ece 100644 --- a/.github/workflows/run-checks.yml +++ b/.github/workflows/run-checks.yml @@ -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 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a0325207..22ffc8de 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -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 diff --git a/justfile b/justfile index 2e1a99cb..2e31cd8e 100644 --- a/justfile +++ b/justfile @@ -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 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a05c2ddc..17d1e136 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -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