|
| 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 | + |
0 commit comments