setup-dlang icon indicating copy to clipboard operation
setup-dlang copied to clipboard

Extend regex to be more user friendly when matching compilers

Open Geod24 opened this issue 4 years ago • 4 comments

Currently the regex we use is rather simple:

https://github.com/dlang-community/setup-dlang/blob/cf2096d4ff98ddeff7e3dbe601fc03f388543c7e/src/compiler.ts#L19

We only allow ${compiler}-XXX. I propose the following improvements:

  • Match ldc and dmd as alias to {dmd,ldc}-latest: This will be more user friendly.
  • Match a version without patch version: E.g. 2.094 as an alias for 2.094.2.
  • Allow to match an offset from latest: Some projects might want to support the last X releases. Currently they need to edit their workflow whenever a new version is released.

Thoughts @PetarKirov @mihails-strasuns @WebFreak001 ?

Geod24 avatar Jan 20 '21 04:01 Geod24

@mihails-strasuns : The second point is inspired by https://github.com/sociomantic-tsunami/ocean/blob/81050e06f3197e637ab6090b027c158fa28691a2/.travis.yml#L36

Geod24 avatar Jan 20 '21 04:01 Geod24

Match ldc and dmd as alias to {dmd,ldc}-latest: This will be more user friendly.

👍

Match a version without patch version: E.g. 2.094 as an alias for 2.094.2.

is this always going to be the latest patch? I think this is a good addition.

Allow to match an offset from latest: Some projects might want to support the last X releases. Currently they need to edit their workflow whenever a new version is released.

this is a good use-case, though for a lot of compilers github doesn't really allow anything convenient from the action side afaik. Currently you will probably need to list versions like dmd-latest, dmd-latest-1, dmd-latest-2, dmd-latest-3, dmd-latest-4, ...

Probably a good idea to think about a small name to quickly use here, something like dmd, dmd^1, dmd^2, dmd^3, ... maybe

WebFreak001 avatar Jan 20 '21 07:01 WebFreak001

Allow to match an offset from latest

I agree it's a valuable feature. I have a WIP implementation of this as I wanted to have this feature in order to migrate dub from TravisCI to setup-dlang... that was a while ago. IIRC I got stuck in trying to do some meta-programming in Typescript while rewriting some parts of the codebase 😄 I will take a look this weekend to see if I can bring it to the finish line.

PetarKirov avatar Jan 21 '21 07:01 PetarKirov

Nice! And as suggested by @WebFreak001 , I think dmd^X is the best syntax for this.

Geod24 avatar Jan 21 '21 08:01 Geod24