Skip to content

Commit 3ce1bc3

Browse files
authored
Merge pull request #20 from willfore/main
Update precompile.yml
2 parents 6610938 + 69ae41e commit 3ce1bc3

File tree

1 file changed

+55
-72
lines changed

1 file changed

+55
-72
lines changed

.github/workflows/precompile.yml

+55-72
Original file line numberDiff line numberDiff line change
@@ -9,97 +9,80 @@ permissions:
99
contents: write
1010

1111
jobs:
12-
precompile:
13-
runs-on: ${{ matrix.job.os }}
12+
linux:
13+
name: Linux Erlang/OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
14+
runs-on: ubuntu-20.04
1415
env:
1516
MIX_ENV: "prod"
16-
17-
name: Precompile for Elixir ${{ matrix.job.elixir }}, OTP ${{ matrix.job.otp }}, OS ${{ matrix.job.os }}
1817
strategy:
19-
fail-fast: false
2018
matrix:
21-
job:
22-
- { os: "ubuntu-20.04", otp: "23", elixir: "1.14" }
23-
- { os: "macos-12", otp: "24.3.4.16", elixir: "1.14.3"}
24-
- { os: "windows-2019", otp: "25", elixir: "1.14"}
19+
# Elixir 1.14.5 is first version compatible with OTP 26
20+
# NIF versions change according to
21+
# https://github.com/erlang/otp/blob/dd57c853a324a9572a9e5ce227d8675ff004c6fe/erts/emulator/beam/erl_nif.h#L33
22+
otp: ["25.0", "26.0"]
23+
elixir: ["1.14.5"]
2524
steps:
2625
- uses: actions/checkout@v3
2726
- uses: erlef/setup-beam@v1
28-
if: matrix.job.os != 'macos-12'
2927
with:
30-
otp-version: ${{ matrix.job.otp }}
31-
elixir-version: ${{ matrix.job.elixir }}
32-
- name: Install erlang and elixir
33-
if: matrix.job.os == 'macos-12'
34-
run: |
35-
export ROOT_DIR=$(pwd)
36-
37-
mkdir -p ./cache/otp
38-
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
39-
cd ./cache/otp
40-
tar -xzf otp-v${{ matrix.job.otp }}-x86_64-apple-darwin.tar.gz
41-
cd ${ROOT_DIR}
42-
43-
export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
44-
export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
45-
46-
mkdir -p ./cache/elixir
47-
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
48-
cd ./cache/elixir
49-
tar -xzf elixir-${{ matrix.job.elixir }}.tar.gz
50-
cd elixir-${{ matrix.job.elixir }}
51-
make compile
52-
make -j$(sysctl -n hw.ncpu) install
53-
54-
mix local.hex --force
55-
mix local.rebar --force
56-
57-
- uses: ilammy/msvc-dev-cmd@v1
58-
if: matrix.job.os == 'windows-2019'
59-
with:
60-
arch: x64
61-
62-
- name: Install system dependencies
63-
if: matrix.job.os == 'ubuntu-20.04'
28+
otp-version: ${{matrix.otp}}
29+
elixir-version: ${{matrix.elixir}}
30+
- name: Install system dependecies
6431
run: |
6532
sudo apt-get update
66-
sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip wget \
67-
gcc g++ \
68-
gcc-i686-linux-gnu g++-i686-linux-gnu \
33+
sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip \
6934
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
70-
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
71-
gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
72-
gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \
73-
gcc-s390x-linux-gnu g++-s390x-linux-gnu
74-
75-
- name: Get musl cross-compilers
76-
if: matrix.job.os == 'ubuntu-20.04'
35+
gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
36+
- name: Mix Test
7737
run: |
78-
for musl_arch in x86_64 aarch64 riscv64
79-
do
80-
wget "https://musl.cc/${musl_arch}-linux-musl-cross.tgz" -O "${musl_arch}-linux-musl-cross.tgz"
81-
tar -xf "${musl_arch}-linux-musl-cross.tgz"
82-
done
83-
38+
mix deps.get
39+
MIX_ENV=test mix test
8440
- name: Create precompiled library
85-
shell: bash
8641
run: |
87-
if [ "${{ matrix.job.os }}" = "macos-12" ]; then
88-
export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
89-
export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
90-
elif [ "${{ matrix.job.os }}" = "ubuntu-20.04" ]; then
91-
for musl_arch in x86_64 aarch64 riscv64
92-
do
93-
export PATH="$(pwd)/${musl_arch}-linux-musl-cross/bin:${PATH}"
94-
done
95-
fi
9642
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
9743
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
98-
mix deps.get
9944
mix elixir_make.precompile
100-
10145
- uses: softprops/action-gh-release@v1
10246
if: startsWith(github.ref, 'refs/tags/')
10347
with:
10448
files: |
10549
cache/*.tar.gz
50+
macos:
51+
runs-on: ${{matrix.runner}}
52+
# Homebrew supports versioned Erlang/OTP but not Elixir
53+
# It's a deliberate design decision from Homebrew to
54+
# only support versioned distrinutions for certin packages
55+
name: Mac (${{ matrix.runner == 'macos-13' && 'Intel' || 'ARM' }}) Erlang/OTP ${{matrix.otp}} / Elixir
56+
env:
57+
MIX_ENV: "prod"
58+
strategy:
59+
matrix:
60+
runner: ["macos-13", "macos-14"]
61+
otp: ["25.0", "26.0"]
62+
elixir: ["1.14.5"]
63+
steps:
64+
- uses: actions/checkout@v3
65+
- uses: asdf-vm/actions/install@v2
66+
with:
67+
tool_versions: |
68+
erlang ${{matrix.otp}}
69+
elixir ${{matrix.elixir}}
70+
- name: Install libomp
71+
run: |
72+
brew install libomp
73+
mix local.hex --force
74+
mix local.rebar --force
75+
- name: Mix Test
76+
run: |
77+
mix deps.get
78+
MIX_ENV=test mix test
79+
- name: Create precompiled library
80+
run: |
81+
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
82+
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
83+
mix elixir_make.precompile
84+
- uses: softprops/action-gh-release@v1
85+
if: startsWith(github.ref, 'refs/tags/')
86+
with:
87+
files: |
88+
${{ matrix.runner == 'macos-13' && 'cache/*x86_64*.tar.gz' || 'cache/*aarch64*.tar.gz' }}

0 commit comments

Comments
 (0)