From 3b4daaf2e3e523c96b9cc87ddc214dea8c161639 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 14:09:26 -0700 Subject: [PATCH 01/16] Fix a bug were a project with windows-aarch64 assets would download even on an x86_64 host. Correct this by adding suport for all current rust Tier 1 support platforms: https://doc.rust-lang.org/beta/rustc/platform-support.html#tier-1-with-host-tools --- README.md | 10 ++++++++-- src/artifact_choosing.rs | 30 ++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ee7072a..abc6bd4 100644 --- a/README.md +++ b/README.md @@ -105,10 +105,16 @@ an error happened trying to run `github.com/some-org/some-tool@^1.2.3` at `/User In this case, your foreman installation has mistakenly downloaded an incompatible version of the tool binary due to [an error in the binary file selection logic](https://github.com/Roblox/foreman/pull/53). -To fix this error, take the following steps: +### `is not compatible with the version of Windows you're running` Error +If you're using foreman version 1.1.0 or older, you may encounter an error that reads like this when an existing project adds a Windows binary for the `aarch64` platform (eg Windows Holographic OS for HoloLens) + +In this case, your foreman installation has mistakenly downloaded an incompatible version of the tool binary due to [an error in the binary file selection logic](https://github.com/Roblox/foreman/pull/53). + + +To fix both of these error types, take the following steps: 1. Upgrade your version of `foreman` per [the instructions above](#upgrading). 2. Delete the `~/.foreman/tool-cache.json` file and the `~/.foreman/tools/` folder (and its contents), as well as the `~/.foreman/bin` folder (as described in the [Upgrading](#upgrading) section above). This should remove any invalid binaries that foreman has cached. -3. Run `foreman install` to redownload all relevant tools. +3. Run `foreman install` to re-download all relevant tools. Your downloaded tools should now work correctly. diff --git a/src/artifact_choosing.rs b/src/artifact_choosing.rs index 72a121c..a39a4cc 100644 --- a/src/artifact_choosing.rs +++ b/src/artifact_choosing.rs @@ -1,9 +1,28 @@ -#[cfg(target_os = "windows")] -static PLATFORM_KEYWORDS: &[&str] = &["win32", "win64", "windows"]; +#[cfg(all(target_os = "windows", target_arch = "x86_64"))] +static PLATFORM_KEYWORDS: &[&str] = &[ + "win64", + "windows-x86_64", + "windows" +]; + +#[cfg(all(target_os = "windows", target_arch = "i686"))] +static PLATFORM_KEYWORDS: &[&str] = &[ + "win32", + "windows-i686" +]; + +#[cfg(all(target_os = "windows", target_arch = "aarch64"))] +static PLATFORM_KEYWORDS: &[&str] = &[ + "windows-aarch64" +]; + #[cfg(all(target_os = "macos", target_arch = "x86_64"))] static PLATFORM_KEYWORDS: &[&str] = &["macos-x86_64", "darwin-x86_64", "macos", "darwin"]; +#[cfg(all(target_os = "macos", target_arch = "i686"))] +static PLATFORM_KEYWORDS: &[&str] = &["macos-i686", "darwin-i686"]; + #[cfg(all(target_os = "macos", target_arch = "aarch64"))] static PLATFORM_KEYWORDS: &[&str] = &[ "macos-arm64", @@ -17,12 +36,15 @@ static PLATFORM_KEYWORDS: &[&str] = &[ #[cfg(all(target_os = "linux", target_arch = "x86_64"))] static PLATFORM_KEYWORDS: &[&str] = &["linux-x86_64", "linux"]; +#[cfg(all(target_os = "linux", target_arch = "i686"))] +static PLATFORM_KEYWORDS: &[&str] = &["linux-i686"]; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] -static PLATFORM_KEYWORDS: &[&str] = &["linux-arm64", "linux-aarch64", "linux"]; +static PLATFORM_KEYWORDS: &[&str] = &["linux-arm64", "linux-aarch64"]; #[cfg(all( target_os = "linux", - not(any(target_arch = "x86_64", target_arch = "aarch64")) + not(any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "i686")) ))] static PLATFORM_KEYWORDS: &[&str] = &["linux"]; From 57466ac19b249c98abc5cfcbf26c848c56596710 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 14:19:22 -0700 Subject: [PATCH 02/16] Update CHANGELOG --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6704ae0..d7c3709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Foreman Changelog -## 1.0.6 (2022-09-28) +## Unreleased + +- Take into account architecture when downloading binaries for Windows to fix incorrect downlaod of windows-aarch64 assets on win64 hosts ([#71](https://github.com/Roblox/foreman/pull/71)) +- Support all Tier 1 Rust supported platforms {windows, linux, macos}-{x86_64, i686, aarch64} ([#71](https://github.com/Roblox/foreman/pull/71)) + +## 1.1.0 (2022-09-28) - Support `macos-aarch64` as an artifact name for Apple Silicon (arm64) binaries ([#60](https://github.com/Roblox/foreman/pull/60)) - Take into account architecture when downloading binaries for linux ([#59](https://github.com/Roblox/foreman/pull/59)) From 293ddd29d70a14fd1016766844b15c06af9a5322 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 14:20:25 -0700 Subject: [PATCH 03/16] update README with PR link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index abc6bd4..e2cb3b1 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ In this case, your foreman installation has mistakenly downloaded an incompatibl ### `is not compatible with the version of Windows you're running` Error If you're using foreman version 1.1.0 or older, you may encounter an error that reads like this when an existing project adds a Windows binary for the `aarch64` platform (eg Windows Holographic OS for HoloLens) -In this case, your foreman installation has mistakenly downloaded an incompatible version of the tool binary due to [an error in the binary file selection logic](https://github.com/Roblox/foreman/pull/53). +In this case, your foreman installation has mistakenly downloaded an incompatible version of the tool binary due to [yet another error in the binary file selection logic](https://github.com/Roblox/foreman/pull/71). To fix both of these error types, take the following steps: From 39b957d5c2886cf786b91f76ce4a4ac8b9745582 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 14:21:14 -0700 Subject: [PATCH 04/16] rustfmt --- src/artifact_choosing.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/artifact_choosing.rs b/src/artifact_choosing.rs index a39a4cc..2f962b2 100644 --- a/src/artifact_choosing.rs +++ b/src/artifact_choosing.rs @@ -1,21 +1,11 @@ #[cfg(all(target_os = "windows", target_arch = "x86_64"))] -static PLATFORM_KEYWORDS: &[&str] = &[ - "win64", - "windows-x86_64", - "windows" -]; +static PLATFORM_KEYWORDS: &[&str] = &["win64", "windows-x86_64", "windows"]; #[cfg(all(target_os = "windows", target_arch = "i686"))] -static PLATFORM_KEYWORDS: &[&str] = &[ - "win32", - "windows-i686" -]; +static PLATFORM_KEYWORDS: &[&str] = &["win32", "windows-i686"]; #[cfg(all(target_os = "windows", target_arch = "aarch64"))] -static PLATFORM_KEYWORDS: &[&str] = &[ - "windows-aarch64" -]; - +static PLATFORM_KEYWORDS: &[&str] = &["windows-aarch64"]; #[cfg(all(target_os = "macos", target_arch = "x86_64"))] static PLATFORM_KEYWORDS: &[&str] = &["macos-x86_64", "darwin-x86_64", "macos", "darwin"]; From 8b94aec641e6fc663987425039bbc1f7a413a9cc Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 16:18:24 -0700 Subject: [PATCH 05/16] Add e2e test for lune, and run e2e tests in both Linux and Windows, so CI would fail in the lune case the PR fixes. --- .github/workflows/ci.yml | 6 +++++- scripts/end-to-end-tests.sh | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0da09c8..e47a82b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,11 @@ jobs: run: cargo test --locked --verbose end-to-end-tests: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + + runs-on: ${{ matrix.os } needs: build steps: diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index 91acbdd..998424a 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -52,10 +52,12 @@ verify_install_all_before_fail () { } } -verify_github_tool Rojo "rojo-rbx/rojo" "6.0.0" +verify_github_tool Rojo "rojo-rbx/rojo" "7.3.0" verify_github_tool remodel "rojo-rbx/remodel" "0.9.1" -verify_github_tool stylua "JohnnyMorganz/stylua" "0.11.3" +verify_github_tool stylua "JohnnyMorganz/stylua" "0.17.1" +verify_github_tool luau-lsp "JohnnyMorganz/luau-lsp" "1.20.2" +verify_github_tool lune "filiptibell/lune" "0.6.7" verify_gitlab_tool darklua "seaofvoices/darklua" "0.7.0" -verify_install_all_before_fail selene "Kampfkarren/selene" "0.22.0" +verify_install_all_before_fail selene "Kampfkarren/selene" "0.25.0" From b44c8ddd9857076e66257b10646f0cea5d7e2bef Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 20:21:03 -0700 Subject: [PATCH 06/16] Fix indentation --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e47a82b..d91d8ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os } + runs-on: ${{ matrix.os } needs: build steps: From 53011fdc4b14f52ed7228e6ff402b562aac06d12 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 20:23:38 -0700 Subject: [PATCH 07/16] Fix missing brace --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d91d8ab..2740e49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os } + runs-on: ${{ matrix.os }} needs: build steps: From 1807d7e5555da17bfa9586e4fd92081438e86bf7 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 17 May 2023 20:24:37 -0700 Subject: [PATCH 08/16] Fix typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7c3709..c44e49a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- Take into account architecture when downloading binaries for Windows to fix incorrect downlaod of windows-aarch64 assets on win64 hosts ([#71](https://github.com/Roblox/foreman/pull/71)) +- Take into account architecture when downloading binaries for Windows to fix incorrect download of windows-aarch64 assets on win64 hosts ([#71](https://github.com/Roblox/foreman/pull/71)) - Support all Tier 1 Rust supported platforms {windows, linux, macos}-{x86_64, i686, aarch64} ([#71](https://github.com/Roblox/foreman/pull/71)) ## 1.1.0 (2022-09-28) From 5cb0551a577646a502002608364f4a4e14ee1ef2 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Fri, 14 Jul 2023 12:58:51 -0700 Subject: [PATCH 09/16] incporate feedback, align --- .github/workflows/ci.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2740e49..aac33d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,29 +16,40 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Setup Rust toolchain + shell: bash + run: rustup default stable + - name: Rustfmt + shell: bash run: cargo fmt -- --check - name: Clippy + shell: bash run: cargo clippy build: - runs-on: ubuntu-latest - + needs: checks + timeout-minutes: 10 strategy: matrix: - rust_version: [stable, "1.53.0"] + os: [windows-latest, ubuntu-latest] + rust_version: [stable, "1.60.0"] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Setup Rust toolchain + shell: bash run: rustup default ${{ matrix.rust_version }} - name: Build + shell: bash run: cargo build --locked --verbose - name: Run tests + shell: bash run: cargo test --locked --verbose end-to-end-tests: @@ -53,6 +64,7 @@ jobs: - uses: actions/checkout@v2 - name: End-to-end tests + shell: bash run: | cargo install --path . foreman --version From e9dfe9c1f9a49c41e15f482a58962c59bd57db64 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Fri, 14 Jul 2023 13:03:37 -0700 Subject: [PATCH 10/16] bump to later packages when approrpriate keep lune on specific version that triggers the original bug. darklua has a newer version since its migration to github, but keeping it on the last version published to gitlab since it's the only regression test for gitlab functionality. --- scripts/end-to-end-tests.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index 998424a..f59ce07 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -53,11 +53,11 @@ verify_install_all_before_fail () { } verify_github_tool Rojo "rojo-rbx/rojo" "7.3.0" -verify_github_tool remodel "rojo-rbx/remodel" "0.9.1" -verify_github_tool stylua "JohnnyMorganz/stylua" "0.17.1" -verify_github_tool luau-lsp "JohnnyMorganz/luau-lsp" "1.20.2" +verify_github_tool remodel "rojo-rbx/remodel" "0.11.0" +verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.0" +verify_github_tool luau-lsp "JohnnyMorganz/luau-lsp" "1.22.0" verify_github_tool lune "filiptibell/lune" "0.6.7" -verify_gitlab_tool darklua "seaofvoices/darklua" "0.7.0" +verify_gitlab_tool darklua "seaofvoices/darklua" "0.8.0" verify_install_all_before_fail selene "Kampfkarren/selene" "0.25.0" From ba0036ead6b0bcbfee005afc822a10181caaf0ab Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Fri, 14 Jul 2023 13:11:58 -0700 Subject: [PATCH 11/16] selene 0.25 exists, change to a version that doesn't --- scripts/end-to-end-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index f59ce07..ebf3a05 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -60,4 +60,4 @@ verify_github_tool lune "filiptibell/lune" "0.6.7" verify_gitlab_tool darklua "seaofvoices/darklua" "0.8.0" -verify_install_all_before_fail selene "Kampfkarren/selene" "0.25.0" +verify_install_all_before_fail selene "Kampfkarren/selene" "0.666.31337" From d32bb9de5ec0e26e3d6d47770b2b0d91592434db Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 18 Jul 2023 15:34:54 -0700 Subject: [PATCH 12/16] remove luau-lsp as it doesn't have stock commandline options used to verify correct download --- scripts/end-to-end-tests.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index ebf3a05..1cc8137 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -54,8 +54,7 @@ verify_install_all_before_fail () { verify_github_tool Rojo "rojo-rbx/rojo" "7.3.0" verify_github_tool remodel "rojo-rbx/remodel" "0.11.0" -verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.0" -verify_github_tool luau-lsp "JohnnyMorganz/luau-lsp" "1.22.0" +verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.10 verify_github_tool lune "filiptibell/lune" "0.6.7" verify_gitlab_tool darklua "seaofvoices/darklua" "0.8.0" From 47ca75db61935d7a6adb01fa8d5f3e2b37ad21f6 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Tue, 18 Jul 2023 16:08:06 -0700 Subject: [PATCH 13/16] PR feedback --- scripts/end-to-end-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index 1cc8137..ed0147c 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -54,9 +54,9 @@ verify_install_all_before_fail () { verify_github_tool Rojo "rojo-rbx/rojo" "7.3.0" verify_github_tool remodel "rojo-rbx/remodel" "0.11.0" -verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.10 +verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.1” verify_github_tool lune "filiptibell/lune" "0.6.7" verify_gitlab_tool darklua "seaofvoices/darklua" "0.8.0" -verify_install_all_before_fail selene "Kampfkarren/selene" "0.666.31337" +verify_install_all_before_fail selene "Kampfkarren/selene" "0.25" From 739f2a21b2c2b64d70461cda2fbe2e476e930ac6 Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 19 Jul 2023 10:09:37 -0700 Subject: [PATCH 14/16] fix e2e tests --- scripts/end-to-end-tests.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index ed0147c..3df7623 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -21,20 +21,20 @@ write_foreman_toml () { verify_github_tool () { write_foreman_toml github $1 $2 $3 - foreman install + cargo run --release -- install verify_tool_version $1 $3 rm foreman.toml # for compatibility, verify that `source` also works write_foreman_toml source $1 $2 $3 - foreman install + cargo run --release -- install verify_tool_version $1 $3 rm foreman.toml } verify_gitlab_tool () { write_foreman_toml gitlab $1 $2 $3 - foreman install + cargo run --release -- install verify_tool_version $1 $3 rm foreman.toml } @@ -44,7 +44,7 @@ verify_install_all_before_fail () { echo "$1 = { github = \"$2\", version = \"=$3\" }" >> foreman.toml { # try - foreman install + cargo run --release -- install } || { # finally verify_tool_version $1 $3 @@ -55,7 +55,7 @@ verify_install_all_before_fail () { verify_github_tool Rojo "rojo-rbx/rojo" "7.3.0" verify_github_tool remodel "rojo-rbx/remodel" "0.11.0" verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.1” -verify_github_tool lune "filiptibell/lune" "0.6.7" +verify_github_tool lune-cli "filiptibell/lune" "0.6.7" verify_gitlab_tool darklua "seaofvoices/darklua" "0.8.0" From b69ba73de34b8a855dda2d4081f848622b77625f Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 19 Jul 2023 11:13:57 -0700 Subject: [PATCH 15/16] omfgz unicode quote --- scripts/end-to-end-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index 3df7623..3ca924e 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -54,7 +54,7 @@ verify_install_all_before_fail () { verify_github_tool Rojo "rojo-rbx/rojo" "7.3.0" verify_github_tool remodel "rojo-rbx/remodel" "0.11.0" -verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.1” +verify_github_tool stylua "JohnnyMorganz/stylua" "0.18.1" verify_github_tool lune-cli "filiptibell/lune" "0.6.7" verify_gitlab_tool darklua "seaofvoices/darklua" "0.8.0" From 3765086da1afd3a63aa66287c1dc874155f6729c Mon Sep 17 00:00:00 2001 From: Matt Hargett Date: Wed, 19 Jul 2023 11:32:08 -0700 Subject: [PATCH 16/16] be very specific --- scripts/end-to-end-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index 3ca924e..a50b565 100755 --- a/scripts/end-to-end-tests.sh +++ b/scripts/end-to-end-tests.sh @@ -59,4 +59,4 @@ verify_github_tool lune-cli "filiptibell/lune" "0.6.7" verify_gitlab_tool darklua "seaofvoices/darklua" "0.8.0" -verify_install_all_before_fail selene "Kampfkarren/selene" "0.25" +verify_install_all_before_fail selene "Kampfkarren/selene" "0.25.0"