neiam /action-setup-beam
action-setup-beam
public · Issues · Pulls · Labels · Forks · Compare · Actions queued
⭐
Log in to mark this repository.
Ease Elixir escripts execution by adding ${HOME}/.mix/escripts to path (#153)
b980a5a · Blake Kostner · 2022-11-22 22:39
Message
{commit_body(@commit)}
Files changed
modified
.github/workflows/ubuntu.yml
+10
−0
@@ -134,6 +134,11 @@ jobs:
| 134 | 134 | otp-version: '24' |
| 135 | 135 | os: 'ubuntu-latest' |
| 136 | 136 | disable_problem_matchers: true |
| 137 | + - elixir-version: 'v1.13' | |
| 138 | + otp-version: '24' | |
| 139 | + escript_packages: 'hex protobuf' | |
| 140 | + escript_script: 'protoc-gen-elixir --version' | |
| 141 | + os: 'ubuntu-latest' | |
| 137 | 142 | steps: |
| 138 | 143 | - uses: actions/checkout@v3 |
| 139 | 144 | - name: Use erlef/setup-beam |
@@ -184,6 +189,11 @@ jobs:
| 184 | 189 | cd test-projects/gleam_gleam |
| 185 | 190 | gleam test |
| 186 | 191 | if: ${{ matrix.combo.gleam-version && matrix.combo.otp-version && !matrix.combo.rebar3-version }} |
| 192 | + - name: Run escript | |
| 193 | + run: | | |
| 194 | + mix escript.install --force ${{matrix.combo.escript_packages}} | |
| 195 | + ${{matrix.combo.escript_script}} | |
| 196 | + if: ${{matrix.combo.escript_packages && matrix.combo.escript_script}} | |
| 187 | 197 | environment_variables: |
| 188 | 198 | name: Environment variables |
| 189 | 199 | runs-on: ${{matrix.combo.os}} |
modified
.github/workflows/windows.yml
+10
−0
@@ -45,6 +45,11 @@ jobs:
| 45 | 45 | otp-version: '24' |
| 46 | 46 | rebar3-version: '3.16' |
| 47 | 47 | os: 'windows-latest' |
| 48 | + - elixir-version: 'v1.13' | |
| 49 | + otp-version: '24' | |
| 50 | + escript_packages: 'hex protobuf' | |
| 51 | + escript_script: 'protoc-gen-elixir --version' | |
| 52 | + os: 'windows-latest' | |
| 48 | 53 | steps: |
| 49 | 54 | - uses: actions/checkout@v3 |
| 50 | 55 | - name: Use erlef/setup-beam |
@@ -82,6 +87,11 @@ jobs:
| 82 | 87 | cd test-projects/erlang_rebar3 |
| 83 | 88 | rebar3 ct |
| 84 | 89 | if: ${{matrix.combo.rebar3-version}} |
| 90 | + - name: Run escript | |
| 91 | + run: | | |
| 92 | + mix escript.install --force ${{matrix.combo.escript_packages}} | |
| 93 | + ${{matrix.combo.escript_script}} | |
| 94 | + if: ${{matrix.combo.escript_packages && matrix.combo.escript_script}} | |
| 85 | 95 | environment_variables: |
| 86 | 96 | name: Environment variables |
| 87 | 97 | runs-on: ${{matrix.combo.os}} |
modified
dist/index.js
+2
−0
@@ -7193,6 +7193,7 @@ module.exports = {
| 7193 | 7193 | |
| 7194 | 7194 | const core = __nccwpck_require__(2186) |
| 7195 | 7195 | const { exec } = __nccwpck_require__(1514) |
| 7196 | +const os = __nccwpck_require__(2037) | |
| 7196 | 7197 | const path = __nccwpck_require__(1017) |
| 7197 | 7198 | const semver = __nccwpck_require__(1383) |
| 7198 | 7199 | const https = __nccwpck_require__(5687) |
@@ -7269,6 +7270,7 @@ async function maybeInstallElixir(elixirSpec, otpVersion) {
| 7269 | 7270 | `##[add-matcher]${path.join(matchersPath, 'elixir-matchers.json')}`, |
| 7270 | 7271 | ) |
| 7271 | 7272 | } |
| 7273 | + core.addPath(`${os.homedir()}/.mix/escripts`) | |
| 7272 | 7274 | core.addPath(`${process.env.RUNNER_TEMP}/.setup-beam/elixir/bin`) |
| 7273 | 7275 | console.log('##[endgroup]') |
| 7274 | 7276 |
modified
dist/install-elixir.ps1
+3
−0
@@ -18,4 +18,7 @@ $ProgressPreference="Continue"
| 18 | 18 | Write-Output "Installed Elixir version follows" |
| 19 | 19 | & "${DIR_FOR_BIN}/bin/elixir" "-v" | Write-Output |
| 20 | 20 | |
| 21 | +$ProgressPreference="Continue" | |
| 22 | +New-Item "%UserProfile%/.mix/escripts" -ItemType Directory | Out-Null | |
| 23 | + | |
| 21 | 24 | "INSTALL_DIR_FOR_ELIXIR=${Env:RUNNER_TEMP}/${DIR_FOR_BIN}" | Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append |
modified
dist/install-elixir.sh
+2
−0
@@ -15,4 +15,6 @@ unzip -q -o -d "${DIR_FOR_BIN}" "${FILE_OUTPUT}"
| 15 | 15 | echo "Installed Elixir version follows" |
| 16 | 16 | ${DIR_FOR_BIN}/bin/elixir -v |
| 17 | 17 | |
| 18 | +mkdir -p "${HOME}/.mix/escripts" | |
| 19 | + | |
| 18 | 20 | echo "INSTALL_DIR_FOR_ELIXIR=${RUNNER_TEMP}/${DIR_FOR_BIN}" >> "${GITHUB_ENV}" |
modified
src/install-elixir.ps1
+3
−0
@@ -18,4 +18,7 @@ $ProgressPreference="Continue"
| 18 | 18 | Write-Output "Installed Elixir version follows" |
| 19 | 19 | & "${DIR_FOR_BIN}/bin/elixir" "-v" | Write-Output |
| 20 | 20 | |
| 21 | +$ProgressPreference="Continue" | |
| 22 | +New-Item "%UserProfile%/.mix/escripts" -ItemType Directory | Out-Null | |
| 23 | + | |
| 21 | 24 | "INSTALL_DIR_FOR_ELIXIR=${Env:RUNNER_TEMP}/${DIR_FOR_BIN}" | Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append |
modified
src/install-elixir.sh
+2
−0
@@ -15,4 +15,6 @@ unzip -q -o -d "${DIR_FOR_BIN}" "${FILE_OUTPUT}"
| 15 | 15 | echo "Installed Elixir version follows" |
| 16 | 16 | ${DIR_FOR_BIN}/bin/elixir -v |
| 17 | 17 | |
| 18 | +mkdir -p "${HOME}/.mix/escripts" | |
| 19 | + | |
| 18 | 20 | echo "INSTALL_DIR_FOR_ELIXIR=${RUNNER_TEMP}/${DIR_FOR_BIN}" >> "${GITHUB_ENV}" |
modified
src/setup-beam.js
+2
−0
@@ -1,5 +1,6 @@
| 1 | 1 | const core = require('@actions/core') |
| 2 | 2 | const { exec } = require('@actions/exec') |
| 3 | +const os = require('os') | |
| 3 | 4 | const path = require('path') |
| 4 | 5 | const semver = require('semver') |
| 5 | 6 | const https = require('https') |
@@ -76,6 +77,7 @@ async function maybeInstallElixir(elixirSpec, otpVersion) {
| 76 | 77 | `##[add-matcher]${path.join(matchersPath, 'elixir-matchers.json')}`, |
| 77 | 78 | ) |
| 78 | 79 | } |
| 80 | + core.addPath(`${os.homedir()}/.mix/escripts`) | |
| 79 | 81 | core.addPath(`${process.env.RUNNER_TEMP}/.setup-beam/elixir/bin`) |
| 80 | 82 | console.log('##[endgroup]') |
| 81 | 83 |
Parents: c373088