neiam
/action-setup-beam
action-setup-beam
public · Issues · Pulls · Labels · Forks · Compare · Actions queued
Log in to mark this repository.
Add Gleam (#67)
c988d89 · Paulo F. Oliveira · 2021-08-03 17:56
Files changed
modified
.github/workflows/ubuntu.yml
+18
−4
| 14 | 14 | name: > |
| 15 | 15 | OTP ${{matrix.combo.otp-version}}, |
| 16 | 16 | Elixir ${{matrix.combo.elixir-version}}, |
| 17 | + Gleam ${{matrix.combo.gleam-version}}, | |
| 17 | 18 | rebar3 ${{matrix.combo.rebar3-version}} |
| 18 | 19 | runs-on: ${{matrix.combo.os}} |
| 19 | 20 | strategy: |
| 106 | 107 | - elixir-version: 'master' |
| 107 | 108 | otp-version: '23.1' |
| 108 | 109 | os: 'ubuntu-20.04' |
| 110 | + - gleam-version: '0.16' | |
| 111 | + otp-version: '24' | |
| 112 | + rebar3-version: '3.16' | |
| 113 | + os: 'ubuntu-latest' | |
| 109 | 114 | steps: |
| 110 | 115 | - uses: actions/checkout@v2 |
| 111 | 116 | - name: Use erlef/setup-beam |
| 114 | 119 | with: |
| 115 | 120 | otp-version: ${{matrix.combo.otp-version}} |
| 116 | 121 | elixir-version: ${{matrix.combo.elixir-version}} |
| 122 | + gleam-version: ${{matrix.combo.gleam-version}} | |
| 117 | 123 | rebar3-version: ${{matrix.combo.rebar3-version}} |
| 118 | 124 | version-type: ${{matrix.combo.version-type}} |
| 119 | 125 | - name: Erlang/OTP version (action) |
| 121 | 127 | - name: Elixir version (action) |
| 122 | 128 | run: echo "Elixir ${{steps.setup-beam.outputs.elixir-version}}" |
| 123 | 129 | if: ${{matrix.combo.elixir-version}} |
| 130 | + - name: Gleam version (action) | |
| 131 | + run: echo "Gleam ${{steps.setup-beam.outputs.gleam-version}}" | |
| 132 | + if: ${{matrix.combo.gleam-version}} | |
| 124 | 133 | - name: rebar3 version (action) |
| 125 | 134 | run: echo "rebar3 ${{steps.setup-beam.outputs.rebar3-version}}" |
| 126 | 135 | if: ${{matrix.combo.rebar3-version}} |
| 130 | 139 | mix help local.rebar |
| 131 | 140 | mix help local.hex |
| 132 | 141 | if: ${{matrix.combo.elixir-version}} |
| 133 | − - name: Run Mix project tests | |
| 142 | + - name: Run Elixir/Mix project tests | |
| 134 | 143 | run: | |
| 135 | − cd test-projects/mix | |
| 144 | + cd test-projects/elixir_mix | |
| 136 | 145 | mix deps.get |
| 137 | 146 | mix test |
| 138 | 147 | if: ${{matrix.combo.elixir-version}} |
| 139 | − - name: Run rebar3 project tests | |
| 148 | + - name: Run Erlang/rebar3 project tests | |
| 140 | 149 | run: | |
| 141 | − cd test-projects/rebar3 | |
| 150 | + cd test-projects/erlang_rebar3 | |
| 142 | 151 | rebar3 ct |
| 143 | 152 | if: ${{matrix.combo.rebar3-version}} |
| 153 | + - name: Run Gleam/rebar3 project tests | |
| 154 | + run: | | |
| 155 | + cd test-projects/gleam_rebar3 | |
| 156 | + rebar3 eunit | |
| 157 | + if: ${{matrix.combo.gleam-version}} |
modified
.github/workflows/windows.yml
+18
−4
| 14 | 14 | name: > |
| 15 | 15 | OTP ${{matrix.combo.otp-version}}, |
| 16 | 16 | Elixir ${{matrix.combo.elixir-version}}, |
| 17 | + Gleam ${{matrix.combo.gleam-version}}, | |
| 17 | 18 | rebar3 ${{matrix.combo.rebar3-version}} |
| 18 | 19 | runs-on: ${{matrix.combo.os}} |
| 19 | 20 | strategy: |
| 52 | 53 | otp-version: '24' |
| 53 | 54 | rebar3-version: '3.15' |
| 54 | 55 | os: 'windows-latest' |
| 56 | + - gleam-version: '0.16' | |
| 57 | + otp-version: '24' | |
| 58 | + rebar3-version: '3.16' | |
| 59 | + os: 'windows-latest' | |
| 55 | 60 | steps: |
| 56 | 61 | - uses: actions/checkout@v2 |
| 57 | 62 | - name: Use erlef/setup-beam |
| 60 | 65 | with: |
| 61 | 66 | otp-version: ${{matrix.combo.otp-version}} |
| 62 | 67 | elixir-version: ${{matrix.combo.elixir-version}} |
| 68 | + gleam-version: ${{matrix.combo.gleam-version}} | |
| 63 | 69 | rebar3-version: ${{matrix.combo.rebar3-version}} |
| 64 | 70 | - name: Erlang/OTP version (action) |
| 65 | 71 | run: echo "Erlang/OTP ${{steps.setup-beam.outputs.otp-version}}" |
| 66 | 72 | - name: Elixir version (action) |
| 67 | 73 | run: echo "Elixir ${{steps.setup-beam.outputs.elixir-version}}" |
| 68 | 74 | if: ${{matrix.combo.elixir-version}} |
| 75 | + - name: Gleam version (action) | |
| 76 | + run: echo "Gleam ${{steps.setup-beam.outputs.gleam-version}}" | |
| 77 | + if: ${{matrix.combo.gleam-version}} | |
| 69 | 78 | - name: rebar3 version (action) |
| 70 | 79 | run: echo "rebar3 ${{steps.setup-beam.outputs.rebar3-version}}" |
| 71 | 80 | - name: mix version and help (CLI) |
| 74 | 83 | mix help local.rebar |
| 75 | 84 | mix help local.hex |
| 76 | 85 | if: ${{matrix.combo.elixir-version}} |
| 77 | − - name: Run Mix project tests | |
| 86 | + - name: Run Elixir/Mix project tests | |
| 78 | 87 | run: | |
| 79 | − cd test-projects/mix | |
| 88 | + cd test-projects/elixir_mix | |
| 80 | 89 | mix deps.get |
| 81 | 90 | mix test |
| 82 | 91 | if: ${{matrix.combo.elixir-version}} |
| 83 | − - name: Run rebar3 project tests | |
| 92 | + - name: Run Erlang/rebar3 project tests | |
| 84 | 93 | run: | |
| 85 | − cd test-projects/rebar3 | |
| 94 | + cd test-projects/erlang_rebar3 | |
| 86 | 95 | rebar3 ct |
| 87 | 96 | if: ${{matrix.combo.rebar3-version}} |
| 97 | + - name: Run Gleam/rebar3 project tests | |
| 98 | + run: | | |
| 99 | + cd test-projects/gleam_rebar3 | |
| 100 | + rebar3 eunit | |
| 101 | + if: ${{matrix.combo.gleam-version}} |
modified
3RD_PARTY_LICENSES
+1
−1
| 1810 | 1810 | |
| 1811 | 1811 | ----- |
| 1812 | 1812 | |
| 1813 | −The following software may be included in this product: has-bigints, unbox-primitive, which-boxed-primitive. A copy of the source code may be downloaded from git+https://github.com/ljharb/has-bigints.git (has-bigints), git+https://github.com/ljharb/unbox-primitive.git (unbox-primitive), git+https://github.com/inspect-js/which-boxed-primitive.git (which-boxed-primitive). This software contains the following license and notice below: | |
| 1813 | +The following software may be included in this product: has-bigints, internal-slot, side-channel, unbox-primitive, which-boxed-primitive. A copy of the source code may be downloaded from git+https://github.com/ljharb/has-bigints.git (has-bigints), git+https://github.com/ljharb/internal-slot.git (internal-slot), git+https://github.com/ljharb/side-channel.git (side-channel), git+https://github.com/ljharb/unbox-primitive.git (unbox-primitive), git+https://github.com/inspect-js/which-boxed-primitive.git (which-boxed-primitive). This software contains the following license and notice below: | |
| 1814 | 1814 | |
| 1815 | 1815 | MIT License |
| 1816 | 1816 |
modified
README.md
+25
−42
| 13 | 13 | |
| 14 | 14 | - installing Erlang/OTP |
| 15 | 15 | - optionally, installing Elixir |
| 16 | +- optionally, installing Gleam | |
| 16 | 17 | - optionally, installing `rebar3` |
| 17 | 18 | - optionally, installing `hex` |
| 18 | 19 |
| 24 | 25 | |
| 25 | 26 | **Note**: The Erlang/OTP release version specification is [relatively |
| 26 | 27 | complex](http://erlang.org/doc/system_principles/versions.html#version-scheme). |
| 27 | −For best results, we recommend specifying exact Erlang/OTP, Elixir versions, and | |
| 28 | −`rebar3` versions, and setting option `version-type` to `strict`. | |
| 28 | +For best results, we recommend specifying exact | |
| 29 | +versions, and setting option `version-type` to `strict`. | |
| 29 | 30 | However, values like `22.x`, or even `>22`, are also accepted, and we attempt to resolve them |
| 30 | 31 | according to semantic versioning rules. This implicitly means `version-type` is `loose`, |
| 31 | 32 | which is also the default value for this option. |
| 32 | 33 | |
| 33 | −Additionally, it is recommended that one specifies Erlang/OTP, Elixir and `rebar3` versions | |
| 34 | +Additionally, it is recommended that one specifies versions | |
| 34 | 35 | using YAML strings, as these examples do, so that numbers like `23.0` don't |
| 35 | 36 | end up being parsed as `23`, which is not equivalent. |
| 36 | 37 |
| 82 | 83 | ... |
| 83 | 84 | ``` |
| 84 | 85 | |
| 85 | −### Basic example (Erlang/OTP + Elixir, on Ubuntu) | |
| 86 | +### Example (Erlang/OTP + Elixir, on Ubuntu) | |
| 86 | 87 | |
| 87 | 88 | ```yaml |
| 88 | 89 | # create this in .github/workflows/ci.yml |
| 91 | 92 | jobs: |
| 92 | 93 | test: |
| 93 | 94 | runs-on: ubuntu-latest |
| 95 | + name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} | |
| 96 | + strategy: | |
| 97 | + matrix: | |
| 98 | + otp: ['20.3', '21.3', '22.2'] | |
| 99 | + elixir: ['1.8.2', '1.9.4'] | |
| 94 | 100 | steps: |
| 95 | 101 | - uses: actions/checkout@v2 |
| 96 | 102 | - uses: erlef/setup-beam@v1 |
| 97 | 103 | with: |
| 98 | − otp-version: '22.2' | |
| 99 | − elixir-version: '1.9.4' | |
| 104 | + otp-version: ${{matrix.otp}} | |
| 105 | + elixir-version: ${{matrix.elixir}} | |
| 100 | 106 | - run: mix deps.get |
| 101 | 107 | - run: mix test |
| 102 | 108 | ``` |
| 103 | 109 | |
| 104 | −### Basic example (Erlang/OTP + `rebar3`, on Ubuntu) | |
| 110 | +### Example (Erlang/OTP + `rebar3`, on Ubuntu) | |
| 105 | 111 | |
| 106 | 112 | ```yaml |
| 107 | 113 | # create this in .github/workflows/ci.yml |
| 110 | 116 | jobs: |
| 111 | 117 | test: |
| 112 | 118 | runs-on: ubuntu-latest |
| 113 | − steps: | |
| 114 | − - uses: actions/checkout@v2 | |
| 115 | − - uses: erlef/setup-beam@v1 | |
| 116 | − with: | |
| 117 | − otp-version: '22.2' | |
| 118 | − rebar3-version: '3.14.2' | |
| 119 | − - run: rebar3 ct | |
| 120 | −``` | |
| 121 | − | |
| 122 | −### Matrix example (Erlang/OTP + Elixir, on Ubuntu) | |
| 123 | − | |
| 124 | −```yaml | |
| 125 | −# create this in .github/workflows/ci.yml | |
| 126 | −on: push | |
| 127 | − | |
| 128 | −jobs: | |
| 129 | − test: | |
| 130 | − runs-on: ubuntu-latest | |
| 131 | − name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} | |
| 119 | + name: Erlang/OTP ${{matrix.otp}} / rebar3 ${{matrix.rebar3}} | |
| 132 | 120 | strategy: |
| 133 | 121 | matrix: |
| 134 | 122 | otp: ['20.3', '21.3', '22.2'] |
| 135 | − elixir: ['1.8.2', '1.9.4'] | |
| 123 | + rebar3: ['3.14.1', '3.14.3'] | |
| 136 | 124 | steps: |
| 137 | 125 | - uses: actions/checkout@v2 |
| 138 | 126 | - uses: erlef/setup-beam@v1 |
| 139 | 127 | with: |
| 140 | 128 | otp-version: ${{matrix.otp}} |
| 141 | − elixir-version: ${{matrix.elixir}} | |
| 142 | − - run: mix deps.get | |
| 143 | − - run: mix test | |
| 129 | + rebar3-version: ${{matrix.rebar3}} | |
| 130 | + - run: rebar3 ct | |
| 144 | 131 | ``` |
| 145 | 132 | |
| 146 | −### Matrix example (Erlang/OTP + `rebar3`, on Ubuntu) | |
| 133 | +### Example (Erlang/OTP + `rebar3`, on Windows) | |
| 147 | 134 | |
| 148 | 135 | ```yaml |
| 149 | 136 | # create this in .github/workflows/ci.yml |
| 151 | 138 | |
| 152 | 139 | jobs: |
| 153 | 140 | test: |
| 154 | − runs-on: ubuntu-latest | |
| 155 | − name: Erlang/OTP ${{matrix.otp}} / rebar3 ${{matrix.rebar3}} | |
| 156 | − strategy: | |
| 157 | − matrix: | |
| 158 | − otp: ['20.3', '21.3', '22.2'] | |
| 159 | − rebar3: ['3.14.1', '3.14.3'] | |
| 141 | + runs-on: windows-2019 | |
| 160 | 142 | steps: |
| 161 | 143 | - uses: actions/checkout@v2 |
| 162 | 144 | - uses: erlef/setup-beam@v1 |
| 163 | 145 | with: |
| 164 | − otp-version: ${{matrix.otp}} | |
| 165 | − rebar3-version: ${{matrix.rebar3}} | |
| 146 | + otp-version: '24' | |
| 147 | + rebar3-version: '3.16.1' | |
| 166 | 148 | - run: rebar3 ct |
| 167 | 149 | ``` |
| 168 | 150 | |
| 169 | −### Basic example (Erlang/OTP + `rebar3`, on Windows) | |
| 151 | +### Example (Gleam + `rebar3`, on Ubuntu) | |
| 170 | 152 | |
| 171 | 153 | ```yaml |
| 172 | 154 | # create this in .github/workflows/ci.yml |
| 174 | 156 | |
| 175 | 157 | jobs: |
| 176 | 158 | test: |
| 177 | − runs-on: windows-2019 | |
| 159 | + runs-on: ubuntu-latest | |
| 178 | 160 | steps: |
| 179 | 161 | - uses: actions/checkout@v2 |
| 180 | 162 | - uses: erlef/setup-beam@v1 |
| 181 | 163 | with: |
| 182 | 164 | otp-version: '24' |
| 183 | − rebar3-version: '3.16.1' | |
| 165 | + gleam-version: '0.16' | |
| 166 | + rebar3-version: '3.16' | |
| 184 | 167 | - run: rebar3 ct |
| 185 | 168 | ``` |
| 186 | 169 |
modified
__tests__/setup-beam.test.js
+43
−0
| 11 | 11 | async function all() { |
| 12 | 12 | await testFailInstallOTP() |
| 13 | 13 | await testFailInstallElixir() |
| 14 | + await testFailInstallGleam() | |
| 14 | 15 | await testFailInstallRebar3() |
| 15 | 16 | |
| 16 | 17 | await testOTPVersions() |
| 17 | 18 | await testElixirVersions() |
| 19 | + await testGleamVersions() | |
| 18 | 20 | await testRebar3Versions() |
| 19 | 21 | |
| 20 | 22 | await testGetVersionFromSpec() |
| 63 | 65 | ) |
| 64 | 66 | } |
| 65 | 67 | |
| 68 | +async function testFailInstallGleam() { | |
| 69 | + const gleamVersion = '0.1.3' | |
| 70 | + assert.rejects( | |
| 71 | + async () => { | |
| 72 | + await installer.installGleam(gleamVersion) | |
| 73 | + }, | |
| 74 | + (err) => { | |
| 75 | + assert.ok(err instanceof Error) | |
| 76 | + return true | |
| 77 | + }, | |
| 78 | + `Installing Gleam ${gleamVersion} is supposed to fail`, | |
| 79 | + ) | |
| 80 | +} | |
| 81 | + | |
| 66 | 82 | async function testFailInstallRebar3() { |
| 67 | 83 | const r3Version = '0.14.4' |
| 68 | 84 | assert.rejects( |
| 197 | 213 | simulateInput('version-type', 'loose') |
| 198 | 214 | } |
| 199 | 215 | |
| 216 | +async function testGleamVersions() { | |
| 217 | + let got | |
| 218 | + let expected | |
| 219 | + let spec | |
| 220 | + let otpVersion | |
| 221 | + | |
| 222 | + spec = 'v0.3.0' | |
| 223 | + otpVersion = 'OTP-23' | |
| 224 | + expected = 'v0.3.0' | |
| 225 | + got = await setupBeam.getGleamVersion(spec, otpVersion) | |
| 226 | + assert.deepStrictEqual(got, expected) | |
| 227 | + | |
| 228 | + spec = '0.13.2' | |
| 229 | + otpVersion = 'OTP-24' | |
| 230 | + expected = 'v0.13.2' | |
| 231 | + got = await setupBeam.getGleamVersion(spec, otpVersion) | |
| 232 | + assert.deepStrictEqual(got, expected) | |
| 233 | + | |
| 234 | + simulateInput('version-type', 'strict') | |
| 235 | + spec = 'v0.14.0-rc2' | |
| 236 | + otpVersion = 'OTP-22' | |
| 237 | + expected = 'v0.14.0-rc2' | |
| 238 | + got = await setupBeam.getGleamVersion(spec, otpVersion) | |
| 239 | + assert.deepStrictEqual(got, expected) | |
| 240 | + simulateInput('version-type', 'loose') | |
| 241 | +} | |
| 242 | + | |
| 200 | 243 | async function testRebar3Versions() { |
| 201 | 244 | let got |
| 202 | 245 | let expected |
modified
action.yml
+4
−0
Click to load diff…
modified
dist/index.js
+75
−5
Click to load diff…
modified
dist/install-elixir.ps1
+1
−1
Click to load diff…
added
dist/install-gleam.ps1
+19
−0
Click to load diff…
added
dist/install-gleam.sh
+17
−0
Click to load diff…
modified
src/install-elixir.ps1
+1
−1
Click to load diff…
added
src/install-gleam.ps1
+19
−0
Click to load diff…
added
src/install-gleam.sh
+17
−0
Click to load diff…
modified
src/installer.js
+16
−0
Click to load diff…
modified
src/setup-beam.js
+59
−5
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
renamed
+0
−0
Click to load diff…
added
test-projects/gleam_rebar3/.github/workflows/test.yml
+23
−0
Click to load diff…
added
test-projects/gleam_rebar3/.gitignore
+21
−0
Click to load diff…
added
test-projects/gleam_rebar3/README.md
+24
−0
Click to load diff…
added
test-projects/gleam_rebar3/gleam.toml
+3
−0
Click to load diff…
added
test-projects/gleam_rebar3/rebar.config
+12
−0
Click to load diff…
added
test-projects/gleam_rebar3/src/gleam_rebar3.app.src
+15
−0
Click to load diff…
added
test-projects/gleam_rebar3/src/gleam_rebar3.gleam
+3
−0
Click to load diff…
added
test-projects/gleam_rebar3/test/gleam_rebar3_test.gleam
+7
−0
Click to load diff…
Parents: 4fbbcf2