crystal-lang / install-crystal

GitHub Action: Install Crystal programming language
https://crystal-lang.github.io/install-crystal/configurator.html
MIT License
67 stars 8 forks source link

unquoted version, set version as string #37

Closed noraj closed 5 months ago

noraj commented 6 months ago

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