Skip to content
GitHub no longer supports this web browser. Learn more about the browsers we support.
Set up your GitHub Actions workflow with OTP and Elixir
JavaScript Elixir Shell
Use this GitHub Action with your project

Add this Action to an existing workflow or create a new one.

View on Marketplace
Branch: master
Clone or download
Latest commit 0557788 Jan 8, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.licenses/npm
node_modules Initial commit Aug 28, 2019
src Install Elixir/OTP in /tmp Dec 4, 2019
test-project Initial commit Aug 28, 2019
.gitattributes
.gitignore Initial commit Aug 28, 2019
.licensed.yml Initial commit Aug 28, 2019
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md Jan 8, 2020
CONTRIBUTING.md
LICENSE.md Initial commit Aug 28, 2019
README.md Add Postgres info to README Jan 8, 2020
action.yml Update description Nov 8, 2019
package.json
yarn.lock Initial commit Aug 28, 2019

README.md

setup-elixir

This action sets up an Elixir environment for use in a GitHub Actions workflow by:

  • Installing OTP
  • Installing Elixir

Note Currently, this action currently only supports Actions' ubuntu- runtimes.

Usage

See action.yml.

Note The OTP release version specification is relatively complex. For best results, we recommend specifying exact OTP and Elixir versions. However, values like 22.x are also accepted, and we attempt to resolve them according to semantic versioning rules.

Basic example

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-elixir@v1
        with:
          otp-version: 22.2
          elixir-version: 1.9.4
      - run: mix deps.get
      - run: mix test

Matrix example

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
    strategy:
      matrix:
        otp: [20.3, 21.3, 22.2]
        elixir: [1.8.2, 1.9.4]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-elixir@v1
        with:
          otp-version: ${{matrix.otp}}
          elixir-version: ${{matrix.elixir}}
      - run: mix deps.get
      - run: mix test

Phoenix example

on: push

jobs:
  test:
    runs-on: ubuntu-latest

    services:
      db:
        image: postgres:11
        ports: ['5432:5432']
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-elixir@v1
        with:
          otp-version: 22.2
          elixir-version: 1.9.4
      - run: mix deps.get
      - 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:

# 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

The scripts and documentation in this project are released under the MIT license.

Contributing

Check out this doc.

Current Status

This action is in active development.

You can’t perform that action at this time.