Standardize Elixir & OTP versions (#1979)

This commit is contained in:
Wojtek Mach 2023-06-15 12:49:48 +02:00 committed by GitHub
parent d5f9aaf14e
commit 590ed206af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 30 deletions

View file

@ -15,6 +15,11 @@
set -euo pipefail set -euo pipefail
main() { main() {
. versions
OTP_VERSION="${OTP_VERSION:-$otp}"
ELIXIR_VERSION="${ELIXIR_VERSION:-$elixir}"
OPENSSL_VERSION="${OPENSSL_VERSION:-$openssl}"
bootstrap_otp bootstrap_otp
download_elixir download_elixir
build_app build_app
@ -23,16 +28,16 @@ main() {
bootstrap_otp() { bootstrap_otp() {
dir=$PWD dir=$PWD
cd elixirkit/otp_bootstrap cd elixirkit/otp_bootstrap
. ./build_macos_universal.sh $OTP_VERSION "1.1.1s" . ./build_macos_universal.sh "$OTP_VERSION" "$OPENSSL_VERSION"
cd $dir cd $dir
} }
download_elixir() { download_elixir() {
dir=$PWD dir=$PWD
elixir_dir=$PWD/_build/elixir-$ELIXIR_VERSION elixir_dir=$PWD/_build/elixir-"$ELIXIR_VERSION"
if [ ! -d $elixir_dir ]; then if [ ! -d $elixir_dir ]; then
otp_release=$(erl -noshell -eval 'io:format("~s", [erlang:system_info(otp_release)]), halt().') otp_release=`erl -noshell -eval 'io:format("~s", [erlang:system_info(otp_release)]), halt().'`
elixir_zip=v${ELIXIR_VERSION}-otp-${otp_release}.zip elixir_zip=v${ELIXIR_VERSION}-otp-${otp_release}.zip
url=https://builds.hex.pm/builds/elixir/$elixir_zip url=https://builds.hex.pm/builds/elixir/$elixir_zip
echo downloading $url echo downloading $url

View file

@ -5,9 +5,6 @@ on:
- main - main
tags: tags:
- "v*.*.*" - "v*.*.*"
env:
otp: "25.3.2"
elixir: "1.15.0-rc.2"
jobs: jobs:
assets: assets:
outputs: outputs:
@ -15,6 +12,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
- name: Install Erlang & Elixir - name: Install Erlang & Elixir
uses: erlef/setup-beam@v1 uses: erlef/setup-beam@v1
with: with:

View file

@ -4,16 +4,19 @@ on:
push: push:
branches: branches:
- main - main
env:
otp: "25.3.2"
elixir: "1.15.0-rc.2"
jobs: jobs:
main: main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
MIX_ENV: test MIX_ENV: test
steps: steps:
- uses: actions/checkout@v3 - name: Checkout git repo
uses: actions/checkout@v3
- run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
echo "openssl=$openssl" >> $GITHUB_ENV
- name: Install Erlang & Elixir - name: Install Erlang & Elixir
uses: erlef/setup-beam@v1 uses: erlef/setup-beam@v1
with: with:
@ -55,13 +58,19 @@ jobs:
run: npm test --prefix assets run: npm test --prefix assets
windows: windows:
runs-on: windows-latest runs-on: windows-latest
if: github.ref == 'refs/heads/main' if: github.ref_name == 'main'
env: env:
MIX_ENV: test MIX_ENV: test
steps: steps:
- name: Configure Git - name: Configure Git
run: git config --global core.autocrlf input run: git config --global core.autocrlf input
- uses: actions/checkout@v3 - name: Checkout git repo
uses: actions/checkout@v3
- run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
echo "openssl=$openssl" >> $GITHUB_ENV
- name: Install Erlang & Elixir - name: Install Erlang & Elixir
uses: erlef/setup-beam@v1 uses: erlef/setup-beam@v1
with: with:
@ -93,9 +102,15 @@ jobs:
macos: macos:
runs-on: macos-latest runs-on: macos-latest
if: github.ref == 'refs/heads/main' if: github.ref_name == 'main'
steps: steps:
- uses: actions/checkout@v3 - name: Checkout git repo
uses: actions/checkout@v3
- run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
echo "openssl=$openssl" >> $GITHUB_ENV
- name: Cache Mix Deps - name: Cache Mix Deps
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -104,7 +119,7 @@ jobs:
- name: Cache Bootstrap OTP - name: Cache Bootstrap OTP
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: elixirkit/otp_bootstrap/_build/otp-rel-${{ env.otp }}-openssl-1.1.1s-macos-universal path: elixirkit/otp_bootstrap/_build/otp-rel-${{ env.otp }}-openssl-${{ env.openssl }}-macos-universal
key: ${{ runner.os }}-bootstrap-${{ env.otp }}-${{ hashFiles('elixirkit/otp_bootstrap/build.sh') }} key: ${{ runner.os }}-bootstrap-${{ env.otp }}-${{ hashFiles('elixirkit/otp_bootstrap/build.sh') }}
- name: Cache Elixir - name: Cache Elixir
uses: actions/cache@v3 uses: actions/cache@v3
@ -113,6 +128,3 @@ jobs:
key: ${{ runner.os }}-elixir-${{ env.elixir }} key: ${{ runner.os }}-elixir-${{ env.elixir }}
- name: Build the app - name: Build the app
run: .github/scripts/app/build_macos.sh run: .github/scripts/app/build_macos.sh
env:
OTP_VERSION: ${{ env.otp }}
ELIXIR_VERSION: ${{ env.elixir }}

View file

@ -3,10 +3,6 @@ on:
pull_request: pull_request:
types: [opened, synchronize, reopened, closed] types: [opened, synchronize, reopened, closed]
env:
otp: "25.3.2"
elixir: "1.15.0-rc.2"
jobs: jobs:
build-application: build-application:
name: Build PR image name: Build PR image
@ -17,6 +13,10 @@ jobs:
steps: steps:
- name: Checkout git repo - name: Checkout git repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
# --- START build assets # --- START build assets
- name: Install Erlang & Elixir - name: Install Erlang & Elixir
uses: erlef/setup-beam@v1 uses: erlef/setup-beam@v1

View file

@ -5,14 +5,13 @@
set -ex set -ex
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
elixir="1.15.0-rc.2" . versions
erlang="25.3.2"
ubuntu="focal-20230126" ubuntu="focal-20230126"
docker buildx build --push --platform linux/amd64,linux/arm64 \ docker buildx build --push --platform linux/amd64,linux/arm64 \
-t ghcr.io/livebook-dev/utils:elixir-cuda11.8 \ -t ghcr.io/livebook-dev/utils:elixir-cuda11.8 \
--build-arg ELIXIR_VERSION=$elixir \ --build-arg ELIXIR_VERSION=$elixir \
--build-arg ERLANG_VERSION=$erlang \ --build-arg ERLANG_VERSION=$otp \
--build-arg UBUNTU_VERSION=$ubuntu \ --build-arg UBUNTU_VERSION=$ubuntu \
--build-arg CUDA_VERSION=11.8.0 \ --build-arg CUDA_VERSION=11.8.0 \
-f docker/base/elixir-cuda.dockerfile \ -f docker/base/elixir-cuda.dockerfile \

11
mix.exs
View file

@ -5,9 +5,6 @@ defmodule Livebook.MixProject do
@version "0.9.2" @version "0.9.2"
@description "Automate code & data workflows with interactive notebooks" @description "Automate code & data workflows with interactive notebooks"
@app_elixir_version "1.15.0-rc.2"
@app_rebar3_version "3.22.0"
def project do def project do
[ [
app: :livebook, app: :livebook,
@ -164,12 +161,16 @@ defmodule Livebook.MixProject do
@compile {:no_warn_undefined, Standalone} @compile {:no_warn_undefined, Standalone}
defp standalone_erlang_elixir(release) do defp standalone_erlang_elixir(release) do
{_, bindings} = Code.eval_file("versions")
elixir_version = bindings[:elixir]
rebar3_version = bindings[:rebar3]
Code.require_file("rel/app/standalone.exs") Code.require_file("rel/app/standalone.exs")
release release
|> Standalone.copy_otp() |> Standalone.copy_otp()
|> Standalone.copy_elixir(@app_elixir_version) |> Standalone.copy_elixir(elixir_version)
|> Standalone.copy_hex() |> Standalone.copy_hex()
|> Standalone.copy_rebar3(@app_rebar3_version) |> Standalone.copy_rebar3(rebar3_version)
end end
end end

4
versions Normal file
View file

@ -0,0 +1,4 @@
elixir="1.15.0-rc.2"
otp="25.3.2"
openssl="1.1.1s"
rebar3="3.22.0"