Skip to content

Commit e008e04

Browse files
committed
build
1 parent db8216a commit e008e04

File tree

2 files changed

+122
-69
lines changed

2 files changed

+122
-69
lines changed

.github/workflows/precompile.yml

Lines changed: 122 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,104 +2,160 @@ name: precompile
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches:
6+
- 'precompile-woes'
77

88
permissions:
99
contents: write
1010

1111
jobs:
12-
precompile:
13-
runs-on: ${{ matrix.job.os }}
12+
linux:
13+
runs-on: ubuntu-20.04
1414
env:
15-
MIX_ENV: "prod"
16-
17-
name: Precompile for Elixir ${{ matrix.job.elixir }}, OTP ${{ matrix.job.otp }}, OS ${{ matrix.job.os }}
15+
MIX_ENV: prod
1816
strategy:
19-
fail-fast: false
2017
matrix:
21-
job:
22-
- { os: "ubuntu-20.04", otp: "23", elixir: "1.14" }
23-
- { os: "macos-11", otp: "24.3.4.16", elixir: "1.14.3"}
24-
- { os: "windows-2019", otp: "25", elixir: "1.14"}
25-
steps:
26-
- uses: actions/checkout@v3
27-
- uses: erlef/setup-beam@v1
28-
if: matrix.job.os != 'macos-11'
29-
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-11'
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}
18+
otp_version: ["25"]
4219

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
20+
name: Linux x86_64 - OTP ${{ matrix.otp_version }}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
5624

57-
- uses: ilammy/msvc-dev-cmd@v1
58-
if: matrix.job.os == 'windows-2019'
25+
- uses: erlef/setup-beam@v1
5926
with:
60-
arch: x64
27+
otp-version: ${{ matrix.otp_version }}
28+
elixir-version: "1.14"
6129

