Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67712d1715 | ||
|
|
1aaf342d27 | ||
|
|
6cbe4330ba | ||
|
|
033ba30590 | ||
|
|
3f153648ab | ||
|
|
05577888e7 | ||
|
|
064e705074 | ||
|
|
d06444e488 | ||
|
|
5b8160c641 | ||
|
|
ef8325c843 | ||
|
|
378f6784ad | ||
|
|
06ccede309 | ||
|
|
3a6105a934 | ||
|
|
65a119e15f | ||
|
|
ec4e5f880d | ||
|
|
ec8659d099 | ||
|
|
8d90281adf |
@@ -55,10 +55,11 @@ further defined and clarified by project maintainers.
|
|||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
reported by contacting the project team at
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
[support@github.com](mailto:support@github.com). All complaints will be
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
reviewed and investigated and will result in a response that is deemed
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
necessary and appropriate to the circumstances. The project team is obligated
|
||||||
|
to maintain confidentiality with regard to the reporter of an incident.
|
||||||
Further details of specific enforcement policies may be posted separately.
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
|||||||
64
README.md
64
README.md
@@ -3,7 +3,8 @@
|
|||||||
[](https://github.com/actions/setup-elixir/actions)
|
[](https://github.com/actions/setup-elixir/actions)
|
||||||
[](https://github.com/actions/setup-elixir/actions)
|
[](https://github.com/actions/setup-elixir/actions)
|
||||||
|
|
||||||
This actions sets up an Elixir environment for use in Actions by:
|
This action sets up an Elixir environment for use in a GitHub Actions
|
||||||
|
workflow by:
|
||||||
|
|
||||||
- Installing OTP
|
- Installing OTP
|
||||||
- Installing Elixir
|
- Installing Elixir
|
||||||
@@ -16,9 +17,9 @@ See [action.yml](action.yml).
|
|||||||
|
|
||||||
**Note** The OTP release version specification is [relatively
|
**Note** The OTP release version specification is [relatively
|
||||||
complex](http://erlang.org/doc/system_principles/versions.html#version-scheme).
|
complex](http://erlang.org/doc/system_principles/versions.html#version-scheme).
|
||||||
For best results, the current recommendation is to use a full exact version
|
For best results, we recommend specifying exact OTP and Elixir versions.
|
||||||
spec from the list available from [Erlang
|
However, values like `22.x` are also accepted, and we attempt to resolve them
|
||||||
Solutions](https://www.erlang-solutions.com/resources/download.html).
|
according to semantic versioning rules.
|
||||||
|
|
||||||
### Basic example
|
### Basic example
|
||||||
|
|
||||||
@@ -29,11 +30,11 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1.0.0
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-elixir@v1.1.0
|
- uses: actions/setup-elixir@v1
|
||||||
with:
|
with:
|
||||||
otp-version: 22.x
|
otp-version: 22.2
|
||||||
elixir-version: 1.9.x
|
elixir-version: 1.9.4
|
||||||
- run: mix deps.get
|
- run: mix deps.get
|
||||||
- run: mix test
|
- run: mix test
|
||||||
```
|
```
|
||||||
@@ -49,11 +50,11 @@ jobs:
|
|||||||
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
|
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
otp: [20.x, 21.x, 22.x]
|
otp: [20.3, 21.3, 22.2]
|
||||||
elixir: [1.8.x, 1.9.x]
|
elixir: [1.8.2, 1.9.4]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1.0.0
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-elixir@v1.1.0
|
- uses: actions/setup-elixir@v1
|
||||||
with:
|
with:
|
||||||
otp-version: ${{matrix.otp}}
|
otp-version: ${{matrix.otp}}
|
||||||
elixir-version: ${{matrix.elixir}}
|
elixir-version: ${{matrix.elixir}}
|
||||||
@@ -74,6 +75,8 @@ jobs:
|
|||||||
db:
|
db:
|
||||||
image: postgres:11
|
image: postgres:11
|
||||||
ports: ['5432:5432']
|
ports: ['5432:5432']
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd pg_isready
|
--health-cmd pg_isready
|
||||||
--health-interval 10s
|
--health-interval 10s
|
||||||
@@ -81,15 +84,44 @@ jobs:
|
|||||||
--health-retries 5
|
--health-retries 5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1.0.0
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-elixir@v1.1.0
|
- uses: actions/setup-elixir@v1
|
||||||
with:
|
with:
|
||||||
otp-version: 22.x
|
otp-version: 22.2
|
||||||
elixir-version: 1.9.x
|
elixir-version: 1.9.4
|
||||||
- run: mix deps.get
|
- run: mix deps.get
|
||||||
- run: mix test
|
- run: mix test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Authenticating with Postgres in Phoenix
|
||||||
|
|
||||||
|
When using the Phoenix example above, the `postgres` container has some
|
||||||
|
default authentication set up. Specifically, it expects a username of
|
||||||
|
"postgres", and a password of "postgres". It will be available at
|
||||||
|
`localhost:5432`.
|
||||||
|
|
||||||
|
The simplest way of setting these auth values in CI is by checking for the
|
||||||
|
`GITHUB_ACTIONS` environment variable that is set in all workflows:
|
||||||
|
|
||||||
|
```elixir
|
||||||
|
# config/test.exs
|
||||||
|
|
||||||
|
use Mix.Config
|
||||||
|
|
||||||
|
# Configure the database for local testing
|
||||||
|
config :app, App.Repo,
|
||||||
|
database: "my_app_test",
|
||||||
|
hostname: "localhost",
|
||||||
|
pool: Ecto.Adapters.SQL.Sandbox
|
||||||
|
|
||||||
|
# Configure the database for GitHub Actions
|
||||||
|
if System.get_env("GITHUB_ACTIONS") do
|
||||||
|
config :app, App.Repo,
|
||||||
|
username: "postgres",
|
||||||
|
password: "postgres"
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
## 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).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Setup Elixir
|
name: Setup Elixir
|
||||||
description: Set up an Elixir/OTP environment and add it to the PATH
|
description: Set up a specific version of OTP and Elixir and add the command-line tools to the PATH
|
||||||
author: GitHub
|
author: GitHub
|
||||||
branding:
|
branding:
|
||||||
color: blue
|
color: blue
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ async function main() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let installHex = core.getInput('install-hex')
|
let installHex = core.getInput('install-hex')
|
||||||
installHex = installHex == null ? true : installHex
|
installHex = installHex == null ? 'true' : installHex
|
||||||
let installRebar = core.getInput('install-rebar')
|
let installRebar = core.getInput('install-rebar')
|
||||||
installRebar = installRebar == null ? true : installRebar
|
installRebar = installRebar == null ? 'true' : installRebar
|
||||||
|
|
||||||
console.log(`##[group]Installing OTP ${otpVersion}`)
|
console.log(`##[group]Installing OTP ${otpVersion}`)
|
||||||
await installOTP(otpVersion)
|
await installOTP(otpVersion)
|
||||||
@@ -33,10 +33,10 @@ async function main() {
|
|||||||
await installElixir(elixirVersion, otpMajor)
|
await installElixir(elixirVersion, otpMajor)
|
||||||
console.log(`##[endgroup]`)
|
console.log(`##[endgroup]`)
|
||||||
|
|
||||||
process.env.PATH = `/tmp/.setup-elixir/elixir/bin:${process.env.PATH}`
|
process.env.PATH = `/tmp/.setup-elixir/elixir/bin:/tmp/.setup-elixir/otp/bin:${process.env.PATH}`
|
||||||
|
|
||||||
if (installRebar) await exec('mix local.rebar --force')
|
if (installRebar === 'true') await exec('mix local.rebar --force')
|
||||||
if (installHex) await exec('mix local.hex --force')
|
if (installHex === 'true') await exec('mix local.hex --force')
|
||||||
|
|
||||||
const matchersPath = path.join(__dirname, '..', '.github')
|
const matchersPath = path.join(__dirname, '..', '.github')
|
||||||
console.log(`##[add-matcher]${path.join(matchersPath, 'elixir.json')}`)
|
console.log(`##[add-matcher]${path.join(matchersPath, 'elixir.json')}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user