diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17ea722..d121d47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,39 +16,55 @@ 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.60.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: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + + runs-on: ${{ matrix.os }} needs: build steps: - uses: actions/checkout@v2 - name: End-to-end tests + shell: bash run: | cargo install --path . foreman --version diff --git a/CHANGELOG.md b/CHANGELOG.md index 6704ae0..c44e49a 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 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) - 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)) diff --git a/README.md b/README.md index ee7072a..e2cb3b1 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 [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: 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/scripts/end-to-end-tests.sh b/scripts/end-to-end-tests.sh index 91acbdd..a50b565 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 @@ -52,10 +52,11 @@ verify_install_all_before_fail () { } } -verify_github_tool Rojo "rojo-rbx/rojo" "6.0.0" -verify_github_tool remodel "rojo-rbx/remodel" "0.9.1" -verify_github_tool stylua "JohnnyMorganz/stylua" "0.11.3" +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-cli "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.22.0" +verify_install_all_before_fail selene "Kampfkarren/selene" "0.25.0" diff --git a/src/artifact_choosing.rs b/src/artifact_choosing.rs index 72a121c..2f962b2 100644 --- a/src/artifact_choosing.rs +++ b/src/artifact_choosing.rs @@ -1,9 +1,18 @@ -#[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 +26,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"];