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
main() {
. versions
OTP_VERSION="${OTP_VERSION:-$otp}"
ELIXIR_VERSION="${ELIXIR_VERSION:-$elixir}"
OPENSSL_VERSION="${OPENSSL_VERSION:-$openssl}"
bootstrap_otp
download_elixir
build_app
@ -23,16 +28,16 @@ main() {
bootstrap_otp() {
dir=$PWD
cd elixirkit/otp_bootstrap
. ./build_macos_universal.sh $OTP_VERSION "1.1.1s"
. ./build_macos_universal.sh "$OTP_VERSION" "$OPENSSL_VERSION"
cd $dir
}
download_elixir() {
dir=$PWD
elixir_dir=$PWD/_build/elixir-$ELIXIR_VERSION
elixir_dir=$PWD/_build/elixir-"$ELIXIR_VERSION"
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
url=https://builds.hex.pm/builds/elixir/$elixir_zip
echo downloading $url

View file

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

View file

@ -4,16 +4,19 @@ on:
push:
branches:
- main
env:
otp: "25.3.2"
elixir: "1.15.0-rc.2"
jobs:
main:
runs-on: ubuntu-latest
env:
MIX_ENV: test
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
uses: erlef/setup-beam@v1
with:
@ -55,13 +58,19 @@ jobs:
run: npm test --prefix assets
windows:
runs-on: windows-latest
if: github.ref == 'refs/heads/main'
if: github.ref_name == 'main'
env:
MIX_ENV: test
steps:
- name: Configure Git
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
uses: erlef/setup-beam@v1
with:
@ -93,9 +102,15 @@ jobs:
macos:
runs-on: macos-latest
if: github.ref == 'refs/heads/main'
if: github.ref_name == 'main'
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
uses: actions/cache@v3
with:
@ -104,7 +119,7 @@ jobs:
- name: Cache Bootstrap OTP
uses: actions/cache@v3
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') }}
- name: Cache Elixir
uses: actions/cache@v3
@ -113,6 +128,3 @@ jobs:
key: ${{ runner.os }}-elixir-${{ env.elixir }}
- name: Build the app
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:
types: [opened, synchronize, reopened, closed]
env:
otp: "25.3.2"
elixir: "1.15.0-rc.2"
jobs:
build-application:
name: Build PR image
@ -17,6 +13,10 @@ jobs:
steps:
- name: Checkout git repo
uses: actions/checkout@v3
- run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
# --- START build assets
- name: Install Erlang & Elixir
uses: erlef/setup-beam@v1

View file

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

11
mix.exs
View file

@ -5,9 +5,6 @@ defmodule Livebook.MixProject do
@version "0.9.2"
@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
[
app: :livebook,
@ -164,12 +161,16 @@ defmodule Livebook.MixProject do
@compile {:no_warn_undefined, Standalone}
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")
release
|> Standalone.copy_otp()
|> Standalone.copy_elixir(@app_elixir_version)
|> Standalone.copy_elixir(elixir_version)
|> Standalone.copy_hex()
|> Standalone.copy_rebar3(@app_rebar3_version)
|> Standalone.copy_rebar3(rebar3_version)
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"