install-crystal icon indicating copy to clipboard operation
install-crystal copied to clipboard

unquoted version, set version as string

Open noraj opened this issue 10 months ago • 0 comments

The configurator recommend the usage of unquoted version.

image

But using float typo in YAML for versions is unsafe. For example, 1.10 will be cast to 1.1, which is a totally different version.

I experienced the issue for this use case:

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        crystal: [1.7, 1.8, 1.9, 1.10, 1.11, 1.12]
    runs-on: ${{ matrix.os }}

image

The solution is to use quote.

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        crystal: ['1.7', '1.8', '1.9', '1.10', '1.11', '1.12']

A similar issue arise long ago in YAML with docker, when mapping port 80:8080 need to be quoted to avoid misinterpretation (see the note.

'When mapping ports in the HOST:CONTAINER format, you may experience erroneous results when using a container port lower than 60, because YAML parses numbers in the format xx:yy as a base-60 value. For this reason, we recommend always explicitly specifying your port mappings as strings.'

TL;DR: set version as string in the configurator and documentation examples

noraj avatar Apr 11 '24 19:04 noraj