Skip to content

Commit fb3f0b1

Browse files
authored
Adding installer binaries to CI (#20)
* wip * wip * fixup * update deps * fixup * mix desktop.installer * fixup * wip * Windows update * fixup * fixup * fixup * fixup * fixup * fixup * fixup * wip * wip * wip * wip * wip * fixup * Removed npm dep * wip * wip * wip * fixup * fixup * fixup * fixup * wip * wip * wip * fixup * fixup * fixup * improved match * fixup * fixup * updated deps * OTP-25.3.2.6 * updated webview2 * revert otp * force make usage * wip * moving env vars * fixup * fixup exqlite * fixup * fixup * align versions * fixup * fixup * fixup * fixup * fixup * wip * sign * remove subst * unlock keychain * wip * wip * fixup * fixup * wip * fixup * move to runner_temp * fixup * fixup * fixup * fixup * windows * fixup * trywindows2022 * change order * try ucrt64 on windows * fixup * wip * wip * fixup * wip * wip * fix warning
1 parent c1a72c2 commit fb3f0b1

19 files changed

Lines changed: 708 additions & 56 deletions

.dockerignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/priv/*.so*
2+
/priv/*.dylib*
3+
/priv/static/*
4+
/Dockerfile
5+
/build.sh
6+
/app.run
7+
*.log
8+
*.zip
9+
*.gz
10+
.DS_Store
11+
12+
# The directory Mix will write compiled artifacts to.
13+
/_build/
14+
15+
# If you run "mix test --cover", coverage assets end up here.
16+
/cover/
17+
18+
# The directory Mix downloads your dependencies sources to.
19+
/deps/
20+
21+
# Where third-party dependencies like ExDoc output generated docs.
22+
/doc/
23+
24+
# Ignore .fetch files in case you like to edit your project deps locally.
25+
/.fetch
26+
27+
# If the VM crashes, it generates a dump, let's ignore it too.
28+
erl_crash.dump
29+
30+
# Also ignore archive artifacts (built via "mix archive.build").
31+
*.ez
32+
33+
# Ignore package tarball (built via "mix hex.build").
34+
todo-*.tar
35+
36+
# If NPM crashes, it generates a log, let's ignore it too.
37+
npm-debug.log
38+
39+
# The directory NPM downloads your dependencies sources to.
40+
/assets/node_modules/

.github/workflows/binaries.yml

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
name: "Build binaries"
2+
on: ["push", "pull_request"]
3+
env:
4+
OTP_GITHUB_URL: https://github.com/erlang/otp.git
5+
OTP_VERSION: OTP-24.3.4.15
6+
WXWIDGETS_REPO: https://github.com/wxWidgets/wxWidgets.git
7+
WXWIDGETS_VERSION: master
8+
ELIXIR_VERSION: 1.14.5
9+
ELIXIR_VARIANT: -otp-24
10+
DOCKER_BUILDKIT: 0
11+
12+
jobs:
13+
windows:
14+
runs-on: windows-latest
15+
timeout-minutes: 90
16+
defaults:
17+
run:
18+
shell: wsl-bash {0}
19+
name: Build Erlang/OTP (Windows)
20+
steps:
21+
- name: Restore Windows Cache
22+
uses: actions/cache/restore@v3
23+
id: win32-cache
24+
with:
25+
path: "c:\\opt\\otp.exe"
26+
key: win32-wxwidgets-${{ env.WXWIDGETS_VERSION }}-otp-${{ env.OTP_VERSION }}
27+
28+
- uses: Vampire/setup-wsl@v2
29+
if: steps.win32-cache.outputs.cache-hit != 'true'
30+
with:
31+
distribution: Ubuntu-18.04
32+
33+
- name: Install WSL dependencies
34+
if: steps.win32-cache.outputs.cache-hit != 'true'
35+
run: apt update && apt install -y g++-mingw-w64 gcc-mingw-w64 make autoconf unzip
36+
37+
- name: Install openssl
38+
if: steps.win32-cache.outputs.cache-hit != 'true'
39+
shell: cmd
40+
run: |
41+
choco install openssl --version=1.1.1.2100
42+
IF EXIST "c:\\Program Files\\OpenSSL-Win64" (move "c:\\Program Files\\OpenSSL-Win64" "c:\\OpenSSL-Win64") ELSE (move "c:\\Program Files\\OpenSSL" "c:\\OpenSSL-Win64")
43+
44+
- name: Download wxWidgets
45+
if: steps.win32-cache.outputs.cache-hit != 'true'
46+
run: |
47+
git clone ${{ env.WXWIDGETS_REPO }}
48+
cd wxWidgets
49+
git checkout ${{ env.WXWIDGETS_VERSION }}
50+
git submodule update --init
51+
sed -i -r -e 's/wxUSE_POSTSCRIPT +0/wxUSE_POSTSCRIPT 1/' include/wx/msw/setup.h
52+
sed -i -r -e 's/wxUSE_WEBVIEW_EDGE +0/wxUSE_WEBVIEW_EDGE 1/' include/wx/msw/setup.h
53+
sed -i -r -e 's/WXWIN_COMPATIBILITY_3_0 +0/WXWIN_COMPATIBILITY_3_0 1/' include/wx/msw/setup.h
54+
55+
- name: Install WebView2
56+
if: steps.win32-cache.outputs.cache-hit != 'true'
57+
shell: cmd
58+
run: |
59+
cd wxWidgets\\3rdparty
60+
nuget install Microsoft.Web.WebView2 -Version 1.0.864.35 -Source https://api.nuget.org/v3/index.json
61+
rename Microsoft.Web.WebView2.1.0.864.35 webview2
62+
63+
- name: Build wxWidgets
64+
if: steps.win32-cache.outputs.cache-hit != 'true'
65+
shell: cmd
66+
run: |
67+
cd wxWidgets\\build\\msw
68+
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\Auxiliary\\Build\\vcvars64.bat"
69+
nmake TARGET_CPU=amd64 BUILD=release SHARED=0 DIR_SUFFIX_CPU= -f makefile.vc
70+
71+
- name: Copy wxWidgets
72+
if: steps.win32-cache.outputs.cache-hit != 'true'
73+
run: |
74+
mkdir -p /mnt/c/opt/local64/pgm/
75+
cp -R wxWidgets /mnt/c/opt/local64/pgm/wxWidgets-3.x.x
76+
77+
- name: Compile Erlang
78+
if: steps.win32-cache.outputs.cache-hit != 'true'
79+
run: |
80+
git clone ${{ env.OTP_GITHUB_URL }}
81+
cd otp
82+
git checkout ${{ env.OTP_VERSION }}
83+
export ERL_TOP=`pwd`
84+
export MAKEFLAGS=-j$(($(nproc) + 2))
85+
export ERLC_USE_SERVER=true
86+
export ERTS_SKIP_DEPEND=true
87+
eval `./otp_build env_win32 x64`
88+
./otp_build all -a
89+
cp /mnt/c/opt/local64/pgm/wxWidgets-3.x.x/3rdparty/webview2/runtimes/win-x64/native/WebView2Loader.dll $ERL_TOP/release/win32/erts-*/bin/
90+
./otp_build installer_win32
91+
export NAME=`ls release/win32/otp*.exe`
92+
cp $NAME /mnt/c/opt/otp.exe
93+
94+
- name: Save Windows Cache
95+
if: steps.win32-cache.outputs.cache-hit != 'true'
96+
uses: actions/cache/save@v3
97+
with:
98+
path: "c:\\opt\\otp.exe"
99+
key: win32-wxwidgets-${{ env.WXWIDGETS_VERSION }}-otp-${{ env.OTP_VERSION }}
100+
101+
- name: Run Erlang installer
102+
shell: cmd
103+
run: C:\\opt\\otp.exe /S
104+
105+
- name: "Install msys2"
106+
uses: msys2/setup-msys2@v2
107+
with:
108+
install: pacman-mirrors pkg-config base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-go upx mingw-w64-x86_64-dlfcn unzip git tar mingw-w64-x86_64-nodejs mingw-w64-x86_64-imagemagick mingw-w64-x86_64-osslsigncode autoconf automake libtool gettext-devel gettext
109+
update: false
110+
release: false
111+
112+
- name: Locate Erlang
113+
shell: msys2 {0}
114+
run: |
115+
ERTS=`find /c/Program\ Files/[Ee]rl* -type d -name "erts-*" -not -path "*lib*"`
116+
echo $ERTS
117+
echo export PATH=\"\$PATH:$ERTS/bin\" > $HOME/.bashrc
118+
119+
- name: Locate NSIS
120+
shell: msys2 {0}
121+
run: |
122+
echo export PATH=\"\$PATH:/c/Program\ Files\ \(x86\)/NSIS\" >> $HOME/.bashrc
123+
124+
- name: Install Elixir
125+
shell: msys2 {0}
126+
run: |
127+
cd $HOME
128+
git clone https://github.com/elixir-lang/elixir.git
129+
cd elixir
130+
git checkout v${{ env.ELIXIR_VERSION }}
131+
make
132+
echo export PATH=\"\$PATH:$HOME/elixir/bin\" >> $HOME/.bashrc
133+
134+
- uses: actions/checkout@v1
135+
136+
- name: "Get dependencies"
137+
shell: msys2 {0}
138+
run: |
139+
mix local.hex --force
140+
mix local.rebar --force
141+
mix deps.get
142+
143+
- name: "npm install"
144+
shell: msys2 {0}
145+
run: |
146+
cd assets && npm install
147+
148+
- name: "Build Release"
149+
env:
150+
MAKE: make
151+
REBAR_TARGET_ARCH_WORDSIZE: 64
152+
REBAR_TARGET_ARCH: x86_64-w64-mingw32
153+
WIN32_KEY_PASS: ${{ secrets.WIN32_KEY_PASS }}
154+
shell: msys2 {0}
155+
run: |
156+
mix assets.deploy
157+
mix desktop.installer
158+
159+
- name: Archive Installer
160+
uses: actions/upload-artifact@v2
161+
with:
162+
name: Windows-Installer
163+
path: |
164+
_build/prod/*.exe
165+
166+
macos:
167+
runs-on: macos-11
168+
steps:
169+
- name: macOS Cache
170+
uses: actions/cache@v3
171+
id: macos-cache
172+
with:
173+
path: /Users/runner/.asdf
174+
key: macos-wxwidgets-${{ env.WXWIDGETS_VERSION }}-otp-${{ env.OTP_VERSION }}
175+
176+
- name: "Install brew deps"
177+
if: steps.macos-cache.outputs.cache-hit != 'true'
178+
run: |
179+
brew install binutils coreutils wget automake autoconf libtool
180+
181+
- name: "Installing wxWidgets"
182+
if: steps.macos-cache.outputs.cache-hit != 'true'
183+
run: |
184+
mkdir ~/projects && cd ~/projects
185+
git clone ${{ env.WXWIDGETS_REPO }}
186+
cd wxWidgets;
187+
git checkout ${{ env.WXWIDGETS_VERSION }}
188+
git submodule update --init
189+
./configure --prefix=/usr/local/wxWidgets --enable-webview --enable-compat30 --disable-shared
190+
make -j8
191+
192+
- name: "Installing Erlang"
193+
if: steps.macos-cache.outputs.cache-hit != 'true'
194+
run: |
195+
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
196+
. $HOME/.asdf/asdf.sh
197+
asdf plugin add erlang
198+
asdf plugin add elixir
199+
asdf plugin add nodejs
200+
echo "erlang ref:${{ env.OTP_VERSION }}" >> .tool-versions
201+
echo "elixir ${{ env.ELIXIR_VERSION }}${{ env.ELIXIR_VARIANT }}" >> .tool-versions
202+
echo "nodejs v18.7.0" >> .tool-versions
203+
export KERL_CONFIGURE_OPTIONS="--enable-parallel-configure --with-wxdir=`echo ~/projects/wxWidgets` --disable-jit --without-javac --disable-debug CXX='gcc -std=c++11'"
204+
asdf install
205+
206+
- uses: actions/checkout@v1
207+
- name: "Compile and Lint"
208+
run: |
209+
. $HOME/.asdf/asdf.sh
210+
echo "erlang ref:${{ env.OTP_VERSION }}" > .tool-versions
211+
echo "elixir ${{ env.ELIXIR_VERSION }}${{ env.ELIXIR_VARIANT }}" >> .tool-versions
212+
echo "nodejs v18.7.0" >> .tool-versions
213+
asdf install
214+
mix local.hex --force
215+
mix local.rebar --force
216+
mix deps.get
217+
cd assets && npm install
218+
219+
- name: "Build Release"
220+
env:
221+
MACOS_PEM: ${{ secrets.MACOS_PEM }}
222+
run: |
223+
. $HOME/.asdf/asdf.sh
224+
mix desktop.create_keychain maybe
225+
export MACOS_KEYCHAIN="$HOME/Library/Keychains/macos-build.keychain"
226+
export LD_LIBRARY_PATH="$HOME/projects/wxWidgets/lib/"
227+
mix assets.deploy
228+
mix desktop.installer
229+
230+
- name: Archive MacOS Installer
231+
uses: actions/upload-artifact@v2
232+
with:
233+
name: MacOS-Installer
234+
path: |
235+
_build/prod/*.dmg
236+
237+
linux-x86:
238+
permissions: write-all
239+
runs-on: ubuntu-latest
240+
steps:
241+
- uses: actions/checkout@v1
242+
- uses: whoan/docker-build-with-cache-action@master
243+
id: docker
244+
with:
245+
username: ${{ github.actor }}
246+
password: "${{ secrets.GITHUB_TOKEN }}" # you don't need to manually set this secret. GitHub does it on your behalf
247+
registry: docker.pkg.github.com
248+
image_name: linux_installer
249+
dockerfile: scripts/Dockerfile
250+
build_extra_args: |
251+
--build-arg=BASE_IMAGE=ubuntu:18.04
252+
--platform=linux/amd64
253+
--build-arg=PLATFORM=amd64
254+
--build-arg=WXWIDGETS_REPO=${{ env.WXWIDGETS_REPO }}
255+
--build-arg=WXWIDGETS_VERSION=${{ env.WXWIDGETS_VERSION }}
256+
--build-arg=OTP_VERSION=${{ env.OTP_VERSION }}
257+
--build-arg=OTP_GITHUB_URL=${{ env.OTP_GITHUB_URL }}
258+
--build-arg=ELIXIR_VERSION=${{ env.ELIXIR_VERSION }}
259+
--build-arg=ELIXIR_VARIANT=${{ env.ELIXIR_VARIANT }}
260+
261+
- name: Extract runfile
262+
run: |
263+
NAME=$(docker run --platform=linux/amd64 -i ${{steps.docker.outputs.FULL_IMAGE_NAME}} bash -c 'basename `ls /app/_build/prod/*.run`')
264+
NAME=`echo $NAME | tr -d '\n\r'`
265+
docker run --platform=linux/amd64 -i ${{steps.docker.outputs.FULL_IMAGE_NAME}} bash -c 'xxd /app/_build/prod/*.run' | xxd -r > $NAME
266+
chmod +x $NAME
267+
268+
- name: Archive Installer
269+
uses: actions/upload-artifact@v2
270+
with:
271+
name: Linux-Installer
272+
path: |
273+
./*.run
274+
275+

.github/workflows/ci.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
name: "CI"
1+
name: "Lint, test and build"
22
on: ["push", "pull_request"]
33

44
jobs:
55
test_and_build:
66
name: "Build mix release"
77
runs-on: "ubuntu-latest"
88
steps:
9-
- run: |
10-
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb
11-
sudo apt-get update
12-
sudo apt-get install --allow-downgrades esl-erlang=1:24.3.3-1 inotify-tools
13-
mkdir $HOME/elixir && cd $HOME/elixir
14-
wget https://github.com/elixir-lang/elixir/releases/download/v1.11.4/Precompiled.zip
15-
unzip Precompiled.zip
16-
echo "$HOME/elixir/bin" >> $GITHUB_PATH
9+
- name: Setup elixir
10+
uses: erlef/setup-beam@v1
11+
with:
12+
elixir-version: "1.14.5"
13+
otp-version: "24.3.3"
14+
1715
- uses: actions/checkout@v1
1816
- run: |
1917
mix local.hex --force

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/priv/*.so*
22
/priv/*.dylib*
3-
/priv/static/assets/app*
4-
/priv/static/cache_manifest.json
3+
/priv/static/*
54
*.log
65
*.zip
76
*.gz
@@ -36,3 +35,4 @@ npm-debug.log
3635

3736
# The directory NPM downloads your dependencies sources to.
3837
/assets/node_modules/
38+
/tmp

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
erlang 25.0.4
2-
elixir 1.13.4-otp-25
1+
elixir 1.14.5-otp-24
2+
erlang 24.3.4.13

assets/css/app.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* This file is for your main application css. */
2-
@use "../node_modules/nprogress/nprogress.css";
32
@import "./todo.scss";
43

54
/* LiveView specific classes for your customizations */

assets/js/app.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@
99
//
1010
import "phoenix_html"
1111
import {Socket} from "phoenix"
12-
import NProgress from "nprogress"
1312
import {LiveSocket} from "phoenix_live_view"
1413

1514
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
1615
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
1716

18-
// Show progress bar on live navigation and form submits
19-
window.addEventListener("phx:page-loading-start", info => NProgress.start())
20-
window.addEventListener("phx:page-loading-stop", info => NProgress.done())
21-
2217
// connect if there are any LiveViews on the page
2318
liveSocket.connect()
2419

0 commit comments

Comments
 (0)