Skip to content

Commit

Permalink
Merge pull request #35 from nim-lang/ringabout-patch-2
Browse files Browse the repository at this point in the history
nimble test
  • Loading branch information
ringabout authored Sep 26, 2024
2 parents fc240ac + c45336c commit 52a161f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,23 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- uses: jiro4989/setup-nim-action@v2
with:
path: "choosenim"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build binary
run: |
STABLE_NIM=`curl -sSL https://nim-lang.org/channels/stable | xargs`
curl -O https://nim-lang.org/download/nim-$STABLE_NIM-linux_x64.tar.xz
tar -xvJf nim-$STABLE_NIM-linux_x64.tar.xz
NIMPATH=`pwd`/nim-$STABLE_NIM/bin
PATH=$PATH:$NIMPATH
# compile choosenim
ls -lah
cd choosenim
nimble install -y
nimble build --path:$NIMPATH
nimble build -d:release
ls bin/*
- name: Testing binaries
run: |
${{ runner.workspace }}/choosenim/choosenim/bin/choosenim stable
${{ runner.workspace }}/choosenim/bin/choosenim stable
/home/runner/.nimble/bin/nim -v
${{ runner.workspace }}/choosenim/choosenim/bin/choosenim devel
${{ runner.workspace }}/choosenim/bin/choosenim devel
/home/runner/.nimble/bin/nim -v
nimble test
# ----------------------------------------------------------------------------
Expand All @@ -63,6 +59,9 @@ jobs:
cp bin/choosenim.exe zipfile/choosenim/
cp scripts/runme.bat zipfile/
Compress-Archive -Path zipfile/* -Destination choosenim-windows.zip
- name: Testing binaries
run: nimble test

# ----------------------------------------------------------------------------
# this uses choosenim by itself - you may need to build manually if you break choosenim
Expand All @@ -77,14 +76,15 @@ jobs:
run: |
git config --global --add safe.directory /__w/choosenim/choosenim
nimble install -y
nimble build
nimble build -d:staticBuild
ls bin/*
- name: Testing binaries
run: |
${{ runner.workspace }}/choosenim/bin/choosenim stable
/Users/runner/.nimble/bin/nim -v
${{ runner.workspace }}/choosenim/bin/choosenim devel
/Users/runner/.nimble/bin/nim -v
nimble test
build-macos_arm64:
runs-on: macos-14
Expand All @@ -97,11 +97,12 @@ jobs:
run: |
git config --global --add safe.directory /__w/choosenim/choosenim
nimble install -y
nimble build
nimble build -d:staticBuild
ls bin/*
- name: Testing binaries
run: |
${{ runner.workspace }}/choosenim/bin/choosenim stable
/Users/runner/.nimble/bin/nim -v
nimble test
${{ runner.workspace }}/choosenim/bin/choosenim devel
/Users/runner/.nimble/bin/nim -v
57 changes: 29 additions & 28 deletions tests/tester.nim
Original file line number Diff line number Diff line change
Expand Up @@ -139,34 +139,35 @@ test "fails on bad flag":
check inLines(output.processOutput, "unknown")
check inLines(output.processOutput, "flag")

test "can choose #v1.0.0":
beginTest()
block:
let (output, exitCode) = exec("\"#v1.0.0\"", liveOutput=true)
check exitCode == QuitSuccess

check inLines(output.processOutput, "building")
check inLines(output.processOutput, "downloading")
check inLines(output.processOutput, "building tools")
check hasLine(output.processOutput, "switched to nim #v1.0.0")

block:
let (output, exitCode) = exec("\"#v1.0.0\"")
check exitCode == QuitSuccess

check hasLine(output.processOutput, "info: version #v1.0.0 already selected")

# block:
# let (output, exitCode) = exec("--version", exe=nimbleDir / "bin" / "nimble")
# check exitCode == QuitSuccess
# check inLines(output.processOutput, "v0.11.0")

# Verify that we cannot remove currently selected #v1.0.0.
block:
let (output, exitCode) = exec(["remove", "\"#v1.0.0\""], liveOutput=true)
check exitCode == QuitFailure

check inLines(output.processOutput, "Cannot remove current version.")
when defined(linux) or defined(windows):
test "can choose #v1.0.0":
beginTest()
block:
let (output, exitCode) = exec("\"#v1.0.0\"", liveOutput=true)
check exitCode == QuitSuccess

check inLines(output.processOutput, "building")
check inLines(output.processOutput, "downloading")
check inLines(output.processOutput, "building tools")
check hasLine(output.processOutput, "switched to nim #v1.0.0")

block:
let (output, exitCode) = exec("\"#v1.0.0\"")
check exitCode == QuitSuccess

check hasLine(output.processOutput, "info: version #v1.0.0 already selected")

# block:
# let (output, exitCode) = exec("--version", exe=nimbleDir / "bin" / "nimble")
# check exitCode == QuitSuccess
# check inLines(output.processOutput, "v0.11.0")

# Verify that we cannot remove currently selected #v1.0.0.
block:
let (output, exitCode) = exec(["remove", "\"#v1.0.0\""], liveOutput=true)
check exitCode == QuitFailure

check inLines(output.processOutput, "Cannot remove current version.")

test "cannot remove not installed v0.16.0":
beginTest()
Expand Down

0 comments on commit 52a161f

Please sign in to comment.