mirror of
https://github.com/erlef/setup-beam.git
synced 2026-07-29 03:00:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5304e04ea2 | ||
|
|
1f578f0ad6 | ||
|
|
d1cc10de68 | ||
|
|
d73068ed6a | ||
|
|
074443e9dc | ||
|
|
2fdf20c985 | ||
|
|
d1c02572fa | ||
|
|
9db386cf4d | ||
|
|
b9c58b0450 | ||
|
|
a54aa91870 | ||
|
|
168876b81a | ||
|
|
ee8d6d1ec3 | ||
|
|
d2ccea2f14 | ||
|
|
e7c76e536e | ||
|
|
7f9edf8627 |
@@ -4,5 +4,4 @@ A brief description of your changes.
|
|||||||
|
|
||||||
Closes #<issue>.
|
Closes #<issue>.
|
||||||
|
|
||||||
- [ ] I have performed a self-review of my changes
|
|
||||||
- [ ] I have read and understood the [contributing guidelines](/erlef/setup-beam/blob/main/CONTRIBUTING.md)
|
- [ ] I have read and understood the [contributing guidelines](/erlef/setup-beam/blob/main/CONTRIBUTING.md)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- '*'
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -62,6 +62,7 @@ jobs:
|
|||||||
id: setup-beam
|
id: setup-beam
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
install-rebar: false
|
||||||
version-file: test/.tool-versions
|
version-file: test/.tool-versions
|
||||||
version-type: strict
|
version-type: strict
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- '*'
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -53,10 +53,6 @@ jobs:
|
|||||||
elixir-version: '1.16'
|
elixir-version: '1.16'
|
||||||
rebar3-version: '3'
|
rebar3-version: '3'
|
||||||
os: 'ubuntu-22.04'
|
os: 'ubuntu-22.04'
|
||||||
- otp-version: '24'
|
|
||||||
elixir-version: '1.16'
|
|
||||||
rebar3-version: '3'
|
|
||||||
os: 'ubuntu-22.04'
|
|
||||||
- otp-version: '25.0'
|
- otp-version: '25.0'
|
||||||
elixir-version: 'v1.13.4-otp-25'
|
elixir-version: 'v1.13.4-otp-25'
|
||||||
rebar3-version: '3.18.0'
|
rebar3-version: '3.18.0'
|
||||||
@@ -121,7 +117,7 @@ jobs:
|
|||||||
otp-version: false
|
otp-version: false
|
||||||
os: 'ubuntu-latest'
|
os: 'ubuntu-latest'
|
||||||
disable_problem_matchers: true
|
disable_problem_matchers: true
|
||||||
- gleam-version: '0.22.0' # Version with Gleam's old archive naming convention
|
- gleam-version: '0.22.0' # Version with Gleam's old archive naming convention
|
||||||
otp-version: '24'
|
otp-version: '24'
|
||||||
os: 'ubuntu-latest'
|
os: 'ubuntu-latest'
|
||||||
disable_problem_matchers: true
|
disable_problem_matchers: true
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ jobs:
|
|||||||
- otp-version: '24.0.2'
|
- otp-version: '24.0.2'
|
||||||
rebar3-version: '3.16'
|
rebar3-version: '3.16'
|
||||||
os: 'windows-2019'
|
os: 'windows-2019'
|
||||||
- otp-version: '26.2.5'
|
- otp-version: '26.1'
|
||||||
rebar3-version: 'nightly'
|
rebar3-version: 'nightly'
|
||||||
os: 'windows-2019'
|
os: 'windows-2019'
|
||||||
- otp-version: '23.0'
|
- otp-version: '23.0'
|
||||||
|
|||||||
+2
-2
@@ -3201,11 +3201,11 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
The following software may be included in this product: ms. A copy of the source code may be downloaded from https://github.com/zeit/ms.git. This software contains the following license and notice below:
|
The following software may be included in this product: ms. A copy of the source code may be downloaded from https://github.com/vercel/ms.git. This software contains the following license and notice below:
|
||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 Zeit, Inc.
|
Copyright (c) 2020 Vercel, Inc.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -153,110 +153,7 @@ with the following correspondence.
|
|||||||
| `gleam-version` | `gleam`
|
| `gleam-version` | `gleam`
|
||||||
| `rebar3-version` | `rebar`
|
| `rebar3-version` | `rebar`
|
||||||
|
|
||||||
### Example (Erlang/OTP + Elixir, on Ubuntu)
|
### Alternative hex.pm mirrors
|
||||||
|
|
||||||
```yaml
|
|
||||||
# create this in .github/workflows/ci.yml
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
otp: ['21.1', '22.2', '23.3']
|
|
||||||
elixir: ['1.8.2', '1.9.4']
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
otp-version: ${{matrix.otp}}
|
|
||||||
elixir-version: ${{matrix.elixir}}
|
|
||||||
- run: mix deps.get
|
|
||||||
- run: mix test
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example (Erlang/OTP + `rebar3`, on Ubuntu)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# create this in .github/workflows/ci.yml
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
name: Erlang/OTP ${{matrix.otp}} / rebar3 ${{matrix.rebar3}}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
otp: ['21.1', '22.2', '23.3']
|
|
||||||
rebar3: ['3.14.1', '3.14.3']
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
otp-version: ${{matrix.otp}}
|
|
||||||
rebar3-version: ${{matrix.rebar3}}
|
|
||||||
- run: rebar3 ct
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example (Erlang/OTP + `rebar3`, on Windows)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# create this in .github/workflows/ci.yml
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: windows-2022
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
otp-version: '24'
|
|
||||||
rebar3-version: '3.16.1'
|
|
||||||
- run: rebar3 ct
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example (Gleam on Ubuntu)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# create this in .github/workflows/ci.yml
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
otp-version: '24'
|
|
||||||
gleam-version: '0.23.0-rc1'
|
|
||||||
- run: gleam test
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example (Gleam on Ubuntu without OTP)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# create this in .github/workflows/ci.yml
|
|
||||||
on: push
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: erlef/setup-beam@v1
|
|
||||||
with:
|
|
||||||
otp-version: false
|
|
||||||
gleam-version: '0.23.0-rc1'
|
|
||||||
- run: gleam check
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note**: the `otp-version: false` input is only applicable when installing Gleam.
|
|
||||||
|
|
||||||
## Alternative hex.pm mirrors
|
|
||||||
|
|
||||||
It is possible to use alternative hex.pm mirror(s), in their declared order, with
|
It is possible to use alternative hex.pm mirror(s), in their declared order, with
|
||||||
option `hexpm-mirrors`. By default, the action will use `builds.hex.pm`.
|
option `hexpm-mirrors`. By default, the action will use `builds.hex.pm`.
|
||||||
@@ -297,7 +194,7 @@ jobs:
|
|||||||
https://cdn.jsdelivr.net/hex
|
https://cdn.jsdelivr.net/hex
|
||||||
```
|
```
|
||||||
|
|
||||||
## Environment variables
|
### Environment variables
|
||||||
|
|
||||||
Base installation folders (useful for e.g. fetching headers for NIFs) are available in the following
|
Base installation folders (useful for e.g. fetching headers for NIFs) are available in the following
|
||||||
environment variables:
|
environment variables:
|
||||||
@@ -310,13 +207,120 @@ environment variables:
|
|||||||
In each of these you'll find folder `bin` where the appropriate binaries, platform-dependant,
|
In each of these you'll find folder `bin` where the appropriate binaries, platform-dependant,
|
||||||
are found (i.e. `erl`, `erl.exe`, `rebar3`, `rebar3.exe`, ...).
|
are found (i.e. `erl`, `erl.exe`, `rebar3`, `rebar3.exe`, ...).
|
||||||
|
|
||||||
## Elixir Problem Matchers
|
### Elixir Problem Matchers
|
||||||
|
|
||||||
The Elixir Problem Matchers in this repository are adapted from
|
The Elixir Problem Matchers in this repository are adapted from
|
||||||
[here](https://github.com/fr1zle/vscode-elixir/blob/45eddb589acd7ac98e0c7305d1c2b24668ca709a/package.json#L70-L118).
|
[here](https://github.com/fr1zle/vscode-elixir/blob/45eddb589acd7ac98e0c7305d1c2b24668ca709a/package.json#L70-L118).
|
||||||
See [MATCHER_NOTICE](MATCHER_NOTICE.md) for license details.
|
See [MATCHER_NOTICE](MATCHER_NOTICE.md) for license details.
|
||||||
|
|
||||||
## Action versioning
|
## Examples
|
||||||
|
|
||||||
|
### Erlang/OTP + Elixir, on Ubuntu
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# create this in .github/workflows/ci.yml
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
otp: ['21.1', '22.2', '23.3']
|
||||||
|
elixir: ['1.8.2', '1.9.4']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: ${{matrix.otp}}
|
||||||
|
elixir-version: ${{matrix.elixir}}
|
||||||
|
- run: mix deps.get
|
||||||
|
- run: mix test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Erlang/OTP + `rebar3`, on Ubuntu
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# create this in .github/workflows/ci.yml
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
name: Erlang/OTP ${{matrix.otp}} / rebar3 ${{matrix.rebar3}}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
otp: ['21.1', '22.2', '23.3']
|
||||||
|
rebar3: ['3.14.1', '3.14.3']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: ${{matrix.otp}}
|
||||||
|
rebar3-version: ${{matrix.rebar3}}
|
||||||
|
- run: rebar3 ct
|
||||||
|
```
|
||||||
|
|
||||||
|
### Erlang/OTP + `rebar3`, on Windows
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# create this in .github/workflows/ci.yml
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: windows-2022
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: '24'
|
||||||
|
rebar3-version: '3.16.1'
|
||||||
|
- run: rebar3 ct
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gleam on Ubuntu
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# create this in .github/workflows/ci.yml
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: '24'
|
||||||
|
gleam-version: '0.23.0-rc1'
|
||||||
|
- run: gleam test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gleam on Ubuntu without OTP
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# create this in .github/workflows/ci.yml
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: false
|
||||||
|
gleam-version: '0.23.0-rc1'
|
||||||
|
- run: gleam check
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: the `otp-version: false` input is only applicable when installing Gleam.
|
||||||
|
|
||||||
|
## The project
|
||||||
|
|
||||||
|
### Versioning
|
||||||
|
|
||||||
`setup-beam` has three version paths, described below, for example version `1.8.0`:
|
`setup-beam` has three version paths, described below, for example version `1.8.0`:
|
||||||
|
|
||||||
@@ -328,14 +332,18 @@ We make a real effort to not introduce incompatibilities without changing the ma
|
|||||||
version number. To be extra safe against changes causing issues in your CI you should specify
|
version number. To be extra safe against changes causing issues in your CI you should specify
|
||||||
an exact version with `@vx.y.z`.
|
an exact version with `@vx.y.z`.
|
||||||
|
|
||||||
## License
|
### License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT license](LICENSE.md).
|
The scripts and documentation in this project are released under the [MIT license](LICENSE.md).
|
||||||
|
|
||||||
## Contributing
|
### Contributing
|
||||||
|
|
||||||
Check out [this doc](CONTRIBUTING.md).
|
Check out [this doc](CONTRIBUTING.md).
|
||||||
|
|
||||||
## Current Status
|
### Code of Conduct
|
||||||
|
|
||||||
This action is in active development.
|
This project's code of conduct is made explicit in [CODE_OF_CONDUCT.md](https://github.com/erlef/setup-beam/blob/main/CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
This project's security policy is made explicit in [SECURITY.md](https://github.com/erlef/setup-beam/blob/main/SECURITY.md).
|
||||||
|
|||||||
Vendored
+57
-52
@@ -9106,12 +9106,13 @@ exports["default"] = _default;
|
|||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const { exec } = __nccwpck_require__(1514)
|
const { exec } = __nccwpck_require__(1514)
|
||||||
const tc = __nccwpck_require__(7784)
|
const tc = __nccwpck_require__(7784)
|
||||||
const http = __nccwpck_require__(6255)
|
|
||||||
const path = __nccwpck_require__(1017)
|
const path = __nccwpck_require__(1017)
|
||||||
const semver = __nccwpck_require__(1383)
|
const semver = __nccwpck_require__(1383)
|
||||||
const fs = __nccwpck_require__(7147)
|
const fs = __nccwpck_require__(7147)
|
||||||
const os = __nccwpck_require__(2037)
|
const os = __nccwpck_require__(2037)
|
||||||
|
|
||||||
|
const MAX_HTTP_RETRIES = 3
|
||||||
|
|
||||||
main().catch((err) => {
|
main().catch((err) => {
|
||||||
core.setFailed(err.message)
|
core.setFailed(err.message)
|
||||||
})
|
})
|
||||||
@@ -9154,7 +9155,7 @@ async function main() {
|
|||||||
await maybeInstallRebar3(rebar3Spec)
|
await maybeInstallRebar3(rebar3Spec)
|
||||||
|
|
||||||
// undefined is replaced by a function, post- main branch merge
|
// undefined is replaced by a function, post- main branch merge
|
||||||
const setupBeamVersion = '21a744d'
|
const setupBeamVersion = '1f578f0'
|
||||||
core.setOutput('setup-beam-version', setupBeamVersion)
|
core.setOutput('setup-beam-version', setupBeamVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9361,8 +9362,7 @@ async function getOTPVersions(osVersion) {
|
|||||||
hexMirrors: hexMirrorsInput(),
|
hexMirrors: hexMirrorsInput(),
|
||||||
actionTitle: `fetch ${originListing}`,
|
actionTitle: `fetch ${originListing}`,
|
||||||
action: async (hexMirror) => {
|
action: async (hexMirror) => {
|
||||||
const l = await get(`${hexMirror}${originListing}`, [null])
|
return get(`${hexMirror}${originListing}`, [])
|
||||||
return l
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
@@ -9389,7 +9389,7 @@ async function getOTPVersions(osVersion) {
|
|||||||
})
|
})
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
otpVersionsListings.forEach((otpVersionsListing) => {
|
otpVersionsListings.forEach((otpVersionsListing) => {
|
||||||
jsonParseAsList(otpVersionsListing)
|
otpVersionsListing
|
||||||
.map((x) => x.assets)
|
.map((x) => x.assets)
|
||||||
.flat()
|
.flat()
|
||||||
.filter((x) => x.name.match(/^otp_win64_.*.exe$/))
|
.filter((x) => x.name.match(/^otp_win64_.*.exe$/))
|
||||||
@@ -9413,8 +9413,7 @@ async function getElixirVersions() {
|
|||||||
hexMirrors: hexMirrorsInput(),
|
hexMirrors: hexMirrorsInput(),
|
||||||
actionTitle: `fetch ${originListing}`,
|
actionTitle: `fetch ${originListing}`,
|
||||||
action: async (hexMirror) => {
|
action: async (hexMirror) => {
|
||||||
const l = await get(`${hexMirror}${originListing}`, [null])
|
return get(`${hexMirror}${originListing}`, [])
|
||||||
return l
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const otpVersionsForElixirMap = {}
|
const otpVersionsForElixirMap = {}
|
||||||
@@ -9447,7 +9446,7 @@ async function getGleamVersions() {
|
|||||||
)
|
)
|
||||||
const gleamVersionsListing = {}
|
const gleamVersionsListing = {}
|
||||||
resultJSONs.forEach((resultJSON) => {
|
resultJSONs.forEach((resultJSON) => {
|
||||||
jsonParseAsList(resultJSON)
|
resultJSON
|
||||||
.map((x) => x.tag_name)
|
.map((x) => x.tag_name)
|
||||||
.forEach((ver) => {
|
.forEach((ver) => {
|
||||||
const gleamMatch = ver.match(/^v?([^ ]+)/)
|
const gleamMatch = ver.match(/^v?([^ ]+)/)
|
||||||
@@ -9466,7 +9465,7 @@ async function getRebar3Versions() {
|
|||||||
)
|
)
|
||||||
const rebar3VersionsListing = {}
|
const rebar3VersionsListing = {}
|
||||||
resultJSONs.forEach((resultJSON) => {
|
resultJSONs.forEach((resultJSON) => {
|
||||||
jsonParseAsList(resultJSON)
|
resultJSON
|
||||||
.map((x) => x.tag_name)
|
.map((x) => x.tag_name)
|
||||||
.forEach((ver) => {
|
.forEach((ver) => {
|
||||||
rebar3VersionsListing[ver] = ver
|
rebar3VersionsListing[ver] = ver
|
||||||
@@ -9536,6 +9535,8 @@ function getVersionFromSpec(spec0, versions0) {
|
|||||||
// If `version-type: strict` or version is RC, we obtain it directly
|
// If `version-type: strict` or version is RC, we obtain it directly
|
||||||
version = versions0[spec]
|
version = versions0[spec]
|
||||||
}
|
}
|
||||||
|
} else if (spec0 === 'latest') {
|
||||||
|
version = versions0[versions0.latest]
|
||||||
} else if (rangeMax !== null) {
|
} else if (rangeMax !== null) {
|
||||||
// Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest
|
// Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest
|
||||||
const thatVersion = spec
|
const thatVersion = spec
|
||||||
@@ -9604,7 +9605,7 @@ function isRC(ver) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isKnownBranch(ver) {
|
function isKnownBranch(ver) {
|
||||||
return ['main', 'master', 'maint', 'latest'].includes(ver)
|
return ['main', 'master', 'maint'].includes(ver)
|
||||||
}
|
}
|
||||||
|
|
||||||
function githubARMRunnerArchs() {
|
function githubARMRunnerArchs() {
|
||||||
@@ -9658,38 +9659,56 @@ function getRunnerOSVersion() {
|
|||||||
return containerFromEnvImageOS
|
return containerFromEnvImageOS
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get(url0, pageIdxs) {
|
async function getUrlResponse(url, headers, attempt = 1) {
|
||||||
async function getPage(pageIdx) {
|
try {
|
||||||
const url = new URL(url0)
|
const response = await fetch(url, {
|
||||||
const headers = {}
|
headers,
|
||||||
const GithubToken = getInput('github-token', false)
|
signal: AbortSignal.timeout(10000),
|
||||||
if (GithubToken && url.host === 'api.github.com') {
|
|
||||||
headers.authorization = `Bearer ${GithubToken}`
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pageIdx !== null) {
|
|
||||||
url.searchParams.append('page', pageIdx)
|
|
||||||
}
|
|
||||||
|
|
||||||
const httpClient = new http.HttpClient('setup-beam', [], {
|
|
||||||
allowRetries: true,
|
|
||||||
maxRetries: 3,
|
|
||||||
})
|
})
|
||||||
const response = await httpClient.get(url, headers)
|
const contentType = response.headers.get('content-type') || ''
|
||||||
if (response.statusCode >= 400 && response.statusCode <= 599) {
|
|
||||||
throw new Error(
|
if (!response.ok) {
|
||||||
`Got ${response.statusCode} from ${url}. Exiting with error`,
|
throw new Error(response.statusText)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.readBody()
|
if (contentType.indexOf('application/json') !== -1) {
|
||||||
|
return response.json()
|
||||||
|
} else {
|
||||||
|
return response.text()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(`Error fetching from ${url}: ${err}`)
|
||||||
|
|
||||||
|
if (attempt <= MAX_HTTP_RETRIES) {
|
||||||
|
const delay = attempt * 2 * 1000
|
||||||
|
core.debug(`Error during fetch. Retrying in ${delay}ms`)
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, delay))
|
||||||
|
return getUrlResponse(url, headers, attempt + 1)
|
||||||
|
} else {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function get(url0, pageIdxs) {
|
||||||
|
const url = new URL(url0)
|
||||||
|
const headers = {}
|
||||||
|
const GithubToken = getInput('github-token', false)
|
||||||
|
if (GithubToken && url.host === 'api.github.com') {
|
||||||
|
headers.authorization = `Bearer ${GithubToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pageIdxs[0] === null) {
|
if (pageIdxs.length === 0) {
|
||||||
return getPage(null)
|
return getUrlResponse(url, headers)
|
||||||
|
} else {
|
||||||
|
return Promise.all(
|
||||||
|
pageIdxs.map((page) => {
|
||||||
|
const urlWithPage = new URL(url)
|
||||||
|
urlWithPage.searchParams.append('page', page)
|
||||||
|
return getUrlResponse(urlWithPage, headers)
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(pageIdxs.map(getPage))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybePrependWithV(v) {
|
function maybePrependWithV(v) {
|
||||||
@@ -9784,21 +9803,6 @@ function parseVersionFile(versionFilePath0) {
|
|||||||
return appVersions
|
return appVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonParseAsList(maybeJson) {
|
|
||||||
try {
|
|
||||||
const obj = JSON.parse(maybeJson)
|
|
||||||
if (!Array.isArray(obj)) {
|
|
||||||
throw new Error('expected a list!')
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj
|
|
||||||
} catch (exc) {
|
|
||||||
throw new Error(
|
|
||||||
`Got an exception when trying to parse non-JSON list ${maybeJson}: ${exc}`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function debugLog(groupName, message) {
|
function debugLog(groupName, message) {
|
||||||
const group = `Debugging for ${groupName}`
|
const group = `Debugging for ${groupName}`
|
||||||
core.debug(
|
core.debug(
|
||||||
@@ -10036,7 +10040,7 @@ async function install(toolName, opts) {
|
|||||||
const bindir = path.join(cachePath, 'bin')
|
const bindir = path.join(cachePath, 'bin')
|
||||||
const oldPath = path.join(cachePath, 'rebar3')
|
const oldPath = path.join(cachePath, 'rebar3')
|
||||||
const newPath = path.join(bindir, 'rebar3')
|
const newPath = path.join(bindir, 'rebar3')
|
||||||
fs.mkdirSync(bindir)
|
fs.mkdirSync(bindir, { recursive: true })
|
||||||
fs.renameSync(oldPath, newPath)
|
fs.renameSync(oldPath, newPath)
|
||||||
fs.chmodSync(newPath, 0o755)
|
fs.chmodSync(newPath, 0o755)
|
||||||
},
|
},
|
||||||
@@ -10156,6 +10160,7 @@ function debugLoggingEnabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
get,
|
||||||
getOTPVersion,
|
getOTPVersion,
|
||||||
getElixirVersion,
|
getElixirVersion,
|
||||||
getGleamVersion,
|
getGleamVersion,
|
||||||
|
|||||||
Generated
-1
@@ -9,7 +9,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.10.0",
|
"@actions/core": "1.10.0",
|
||||||
"@actions/exec": "1.1.1",
|
"@actions/exec": "1.1.1",
|
||||||
"@actions/http-client": "2.1.0",
|
|
||||||
"@actions/tool-cache": "2.0.1",
|
"@actions/tool-cache": "2.0.1",
|
||||||
"semver": "7.6.2"
|
"semver": "7.6.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.10.0",
|
"@actions/core": "1.10.0",
|
||||||
"@actions/exec": "1.1.1",
|
"@actions/exec": "1.1.1",
|
||||||
"@actions/http-client": "2.1.0",
|
|
||||||
"@actions/tool-cache": "2.0.1",
|
"@actions/tool-cache": "2.0.1",
|
||||||
"semver": "7.6.2"
|
"semver": "7.6.2"
|
||||||
},
|
},
|
||||||
|
|||||||
+57
-52
@@ -1,12 +1,13 @@
|
|||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const { exec } = require('@actions/exec')
|
const { exec } = require('@actions/exec')
|
||||||
const tc = require('@actions/tool-cache')
|
const tc = require('@actions/tool-cache')
|
||||||
const http = require('@actions/http-client')
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
|
||||||
|
const MAX_HTTP_RETRIES = 3
|
||||||
|
|
||||||
main().catch((err) => {
|
main().catch((err) => {
|
||||||
core.setFailed(err.message)
|
core.setFailed(err.message)
|
||||||
})
|
})
|
||||||
@@ -49,7 +50,7 @@ async function main() {
|
|||||||
await maybeInstallRebar3(rebar3Spec)
|
await maybeInstallRebar3(rebar3Spec)
|
||||||
|
|
||||||
// undefined is replaced by a function, post- main branch merge
|
// undefined is replaced by a function, post- main branch merge
|
||||||
const setupBeamVersion = '21a744d'
|
const setupBeamVersion = '1f578f0'
|
||||||
core.setOutput('setup-beam-version', setupBeamVersion)
|
core.setOutput('setup-beam-version', setupBeamVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,8 +262,7 @@ async function getOTPVersions(osVersion) {
|
|||||||
hexMirrors: hexMirrorsInput(),
|
hexMirrors: hexMirrorsInput(),
|
||||||
actionTitle: `fetch ${originListing}`,
|
actionTitle: `fetch ${originListing}`,
|
||||||
action: async (hexMirror) => {
|
action: async (hexMirror) => {
|
||||||
const l = await get(`${hexMirror}${originListing}`, [null])
|
return get(`${hexMirror}${originListing}`, [])
|
||||||
return l
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
@@ -289,7 +289,7 @@ async function getOTPVersions(osVersion) {
|
|||||||
})
|
})
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
otpVersionsListings.forEach((otpVersionsListing) => {
|
otpVersionsListings.forEach((otpVersionsListing) => {
|
||||||
jsonParseAsList(otpVersionsListing)
|
otpVersionsListing
|
||||||
.map((x) => x.assets)
|
.map((x) => x.assets)
|
||||||
.flat()
|
.flat()
|
||||||
.filter((x) => x.name.match(/^otp_win64_.*.exe$/))
|
.filter((x) => x.name.match(/^otp_win64_.*.exe$/))
|
||||||
@@ -313,8 +313,7 @@ async function getElixirVersions() {
|
|||||||
hexMirrors: hexMirrorsInput(),
|
hexMirrors: hexMirrorsInput(),
|
||||||
actionTitle: `fetch ${originListing}`,
|
actionTitle: `fetch ${originListing}`,
|
||||||
action: async (hexMirror) => {
|
action: async (hexMirror) => {
|
||||||
const l = await get(`${hexMirror}${originListing}`, [null])
|
return get(`${hexMirror}${originListing}`, [])
|
||||||
return l
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const otpVersionsForElixirMap = {}
|
const otpVersionsForElixirMap = {}
|
||||||
@@ -347,7 +346,7 @@ async function getGleamVersions() {
|
|||||||
)
|
)
|
||||||
const gleamVersionsListing = {}
|
const gleamVersionsListing = {}
|
||||||
resultJSONs.forEach((resultJSON) => {
|
resultJSONs.forEach((resultJSON) => {
|
||||||
jsonParseAsList(resultJSON)
|
resultJSON
|
||||||
.map((x) => x.tag_name)
|
.map((x) => x.tag_name)
|
||||||
.forEach((ver) => {
|
.forEach((ver) => {
|
||||||
const gleamMatch = ver.match(/^v?([^ ]+)/)
|
const gleamMatch = ver.match(/^v?([^ ]+)/)
|
||||||
@@ -366,7 +365,7 @@ async function getRebar3Versions() {
|
|||||||
)
|
)
|
||||||
const rebar3VersionsListing = {}
|
const rebar3VersionsListing = {}
|
||||||
resultJSONs.forEach((resultJSON) => {
|
resultJSONs.forEach((resultJSON) => {
|
||||||
jsonParseAsList(resultJSON)
|
resultJSON
|
||||||
.map((x) => x.tag_name)
|
.map((x) => x.tag_name)
|
||||||
.forEach((ver) => {
|
.forEach((ver) => {
|
||||||
rebar3VersionsListing[ver] = ver
|
rebar3VersionsListing[ver] = ver
|
||||||
@@ -436,6 +435,8 @@ function getVersionFromSpec(spec0, versions0) {
|
|||||||
// If `version-type: strict` or version is RC, we obtain it directly
|
// If `version-type: strict` or version is RC, we obtain it directly
|
||||||
version = versions0[spec]
|
version = versions0[spec]
|
||||||
}
|
}
|
||||||
|
} else if (spec0 === 'latest') {
|
||||||
|
version = versions0[versions0.latest]
|
||||||
} else if (rangeMax !== null) {
|
} else if (rangeMax !== null) {
|
||||||
// Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest
|
// Otherwise, we compare alt. versions' semver ranges to this version, from highest to lowest
|
||||||
const thatVersion = spec
|
const thatVersion = spec
|
||||||
@@ -504,7 +505,7 @@ function isRC(ver) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isKnownBranch(ver) {
|
function isKnownBranch(ver) {
|
||||||
return ['main', 'master', 'maint', 'latest'].includes(ver)
|
return ['main', 'master', 'maint'].includes(ver)
|
||||||
}
|
}
|
||||||
|
|
||||||
function githubARMRunnerArchs() {
|
function githubARMRunnerArchs() {
|
||||||
@@ -558,38 +559,56 @@ function getRunnerOSVersion() {
|
|||||||
return containerFromEnvImageOS
|
return containerFromEnvImageOS
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get(url0, pageIdxs) {
|
async function getUrlResponse(url, headers, attempt = 1) {
|
||||||
async function getPage(pageIdx) {
|
try {
|
||||||
const url = new URL(url0)
|
const response = await fetch(url, {
|
||||||
const headers = {}
|
headers,
|
||||||
const GithubToken = getInput('github-token', false)
|
signal: AbortSignal.timeout(10000),
|
||||||
if (GithubToken && url.host === 'api.github.com') {
|
|
||||||
headers.authorization = `Bearer ${GithubToken}`
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pageIdx !== null) {
|
|
||||||
url.searchParams.append('page', pageIdx)
|
|
||||||
}
|
|
||||||
|
|
||||||
const httpClient = new http.HttpClient('setup-beam', [], {
|
|
||||||
allowRetries: true,
|
|
||||||
maxRetries: 3,
|
|
||||||
})
|
})
|
||||||
const response = await httpClient.get(url, headers)
|
const contentType = response.headers.get('content-type') || ''
|
||||||
if (response.statusCode >= 400 && response.statusCode <= 599) {
|
|
||||||
throw new Error(
|
if (!response.ok) {
|
||||||
`Got ${response.statusCode} from ${url}. Exiting with error`,
|
throw new Error(response.statusText)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.readBody()
|
if (contentType.indexOf('application/json') !== -1) {
|
||||||
|
return response.json()
|
||||||
|
} else {
|
||||||
|
return response.text()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
core.debug(`Error fetching from ${url}: ${err}`)
|
||||||
|
|
||||||
|
if (attempt <= MAX_HTTP_RETRIES) {
|
||||||
|
const delay = attempt * 2 * 1000
|
||||||
|
core.debug(`Error during fetch. Retrying in ${delay}ms`)
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, delay))
|
||||||
|
return getUrlResponse(url, headers, attempt + 1)
|
||||||
|
} else {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function get(url0, pageIdxs) {
|
||||||
|
const url = new URL(url0)
|
||||||
|
const headers = {}
|
||||||
|
const GithubToken = getInput('github-token', false)
|
||||||
|
if (GithubToken && url.host === 'api.github.com') {
|
||||||
|
headers.authorization = `Bearer ${GithubToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pageIdxs[0] === null) {
|
if (pageIdxs.length === 0) {
|
||||||
return getPage(null)
|
return getUrlResponse(url, headers)
|
||||||
|
} else {
|
||||||
|
return Promise.all(
|
||||||
|
pageIdxs.map((page) => {
|
||||||
|
const urlWithPage = new URL(url)
|
||||||
|
urlWithPage.searchParams.append('page', page)
|
||||||
|
return getUrlResponse(urlWithPage, headers)
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(pageIdxs.map(getPage))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybePrependWithV(v) {
|
function maybePrependWithV(v) {
|
||||||
@@ -684,21 +703,6 @@ function parseVersionFile(versionFilePath0) {
|
|||||||
return appVersions
|
return appVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonParseAsList(maybeJson) {
|
|
||||||
try {
|
|
||||||
const obj = JSON.parse(maybeJson)
|
|
||||||
if (!Array.isArray(obj)) {
|
|
||||||
throw new Error('expected a list!')
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj
|
|
||||||
} catch (exc) {
|
|
||||||
throw new Error(
|
|
||||||
`Got an exception when trying to parse non-JSON list ${maybeJson}: ${exc}`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function debugLog(groupName, message) {
|
function debugLog(groupName, message) {
|
||||||
const group = `Debugging for ${groupName}`
|
const group = `Debugging for ${groupName}`
|
||||||
core.debug(
|
core.debug(
|
||||||
@@ -936,7 +940,7 @@ async function install(toolName, opts) {
|
|||||||
const bindir = path.join(cachePath, 'bin')
|
const bindir = path.join(cachePath, 'bin')
|
||||||
const oldPath = path.join(cachePath, 'rebar3')
|
const oldPath = path.join(cachePath, 'rebar3')
|
||||||
const newPath = path.join(bindir, 'rebar3')
|
const newPath = path.join(bindir, 'rebar3')
|
||||||
fs.mkdirSync(bindir)
|
fs.mkdirSync(bindir, { recursive: true })
|
||||||
fs.renameSync(oldPath, newPath)
|
fs.renameSync(oldPath, newPath)
|
||||||
fs.chmodSync(newPath, 0o755)
|
fs.chmodSync(newPath, 0o755)
|
||||||
},
|
},
|
||||||
@@ -1056,6 +1060,7 @@ function debugLoggingEnabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
get,
|
||||||
getOTPVersion,
|
getOTPVersion,
|
||||||
getElixirVersion,
|
getElixirVersion,
|
||||||
getGleamVersion,
|
getGleamVersion,
|
||||||
|
|||||||
+41
-11
@@ -7,6 +7,7 @@ simulateInput('github-token', process.env.GITHUB_TOKEN)
|
|||||||
simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })
|
simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true })
|
||||||
|
|
||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
|
const http = require('http')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
@@ -71,8 +72,8 @@ async function all() {
|
|||||||
await testRebar3Versions()
|
await testRebar3Versions()
|
||||||
|
|
||||||
await testGetVersionFromSpec()
|
await testGetVersionFromSpec()
|
||||||
|
|
||||||
await testParseVersionFile()
|
await testParseVersionFile()
|
||||||
|
await testGetRetry()
|
||||||
|
|
||||||
await testElixirMixCompileError()
|
await testElixirMixCompileError()
|
||||||
await testElixirMixCompileWarning()
|
await testElixirMixCompileWarning()
|
||||||
@@ -183,15 +184,17 @@ async function testOTPVersions() {
|
|||||||
expected = 'maint-26'
|
expected = 'maint-26'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '27.0'
|
spec = '27.0'
|
||||||
osVersion = 'ubuntu-24.04'
|
osVersion = 'ubuntu-24.04'
|
||||||
expected = 'OTP-27.0'
|
expected = 'OTP-27.0'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '25.3.2.1'
|
spec = '25.3.2.1'
|
||||||
osVersion = 'ubuntu-20.04'
|
osVersion = 'ubuntu-20.04'
|
||||||
expected = 'OTP-25.3.2.1'
|
expected = 'OTP-25.3.2.1'
|
||||||
@@ -308,15 +311,17 @@ async function testLinuxARM64OTPVersions() {
|
|||||||
expected = 'maint-26'
|
expected = 'maint-26'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '27.0'
|
spec = '27.0'
|
||||||
osVersion = 'ubuntu-24.04'
|
osVersion = 'ubuntu-24.04'
|
||||||
expected = 'OTP-27.0'
|
expected = 'OTP-27.0'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '25.3.2.1'
|
spec = '25.3.2.1'
|
||||||
osVersion = 'ubuntu-20.04'
|
osVersion = 'ubuntu-20.04'
|
||||||
expected = 'OTP-25.3.2.1'
|
expected = 'OTP-25.3.2.1'
|
||||||
@@ -393,22 +398,24 @@ async function testLinuxAMD64OTPVersions() {
|
|||||||
expected = 'maint-26'
|
expected = 'maint-26'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '27.0'
|
spec = '27.0'
|
||||||
osVersion = 'ubuntu-24.04'
|
osVersion = 'ubuntu-24.04'
|
||||||
expected = 'OTP-27.0'
|
expected = 'OTP-27.0'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
|
before = simulateInput('version-type', 'strict')
|
||||||
spec = '25.3.2.1'
|
spec = '25.3.2.1'
|
||||||
osVersion = 'ubuntu-20.04'
|
osVersion = 'ubuntu-20.04'
|
||||||
expected = 'OTP-25.3.2.1'
|
expected = 'OTP-25.3.2.1'
|
||||||
got = await setupBeam.getOTPVersion(spec, osVersion)
|
got = await setupBeam.getOTPVersion(spec, osVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
|
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
spec = '19.3.x'
|
spec = '19.3.x'
|
||||||
osVersion = 'ubuntu-16.04'
|
osVersion = 'ubuntu-16.04'
|
||||||
expected = 'OTP-19.3.6.13'
|
expected = 'OTP-19.3.6.13'
|
||||||
@@ -562,6 +569,7 @@ async function testElixirVersions() {
|
|||||||
got = await setupBeam.getElixirVersion(spec, otpVersion)
|
got = await setupBeam.getElixirVersion(spec, otpVersion)
|
||||||
assert.deepStrictEqual(got, expected)
|
assert.deepStrictEqual(got, expected)
|
||||||
simulateInput('version-type', before)
|
simulateInput('version-type', before)
|
||||||
|
|
||||||
simulateInput('hexpm-mirrors', hexMirrors, { multiline: true })
|
simulateInput('hexpm-mirrors', hexMirrors, { multiline: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,10 +871,10 @@ async function testParseVersionFile() {
|
|||||||
const gleamVersion = unsimulateInput('gleam-version')
|
const gleamVersion = unsimulateInput('gleam-version')
|
||||||
const rebar3Version = unsimulateInput('rebar3-version')
|
const rebar3Version = unsimulateInput('rebar3-version')
|
||||||
|
|
||||||
const erlang = '25.1.1'
|
const erlang = '27'
|
||||||
const elixir = '1.14.1'
|
const elixir = '1.17.0'
|
||||||
const gleam = '0.23.0'
|
const gleam = '0.23.0'
|
||||||
const rebar3 = '3.16.0'
|
const rebar3 = '3.24.0'
|
||||||
const toolVersions = `# a comment
|
const toolVersions = `# a comment
|
||||||
erlang ref:v${erlang}# comment, no space, and ref:v
|
erlang ref:v${erlang}# comment, no space, and ref:v
|
||||||
elixir ref:${elixir} # comment, with space and ref:
|
elixir ref:${elixir} # comment, with space and ref:
|
||||||
@@ -906,6 +914,28 @@ gleam ${gleam} \nrebar ${rebar3}`
|
|||||||
simulateInput('rebar3-version', rebar3Version)
|
simulateInput('rebar3-version', rebar3Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function testGetRetry() {
|
||||||
|
let attempt = 0
|
||||||
|
const server = http.createServer((req, res) => {
|
||||||
|
attempt++
|
||||||
|
if (attempt == 2) {
|
||||||
|
res.write('correct!')
|
||||||
|
res.end()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
server.listen(0)
|
||||||
|
const port = server.address().port
|
||||||
|
|
||||||
|
const response = await setupBeam.get(`http://localhost:${port}`, [])
|
||||||
|
assert.equal(response, 'correct!')
|
||||||
|
assert.equal(attempt, 2)
|
||||||
|
} finally {
|
||||||
|
server.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function testElixirMixCompileError() {
|
async function testElixirMixCompileError() {
|
||||||
const [matcher] = problemMatcher.find(
|
const [matcher] = problemMatcher.find(
|
||||||
({ owner }) => owner === 'elixir-mixCompileError',
|
({ owner }) => owner === 'elixir-mixCompileError',
|
||||||
|
|||||||
Reference in New Issue
Block a user