62-
- name: Install system dependencies
63-
if: matrix.job.os == 'ubuntu-20.04'
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 \
33+
sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip \
6734
gcc g++ \
6835
gcc-i686-linux-gnu g++-i686-linux-gnu \
6936
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
7037
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
7138
gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
7239
gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \
7340
gcc-s390x-linux-gnu g++-s390x-linux-gnu
74-
41+
7542
- name: Get musl cross-compilers
76-
if: matrix.job.os == 'ubuntu-20.04'
7743
run: |
7844
for musl_arch in x86_64 aarch64 riscv64
7945
do
8046
wget "https://musl.cc/${musl_arch}-linux-musl-cross.tgz" -O "${musl_arch}-linux-musl-cross.tgz"
8147
tar -xf "${musl_arch}-linux-musl-cross.tgz"
8248
done
8349
84-
- name: Create precompiled library
85-
shell: bash
50+
- name: Create precompiled x86_64 library
8651
run: |
87-
if [ "${{ matrix.job.os }}" = "macos-11" ]; 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
52+
export PATH="$(pwd)/x86_64-linux-musl-cross/bin:${PATH}"
9653
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
9754
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
9855
mix deps.get
9956
mix elixir_make.precompile
10057
101-
- uses: softprops/action-gh-release@v1
102-
if: startsWith(github.ref, 'refs/tags/')
103-
with:
104-
files: |
105-
cache/*.tar.gz
58+
- name: Create precompiled aarch64 library
59+
run: |
60+
export PATH="$(pwd)/aarch64-linux-musl-cross/bin:${PATH}"
61+
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
62+
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
63+
mix deps.get
64+
mix elixir_make.precompile
65+
66+
- name: Create precompiled riscv64 library
67+
run: |
68+
export PATH="$(pwd)/riscv64-linux-musl-cross/bin:${PATH}"
69+
export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
70+
mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
71+
mix deps.get
72+
mix elixir_make.precompile
73+
74+
# precompile:
75+
# runs-on: ${{ matrix.job.os }}
76+
# env:
77+
# MIX_ENV: "prod"
78+
#
79+
# name: Precompile for Elixir ${{ matrix.job.elixir }}, OTP ${{ matrix.job.otp }}, OS ${{ matrix.job.os }}
80+
# strategy:
81+
# fail-fast: false
82+
# matrix:
83+
# job:
84+
# - { os: "ubuntu-20.04", otp: "25.0", elixir: "1.14", triplet: "" }
85+
# - { os: "macos-11", otp: "25.0", elixir: "1.14.3", triplet: "x86_64-apple-darwin" }
86+
# - { os: "windows-2019", otp: "25.0", elixir: "1.14", triplet: "" }
87+
# steps:
88+
# - uses: actions/checkout@v3
89+
# - uses: erlef/setup-beam@v1
90+
# if: matrix.job.os != 'macos-11'
91+
# with:
92+
# otp-version: ${{ matrix.job.otp }}
93+
# elixir-version: ${{ matrix.job.elixir }}
94+
# - name: Install erlang and elixir
95+
# if: matrix.job.os == 'macos-11'
96+
# run: |
97+
# export ROOT_DIR=$(pwd)
98+
#
99+
# mkdir -p ./cache/otp
100+
# curl -fSL https://github.com/cocoa-xu/otp-build/releases/download/v${{ matrix.job.otp }}/otp-${{ matrix.job.triplet}}.tar.gz -o ./cache/otp/otp-v${{ matrix.job.otp }}-${{ matrix.job.triplet}}.tar.gz
101+
# cd ./cache/otp
102+
# tar -xzf otp-v${{ matrix.job.otp }}-${{ matrix.job.triplet}}.tar.gz
103+
# cd ${ROOT_DIR}
104+
#
105+
# export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
106+
# export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
107+
#
108+
# mkdir -p ./cache/elixir
109+
# 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
110+
# cd ./cache/elixir
111+
# tar -xzf elixir-${{ matrix.job.elixir }}.tar.gz
112+
# cd elixir-${{ matrix.job.elixir }}
113+
# make compile
114+
# make -j$(sysctl -n hw.ncpu) install
115+
#
116+
# mix local.hex --force
117+
# mix local.rebar --force
118+
#
119+
# - uses: ilammy/msvc-dev-cmd@v1
120+
# if: matrix.job.os == 'windows-2019'
121+
# with:
122+
# arch: x64
123+
#
124+
# - name: Install system dependencies
125+
# if: matrix.job.os == 'ubuntu-20.04'
126+
# run: |
127+
# sudo apt-get update
128+
# sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip wget \
129+
# gcc g++ \
130+
# gcc-i686-linux-gnu g++-i686-linux-gnu \
131+
# gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
132+
# gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \
133+
# gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
134+
# gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \
135+
# gcc-s390x-linux-gnu g++-s390x-linux-gnu
136+
#
137+
# - name: Get musl cross-compilers
138+
# if: matrix.job.os == 'ubuntu-20.04'
139+
# run: |
140+
# for musl_arch in x86_64 aarch64 riscv64
141+
# do
142+
# wget "https://musl.cc/${musl_arch}-linux-musl-cross.tgz" -O "${musl_arch}-linux-musl-cross.tgz"
143+
# tar -xf "${musl_arch}-linux-musl-cross.tgz"
144+
# done
145+
#
146+
# - name: Create precompiled library
147+
# shell: bash
148+
# run: |
149+
# if [ "${{ matrix.job.os }}" = "macos-11" ]; then
150+
# export PATH=$(pwd)/cache/otp/usr/local/bin:$(pwd)/./cache/elixir/elixir-${{ matrix.job.elixir }}/bin:${PATH}
151+
# export ERL_ROOTDIR=$(pwd)/cache/otp/usr/local/lib/erlang
152+
# elif [ "${{ matrix.job.os }}" = "ubuntu-20.04" ]; then
153+
# for musl_arch in x86_64 aarch64 riscv64
154+
# do
155+
# export PATH="$(pwd)/${musl_arch}-linux-musl-cross/bin:${PATH}"
156+
# done
157+
# fi
158+
# export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache
159+
# mkdir -p "${ELIXIR_MAKE_CACHE_DIR}"
160+
# mix deps.get
161+
# mix elixir_make.precompile

mix.exs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ defmodule Exqlite.MixProject do
158158
"aarch64-linux-gnu" => "aarch64-linux-gnu-",
159159
"riscv64-linux-gnu" => "riscv64-linux-gnu-"
160160
},
161-
{:unix, :darwin} => %{
162-
:include_default_ones => true
163-
},
164161
{:win32, :nt} => %{
165162
:include_default_ones => true
166163
}

0 commit comments

Comments
 (0)