File tree Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 90
90
node-version : ' 20'
91
91
- run : npm install --production
92
92
- run : npm test
93
+ - name : .tool-versions test
94
+ id : setup-beam
95
+ uses : ./
96
+ with :
97
+ install-rebar : false
98
+ install-hex : false
99
+ version-file : test/.tool-versions
100
+ version-type : strict
93
101
94
102
unit_tests_macos :
95
103
name : Unit tests (macOS)
Original file line number Diff line number Diff line change @@ -26680,7 +26680,7 @@ function parseVersionFile(versionFilePath0) {
26680
26680
// For the time being we parse .tool-versions
26681
26681
// If we ever start parsing something else, this should
26682
26682
// become default in a new option named e.g. version-file-type
26683
- versions.split('\n' ).forEach((line) => {
26683
+ versions.split(/\r?\n/ ).forEach((line) => {
26684
26684
const appVersion = line.match(/^([^ ]+)[ ]+(ref:v?)?([^ #]+)/)
26685
26685
if (appVersion) {
26686
26686
const app = appVersion[1]
Original file line number Diff line number Diff line change @@ -805,7 +805,7 @@ function parseVersionFile(versionFilePath0) {
805
805
// For the time being we parse .tool-versions
806
806
// If we ever start parsing something else, this should
807
807
// become default in a new option named e.g. version-file-type
808
- versions . split ( '\n' ) . forEach ( ( line ) => {
808
+ versions . split ( / \r ? \n / ) . forEach ( ( line ) => {
809
809
const appVersion = line . match ( / ^ ( [ ^ ] + ) [ ] + ( r e f : v ? ) ? ( [ ^ # ] + ) / )
810
810
if ( appVersion ) {
811
811
const app = appVersion [ 1 ]
Original file line number Diff line number Diff line change @@ -938,15 +938,19 @@ describe('version file', () => {
938
938
const gleamVersion = unsimulateInput ( 'gleam-version' )
939
939
940
940
it ( 'is parsed correctly' , async ( ) => {
941
- const erlang = '27'
942
- const elixir = '1.17.0 '
943
- const gleam = '0.23.0 '
944
- const toolVersions = `# a comment
945
- erlang ref:v${ erlang } # comment, no space, and ref:v
941
+ const erlang = '27.3.4.1 '
942
+ const elixir = '1.18.4 '
943
+ const gleam = '1.9.1 '
944
+ let toolVersions = `# a comment
945
+ erlang ref:v${ erlang }
946
946
elixir ref:${ elixir } # comment, with space and ref:
947
947
not-gleam 0.23 # not picked up
948
948
gleam ${ gleam } \n`
949
949
const filename = 'test/.tool-versions'
950
+ if ( process . platform === 'win32' ) {
951
+ // Force \r\n to test in Windows
952
+ toolVersions = toolVersions . replace ( / \n / g, '\r\n' )
953
+ }
950
954
fs . writeFileSync ( filename , toolVersions )
951
955
process . env . GITHUB_WORKSPACE = ''
952
956
const appVersions = setupBeam . parseVersionFile ( filename )
You can’t perform that action at this time.
0 commit comments