Skip to content

Commit

Permalink
Merge pull request #20 from willfore/main
Browse files Browse the repository at this point in the history
Update precompile.yml
  • Loading branch information
AlexR2D2 authored Aug 2, 2024
2 parents 6610938 + 69ae41e commit 3ce1bc3
Showing 1 changed file with 55 additions and 72 deletions.
127 changes: 55 additions & 72 deletions .github/workflows/precompile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,97 +9,80 @@ permissions:
contents: write

jobs:
precompile:
runs-on: ${{ matrix.job.os }}
linux:
name: Linux Erlang/OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
runs-on: ubuntu-20.04
env:
MIX_ENV: "prod"

name: Precompile for Elixir ${{ matrix.job.elixir }}, OTP ${{ matrix.job.otp }}, OS ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: "ubuntu-20.04", otp: "23", elixir: "1.14" }
- { os: "macos-12", otp: "24.3.4.16", elixir: "1.14.3"}
- { os: "windows-2019", otp: "25", elixir: "1.14"}
# Elixir 1.14.5 is first version compatible with OTP 26
# NIF versions change according to
# https://github.com/erlang/otp/blob/dd57c853a324a9572a9e5ce227d8675ff004c6fe/erts/emulator/beam/erl_nif.h#L33
otp: ["25.0", "26.0"]
elixir: ["1.14.5"]
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
if: matrix.job.os != 'macos-12'
with:
otp-version: ${{ matrix.job.otp }}
elixir-version: ${{ matrix.job.elixir }}
- name: Install erlang and elixir
if: matrix.job.os == 'macos-12'
run: |
export ROOT_DIR=$(pwd)
mkdir -p ./cache/otp
curl -fSL https://github.com/cocoa-xu/otp-build/releases/download/v${{ matrix.job.otp }}/otp-x86_64-apple-darwin.tar.gz -o ./cache/otp/otp-v${{ matrix.job.otp }}-x86_64-apple-darwin.tar.gz
cd ./cache/otp
tar -xzf otp-v${{ matrix.job.otp }}-x86_64-apple-darwin.tar.gz
cd ${ROOT_DIR}
export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
mkdir -p ./cache/elixir
curl -fSL https://github.com/elixir-lang/elixir/archive/refs/tags/v${{ matrix.job.elixir }}.tar.gz -o ./cache/elixir/elixir-${{ matrix.job.elixir }}.tar.gz
cd ./cache/elixir
tar -xzf elixir-${{ matrix.job.elixir }}.tar.gz
cd elixir-${{ matrix.job.elixir }}
make compile
make -j$(sysctl -n hw.ncpu) install
mix local.hex --force
mix local.rebar --force
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.job.os == 'windows-2019'
with:
arch: x64

- name: Install system dependencies
if: matrix.job.os == 'ubuntu-20.04'
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Install system dependecies
run: |
sudo apt-get update
sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip wget \
gcc g++ \
gcc-i686-linux-gnu g++-i686-linux-gnu \
sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \
gcc-s390x-linux-gnu g++-s390x-linux-gnu
- name: Get musl cross-compilers
if: matrix.job.os == 'ubuntu-20.04'
gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
- name: Mix Test
run: |
for musl_arch in x86_64 aarch64 riscv64
do
wget "https://musl.cc/${musl_arch}-linux-musl-cross.tgz" -O "${musl_arch}-linux-musl-cross.tgz"
tar -xf "${musl_arch}-linux-musl-cross.tgz"
done
mix deps.get
MIX_ENV=test mix test
- name: Create precompiled library
shell: bash
run: |
if [ "${{ matrix.job.os }}" = "macos-12" ]; then
export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
elif [ "${{ matrix.job.os }}" = "ubuntu-20.04" ]; then
for musl_arch in x86_64 aarch64 riscv64
do
export PATH="$(pwd)/${musl_arch}-linux-musl-cross/bin:${PATH}"
done
fi
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
mix deps.get
mix elixir_make.precompile
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
cache/*.tar.gz
macos:
runs-on: ${{matrix.runner}}
# Homebrew supports versioned Erlang/OTP but not Elixir
# It's a deliberate design decision from Homebrew to
# only support versioned distrinutions for certin packages
name: Mac (${{ matrix.runner == 'macos-13' && 'Intel' || 'ARM' }}) Erlang/OTP ${{matrix.otp}} / Elixir
env:
MIX_ENV: "prod"
strategy:
matrix:
runner: ["macos-13", "macos-14"]
otp: ["25.0", "26.0"]
elixir: ["1.14.5"]
steps:
- uses: actions/checkout@v3
- uses: asdf-vm/actions/install@v2
with:
tool_versions: |
erlang ${{matrix.otp}}
elixir ${{matrix.elixir}}
- name: Install libomp
run: |
brew install libomp
mix local.hex --force
mix local.rebar --force
- name: Mix Test
run: |
mix deps.get
MIX_ENV=test mix test
- name: Create precompiled library
run: |
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
mix elixir_make.precompile
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ matrix.runner == 'macos-13' && 'cache/*x86_64*.tar.gz' || 'cache/*aarch64*.tar.gz' }}

0 comments on commit 3ce1bc3

Please sign in to comment.