Check behaviour on Windows pre- Gleam 0.23 (#166)

2d314bc · Paulo F. Oliveira · 2022-12-14 15:25

7 files +61 -19
Message
{commit_body(@commit)}

Files changed

modified .github/workflows/windows.yml
+3 −1
@@ -41,9 +41,11 @@ jobs:
41 41 otp-version: '24'
42 42 rebar3-version: '3.15'
43 43 os: 'windows-latest'
44 + - gleam-version: '0.19.0-rc3'
45 + otp-version: '24'
46 + os: 'windows-latest'
44 47 - gleam-version: '0.23.0-rc1'
45 48 otp-version: '24'
46 rebar3-version: '3.16'
47 49 os: 'windows-latest'
48 50 - elixir-version: 'v1.13'
49 51 otp-version: '24'
modified dist/install-gleam.ps1
+17 −1
@@ -4,10 +4,26 @@ $ErrorActionPreference="Stop"
4 4
5 5 Set-Location ${Env:RUNNER_TEMP}
6 6
7 $FILE_INPUT="gleam-${VSN}-x86_64-pc-windows-msvc.zip"
8 7 $FILE_OUTPUT="gleam.zip"
9 8 $DIR_FOR_BIN=".setup-beam/gleam"
10 9
10 +function Version-Greater-Than([string]${THIS_ONE}, [string]${REFERENCE}) {
11 + $THIS_ONE=$THIS_ONE.replace('v', '')
12 + $THIS_ONE=$THIS_ONE.replace('rc', '')
13 + $THIS_ONE=$THIS_ONE.replace('-', '')
14 + return [version]${THIS_ONE} -gt [version]${REFERENCE}
15 +}
16 +
17 +function Uses-LLVM-Triplets([string]${THIS_VSN}) {
18 + return "${THIS_VSN}" -eq "nightly" -or (Version-Greater-Than "${THIS_VSN}" "0.22.1")
19 +}
20 +
21 +if (Uses-LLVM-Triplets "$VSN") {
22 + $FILE_INPUT="gleam-${VSN}-x86_64-pc-windows-msvc.zip"
23 +} else {
24 + $FILE_INPUT="gleam-${VSN}-windows-64bit.zip"
25 +}
26 +
11 27 $ProgressPreference="SilentlyContinue"
12 28 Invoke-WebRequest "https://github.com/gleam-lang/gleam/releases/download/${VSN}/${FILE_INPUT}" -OutFile "${FILE_OUTPUT}"
13 29 $ProgressPreference="Continue"
modified dist/install-gleam.sh
+4 −3
@@ -9,12 +9,13 @@ FILE_OUTPUT=gleam.tar.gz
9 9 DIR_FOR_BIN=.setup-beam/gleam
10 10
11 11 version_gt() {
12 test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"
12 + REFERENCE=$1
13 + test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$REFERENCE"
13 14 }
14 15
15 16 uses_llvm_triplets() {
16 local version="$1"
17 test "$version" = "nightly" || version_gt "$version" "v0.22.1"
17 + local VERSION="$1"
18 + test "${VERSION}" = "nightly" || version_gt "${VERSION}" "v0.22.1"
18 19 }
19 20
20 21 if uses_llvm_triplets "$VSN"
modified dist/install-otp.ps1
+8 −5
@@ -4,14 +4,17 @@ $ErrorActionPreference="Stop"
4 4
5 5 Set-Location ${Env:RUNNER_TEMP}
6 6
7 +$FILE_INPUT="otp_win64_${VSN}.exe"
7 8 $FILE_OUTPUT="otp.exe"
8 $ERL_ROOT = "${Env:RUNNER_TEMP}\.setup-beam\otp"
9 +$DIR_FOR_BIN="${Env:RUNNER_TEMP}\.setup-beam\otp"
9 10
10 11 $ProgressPreference="SilentlyContinue"
11 Invoke-WebRequest "https://github.com/erlang/otp/releases/download/OTP-${VSN}/otp_win64_${VSN}.exe" -OutFile "${FILE_OUTPUT}"
12 +Invoke-WebRequest "https://github.com/erlang/otp/releases/download/OTP-${VSN}/${FILE_INPUT}" -OutFile "${FILE_OUTPUT}"
12 13 $ProgressPreference="Continue"
13 Start-Process "${FILE_OUTPUT}" "/S /D=${ERL_ROOT}" -Wait
14 +New-Item "${DIR_FOR_BIN}" -ItemType Directory | Out-Null
15 +$ProgressPreference="SilentlyContinue"
16 +Start-Process "${FILE_OUTPUT}" "/S /D=${DIR_FOR_BIN}" -Wait
14 17 Write-Output "Installed Erlang/OTP version follows"
15 & "${ERL_ROOT}/bin/erl.exe" "+V" | Write-Output
18 +& "${DIR_FOR_BIN}/bin/erl.exe" "+V" | Write-Output
16 19
17 "INSTALL_DIR_FOR_OTP=${ERL_ROOT}" | Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append
20 +"INSTALL_DIR_FOR_OTP=${DIR_FOR_BIN}" | Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append
modified src/install-gleam.ps1
+17 −1
@@ -4,10 +4,26 @@ $ErrorActionPreference="Stop"
4 4
5 5 Set-Location ${Env:RUNNER_TEMP}
6 6
7 $FILE_INPUT="gleam-${VSN}-x86_64-pc-windows-msvc.zip"
8 7 $FILE_OUTPUT="gleam.zip"
9 8 $DIR_FOR_BIN=".setup-beam/gleam"
10 9
10 +function Version-Greater-Than([string]${THIS_ONE}, [string]${REFERENCE}) {
11 + $THIS_ONE=$THIS_ONE.replace('v', '')
12 + $THIS_ONE=$THIS_ONE.replace('rc', '')
13 + $THIS_ONE=$THIS_ONE.replace('-', '')
14 + return [version]${THIS_ONE} -gt [version]${REFERENCE}
15 +}
16 +
17 +function Uses-LLVM-Triplets([string]${THIS_VSN}) {
18 + return "${THIS_VSN}" -eq "nightly" -or (Version-Greater-Than "${THIS_VSN}" "0.22.1")
19 +}
20 +
21 +if (Uses-LLVM-Triplets "$VSN") {
22 + $FILE_INPUT="gleam-${VSN}-x86_64-pc-windows-msvc.zip"
23 +} else {
24 + $FILE_INPUT="gleam-${VSN}-windows-64bit.zip"
25 +}
26 +
11 27 $ProgressPreference="SilentlyContinue"
12 28 Invoke-WebRequest "https://github.com/gleam-lang/gleam/releases/download/${VSN}/${FILE_INPUT}" -OutFile "${FILE_OUTPUT}"
13 29 $ProgressPreference="Continue"
modified src/install-gleam.sh
+4 −3
@@ -9,12 +9,13 @@ FILE_OUTPUT=gleam.tar.gz
9 9 DIR_FOR_BIN=.setup-beam/gleam
10 10
11 11 version_gt() {
12 test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"
12 + REFERENCE=$1
13 + test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$REFERENCE"
13 14 }
14 15
15 16 uses_llvm_triplets() {
16 local version="$1"
17 test "$version" = "nightly" || version_gt "$version" "v0.22.1"
17 + local VERSION="$1"
18 + test "${VERSION}" = "nightly" || version_gt "${VERSION}" "v0.22.1"
18 19 }
19 20
20 21 if uses_llvm_triplets "$VSN"
modified src/install-otp.ps1
+8 −5
@@ -4,14 +4,17 @@ $ErrorActionPreference="Stop"
4 4
5 5 Set-Location ${Env:RUNNER_TEMP}
6 6
7 +$FILE_INPUT="otp_win64_${VSN}.exe"
7 8 $FILE_OUTPUT="otp.exe"
8 $ERL_ROOT = "${Env:RUNNER_TEMP}\.setup-beam\otp"
9 +$DIR_FOR_BIN="${Env:RUNNER_TEMP}\.setup-beam\otp"
9 10
10 11 $ProgressPreference="SilentlyContinue"
11 Invoke-WebRequest "https://github.com/erlang/otp/releases/download/OTP-${VSN}/otp_win64_${VSN}.exe" -OutFile "${FILE_OUTPUT}"
12 +Invoke-WebRequest "https://github.com/erlang/otp/releases/download/OTP-${VSN}/${FILE_INPUT}" -OutFile "${FILE_OUTPUT}"
12 13 $ProgressPreference="Continue"
13 Start-Process "${FILE_OUTPUT}" "/S /D=${ERL_ROOT}" -Wait
14 +New-Item "${DIR_FOR_BIN}" -ItemType Directory | Out-Null
15 +$ProgressPreference="SilentlyContinue"
16 +Start-Process "${FILE_OUTPUT}" "/S /D=${DIR_FOR_BIN}" -Wait
14 17 Write-Output "Installed Erlang/OTP version follows"
15 & "${ERL_ROOT}/bin/erl.exe" "+V" | Write-Output
18 +& "${DIR_FOR_BIN}/bin/erl.exe" "+V" | Write-Output
16 19
17 "INSTALL_DIR_FOR_OTP=${ERL_ROOT}" | Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append
20 +"INSTALL_DIR_FOR_OTP=${DIR_FOR_BIN}" | Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append

Parents: aee3f52